Merge pull request #6909 from BlueWallet/switchpri

ADD: Toggle to disable privacy blur
This commit is contained in:
GLaDOS 2024-08-13 20:18:41 +00:00 committed by GitHub
commit 2e4c3151fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 16 deletions

View file

@ -8,7 +8,6 @@ import { BlueApp } from '../../class';
import { saveLanguage, STORAGE_KEY } from '../../loc';
import { FiatUnit, TFiatUnit } from '../../models/fiatUnit';
import { getEnabled as getIsDeviceQuickActionsEnabled, setEnabled as setIsDeviceQuickActionsEnabled } from '..//DeviceQuickActions';
import presentAlert from '../Alert';
import { getIsHandOffUseEnabled, setIsHandOffUseEnabled } from '../HandOffComponent';
import { isBalanceDisplayAllowed, setBalanceDisplayAllowed } from '../WidgetCommunication';
import { useStorage } from '../../hooks/context/useStorage';
@ -225,9 +224,6 @@ export const SettingsProvider: React.FC<{ children: React.ReactNode }> = ({ chil
(value: boolean) => {
setIsPrivacyBlurEnabled(value);
console.debug(`Privacy blur: ${isPrivacyBlurEnabled}`);
if (!value) {
presentAlert({ message: 'Privacy blur has been disabled.' });
}
},
[isPrivacyBlurEnabled],
);

View file

@ -221,6 +221,8 @@
"about_sm_discord": "Discord Server",
"about_sm_telegram": "Telegram channel",
"about_sm_twitter": "Follow us on Twitter",
"privacy_temporary_screenshots": "Allow Screenshots",
"privacy_temporary_screenshots_instructions": "Screen capture protection will be turned off for this session, allowing you to take screenshots. Once you close and reopen the app, the protection will be automatically turned back on.",
"advanced_options": "Advanced Options",
"biometrics": "Biometrics",
"biometrics_no_longer_available": "Your device settings have changed and no longer match the selected security settings in the app. Please re-enable biometrics or passcode, then restart the app to apply these changes.",

View file

@ -17,6 +17,7 @@ enum SettingsPrivacySection {
ReadClipboard,
QuickActions,
Widget,
TemporaryScreenshots,
}
const SettingsPrivacy: React.FC = () => {
@ -25,6 +26,7 @@ const SettingsPrivacy: React.FC = () => {
const {
isDoNotTrackEnabled,
setDoNotTrackStorage,
isPrivacyBlurEnabled,
setIsPrivacyBlurEnabledState,
isWidgetBalanceDisplayAllowed,
setIsWidgetBalanceDisplayAllowedStorage,
@ -36,7 +38,6 @@ const SettingsPrivacy: React.FC = () => {
const [isLoading, setIsLoading] = useState<number>(SettingsPrivacySection.All);
const [storageIsEncrypted, setStorageIsEncrypted] = useState<boolean>(true);
const [isPrivacyBlurEnabledTapped, setIsPrivacyBlurEnabledTapped] = useState<number>(0);
const styleHooks = StyleSheet.create({
root: {
backgroundColor: colors.background,
@ -89,13 +90,14 @@ const SettingsPrivacy: React.FC = () => {
setIsLoading(SettingsPrivacySection.None);
};
const openApplicationSettings = () => {
openSettings();
const onTemporaryScreenshotsValueChange = (value: boolean) => {
setIsLoading(SettingsPrivacySection.TemporaryScreenshots);
setIsPrivacyBlurEnabledState(value);
setIsLoading(SettingsPrivacySection.None);
};
const onDisablePrivacyTapped = () => {
setIsPrivacyBlurEnabledState(!(isPrivacyBlurEnabledTapped >= 10));
setIsPrivacyBlurEnabledTapped(prev => prev + 1);
const openApplicationSettings = () => {
openSettings();
};
return (
@ -117,7 +119,7 @@ const SettingsPrivacy: React.FC = () => {
}}
/>
<BlueCard>
<Pressable accessibilityRole="button" onPress={onDisablePrivacyTapped}>
<Pressable accessibilityRole="button">
<BlueText>{loc.settings.privacy_clipboard_explanation}</BlueText>
</Pressable>
</BlueCard>
@ -132,13 +134,28 @@ const SettingsPrivacy: React.FC = () => {
testID: 'QuickActionsSwitch',
}}
/>
{}
<BlueCard>
<BlueText>{loc.settings.privacy_quickactions_explanation}</BlueText>
<BlueSpacing20 />
{storageIsEncrypted && <BlueText>{loc.settings.encrypted_feature_disabled}</BlueText>}
</BlueCard>
<ListItem
title={loc.settings.privacy_temporary_screenshots}
Component={TouchableWithoutFeedback}
switch={{
onValueChange: onTemporaryScreenshotsValueChange,
value: isPrivacyBlurEnabled,
disabled: isLoading === SettingsPrivacySection.All,
}}
/>
<BlueCard>
<BlueText>{loc.settings.privacy_temporary_screenshots_instructions}</BlueText>
</BlueCard>
<BlueSpacing20 />
<ListItem title={loc.settings.privacy_system_settings} chevron onPress={openApplicationSettings} testID="PrivacySystemSettings" />
<BlueSpacing20 />
<ListItem
title={loc.settings.privacy_do_not_track}
Component={TouchableWithoutFeedback}
@ -170,10 +187,6 @@ const SettingsPrivacy: React.FC = () => {
</>
)}
<BlueSpacing20 />
<BlueSpacing20 />
<ListItem title={loc.settings.privacy_system_settings} chevron onPress={openApplicationSettings} testID="PrivacySystemSettings" />
<BlueSpacing20 />
</ScrollView>
);
};