Skip to content

Commit

Permalink
Merge pull request #5766 from BlueWallet/privacyscreenfix
Browse files Browse the repository at this point in the history
REF: Privacy screen
  • Loading branch information
GladosBlueWallet committed Oct 23, 2023
2 parents 1ff5905 + de918db commit 7d976a9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
1 change: 1 addition & 0 deletions components/navigationStyle.tsx
Expand Up @@ -23,6 +23,7 @@ type NavigationOptions = {
fontWeight: string;
color: string;
};
headerLargeTitle?: boolean;
gestureEnabled?: boolean;
swipeEnabled?: boolean;
headerHideBackButton?: boolean;
Expand Down
44 changes: 29 additions & 15 deletions screen/settings/SettingsPrivacy.js
@@ -1,9 +1,10 @@
import React, { useContext, useEffect, useState } from 'react';
import { ScrollView, TouchableWithoutFeedback, StyleSheet, Linking, Platform, Pressable } from 'react-native';
import { ScrollView, TouchableWithoutFeedback, StyleSheet, Platform, Pressable, Text } from 'react-native';
import { openSettings } from 'react-native-permissions';
import { useTheme } from '@react-navigation/native';

import navigationStyle from '../../components/navigationStyle';
import { BlueText, BlueSpacing20, BlueListItem, BlueCard, BlueHeaderDefaultSub } from '../../BlueComponents';
import { BlueText, BlueSpacing20, BlueListItem, BlueCard, BlueHeaderDefaultSub, BlueSpacing40 } from '../../BlueComponents';
import loc from '../../loc';
import DeviceQuickActions from '../../class/quick-actions';
import BlueClipboard from '../../blue_modules/clipboard';
Expand All @@ -24,6 +25,11 @@ const SettingsPrivacy = () => {
const [isQuickActionsEnabled, setIsQuickActionsEnabled] = useState(false);
const [storageIsEncrypted, setStorageIsEncrypted] = useState(true);
const [isPrivacyBlurEnabledTapped, setIsPrivacyBlurEnabledTapped] = useState(0);
const styleHooks = StyleSheet.create({
widgetsHeader: {
color: colors.foregroundColor,
},
});

useEffect(() => {
(async () => {
Expand Down Expand Up @@ -93,7 +99,7 @@ const SettingsPrivacy = () => {
});

const openApplicationSettings = () => {
Linking.openSettings();
openSettings();
};

const onDisablePrivacyTapped = () => {
Expand All @@ -104,7 +110,7 @@ const SettingsPrivacy = () => {
return (
<ScrollView style={[styles.root, stylesWithThemeHook.root]}>
<Pressable accessibilityRole="button" onPress={onDisablePrivacyTapped}>
<BlueHeaderDefaultSub leftText={loc.settings.general} rightComponent={null} />
{Platform.OS === 'android' ? <BlueHeaderDefaultSub leftText={loc.settings.general} /> : <></>}
</Pressable>
<BlueListItem
hideChevron
Expand Down Expand Up @@ -134,9 +140,21 @@ const SettingsPrivacy = () => {
</BlueCard>
</>
)}
<BlueListItem
hideChevron
title={loc.settings.privacy_do_not_track}
Component={TouchableWithoutFeedback}
switch={{ onValueChange: onDoNotTrackValueChange, value: doNotTrackSwitchValue, disabled: isLoading === sections.ALL }}
/>
<BlueCard>
<BlueText>{loc.settings.privacy_do_not_track_explanation}</BlueText>
</BlueCard>
{Platform.OS === 'ios' && !storageIsEncrypted && (
<>
<BlueHeaderDefaultSub leftText={loc.settings.widgets} rightComponent={null} />
<BlueSpacing40 />
<Text adjustsFontSizeToFit style={[styles.widgetsHeader, styleHooks.widgetsHeader]}>
{loc.settings.widgets}
</Text>
<BlueListItem
hideChevron
title={loc.settings.total_balance}
Expand All @@ -154,15 +172,6 @@ const SettingsPrivacy = () => {
)}
<BlueSpacing20 />

<BlueListItem
hideChevron
title={loc.settings.privacy_do_not_track}
Component={TouchableWithoutFeedback}
switch={{ onValueChange: onDoNotTrackValueChange, value: doNotTrackSwitchValue, disabled: isLoading === sections.ALL }}
/>
<BlueCard>
<BlueText>{loc.settings.privacy_do_not_track_explanation}</BlueText>
</BlueCard>
<BlueSpacing20 />
<BlueListItem title={loc.settings.privacy_system_settings} chevron onPress={openApplicationSettings} testID="PrivacySystemSettings" />
<BlueSpacing20 />
Expand All @@ -174,8 +183,13 @@ const styles = StyleSheet.create({
root: {
flex: 1,
},
widgetsHeader: {
fontWeight: 'bold',
fontSize: 30,
marginLeft: 17,
},
});

SettingsPrivacy.navigationOptions = navigationStyle({}, opts => ({ ...opts, title: loc.settings.privacy }));
SettingsPrivacy.navigationOptions = navigationStyle({ headerLargeTitle: true }, opts => ({ ...opts, title: loc.settings.privacy }));

export default SettingsPrivacy;

0 comments on commit 7d976a9

Please sign in to comment.