diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js index 4329d29db..12359b191 100644 --- a/apps/mobile/src/views/Settings/index.js +++ b/apps/mobile/src/views/Settings/index.js @@ -11,6 +11,7 @@ import { TouchableOpacity, View, Appearance, + Pressable, } from 'react-native'; import * as Animatable from 'react-native-animatable'; @@ -259,7 +260,7 @@ export const Settings = ({route, navigation}) => { {user ? ( <> @@ -272,6 +273,7 @@ export const Settings = ({route, navigation}) => { borderBottomColor: colors.nav, borderBottomWidth: 0.5, paddingBottom: 3, + paddingHorizontal: 12, }}> Account Settings @@ -366,11 +368,11 @@ export const Settings = ({route, navigation}) => { onPress={item.func} style={{ width: '100%', - - paddingVertical: pv + 5, + height: 50, flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', + paddingHorizontal: 12, }}> { ) : ( <> - { - DDS.isTab - ? eSendEvent(eOpenLoginDialog) - : NavigationService.navigate('Login', { - root: true, - }); - }} - activeOpacity={opacity / 2} - customStyle={{ - paddingVertical: pv + 5, - marginBottom: pv + 5, - width: '100%', - flexDirection: 'row', - alignItems: 'center', - justifyContent: 'flex-start', - borderRadius: 5, - paddingHorizontal: 6, + - { + DDS.isTab + ? eSendEvent(eOpenLoginDialog) + : NavigationService.navigate('Login', { + root: true, + }); + }} + activeOpacity={opacity / 2} + customStyle={{ + paddingVertical: pv + 5, + marginBottom: pv + 5, + width: '100%', + flexDirection: 'row', alignItems: 'center', - justifyContent: 'center', + justifyContent: 'flex-start', + borderRadius: 5, + paddingHorizontal: 6, }}> - - - - - - You are not logged in - - - Login to sync notes. - - + + - - - - + + + You are not logged in + + + Login to sync notes. + + + + + + + + )} { fontFamily: WEIGHT.bold, textAlignVertical: 'center', color: colors.accent, - + paddingHorizontal: 12, borderBottomColor: colors.nav, borderBottomWidth: 0.5, paddingBottom: 3, @@ -480,6 +487,7 @@ export const Settings = ({route, navigation}) => { textAlignVertical: 'center', color: colors.pri, marginTop: pv + 5, + paddingHorizontal: 12, }}> Accent Color{'\n'} { alignSelf: 'center', flexDirection: 'row', flexWrap: 'wrap', + paddingHorizontal: 12, }}> {[ '#e6194b', @@ -555,7 +564,10 @@ export const Settings = ({route, navigation}) => { ))} - { await setSetting( settings, @@ -575,14 +587,14 @@ export const Settings = ({route, navigation}) => { ); } }} - activeOpacity={opacity} - style={{ + customStyle={{ width: '100%', marginHorizontal: 0, - paddingVertical: pv + 5, + height: 50, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', + paddingHorizontal: 12, }}> { settings.useSystemTheme ? 'toggle-switch' : 'toggle-switch-off' } /> - + - { if (!colors.night) { MMKV.setStringAsync('theme', JSON.stringify({night: true})); @@ -623,13 +638,15 @@ export const Settings = ({route, navigation}) => { } }} activeOpacity={opacity} - style={{ + customStyle={{ width: '100%', marginHorizontal: 0, - paddingVertical: pv + 5, + height: 50, flexDirection: 'row', + borderRadius: 0, alignItems: 'center', justifyContent: 'space-between', + paddingHorizontal: 12, }}> { color={colors.night ? colors.accent : colors.icon} name={colors.night ? 'toggle-switch' : 'toggle-switch-off'} /> - + - { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', + paddingHorizontal: 12, }}> { ))} - + {DDS.isTab ? ( - { await setSetting( settings, @@ -746,7 +767,6 @@ export const Settings = ({route, navigation}) => { !settings.forcePortraitOnTablet, ); }} - activeOpacity={opacity} style={{ width: '100%', marginHorizontal: 0, @@ -754,6 +774,7 @@ export const Settings = ({route, navigation}) => { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', + paddingHorizontal: 12, }}> { : 'toggle-switch-off' } /> - + ) : null} { borderBottomColor: colors.nav, borderBottomWidth: 0.5, paddingBottom: 3, + paddingHorizontal: 12, }}> Backup & Restore - { - await setSetting( - settings, - 'useSystemTheme', - !settings.useSystemTheme, - ); + {[ + { + name: 'Backup data', + func: () => { + Linking.openURL('https://www.notesnook.com/privacy.html'); + }, + desc: 'Backup all your data to phone storage', + }, + { + name: 'Restore data', + func: () => { + Linking.openURL('https://www.notesnook.com'); + }, + desc: 'Restore backup from your phone.', + }, + ].map((item) => ( + + + {item.name} + {'\n'} + + {item.desc} + + + {item.customComponent ? item.customComponent : null} + + ))} - if (!settings.useSystemTheme) { - MMKV.setStringAsync( - 'theme', - JSON.stringify({night: Appearance.getColorScheme() === 'dark'}), - ); - changeColorScheme( - Appearance.getColorScheme() === 'dark' - ? COLOR_SCHEME_DARK - : COLOR_SCHEME_LIGHT, - ); - } - }} - activeOpacity={opacity} + { alignItems: 'center', justifyContent: 'space-between', height: 50, + paddingHorizontal: 12, }}> { }, ].map((item) => ( { await setSetting(settings, 'reminder', item.value); }} key={item.value} style={{ backgroundColor: - settings.reminder === 'daily' ? colors.accent : colors.nav, + settings.reminder === item.value + ? colors.accent + : colors.nav, justifyContent: 'center', alignItems: 'center', width: 60, @@ -871,7 +927,7 @@ export const Settings = ({route, navigation}) => { {item.title} @@ -879,24 +935,42 @@ export const Settings = ({route, navigation}) => { ))} - + - { + if (!user) { + ToastEvent.show( + 'You must login to enable encryption', + 'error', + 'global', + 6000, + () => { + NavigationService.navigate('Login', { + root: true, + }); + }, + 'Login', + ); + return; + } await setSetting( settings, 'encryptedBackup', !settings.encryptedBackup, ); }} - activeOpacity={opacity} - style={{ + customStyle={{ width: '100%', marginHorizontal: 0, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', height: 50, + paddingHorizontal: 12, }}> { - - - {[ - { - name: 'Backup data', - func: () => { - Linking.openURL('https://www.notesnook.com/privacy.html'); - }, - desc: 'Backup all your data to phone storage', - }, - { - name: 'Restore data', - func: () => { - Linking.openURL('https://www.notesnook.com'); - }, - desc: 'Restore backup from your phone.', - }, - ].map((item) => ( - - - {item.name} - {'\n'} - - {item.desc} - - - {item.customComponent ? item.customComponent : null} - - ))} + { borderBottomColor: colors.nav, borderBottomWidth: 0.5, paddingBottom: 3, + paddingHorizontal: 12, }}> Other @@ -987,21 +1019,32 @@ export const Settings = ({route, navigation}) => { }, desc: 'Read our privacy policy', }, + { + name: 'Check for updates', + func: () => { + Linking.openURL('https://www.notesnook.com/privacy.html'); + }, + desc: 'Check for a newer version of app', + }, { name: 'About', func: () => { Linking.openURL('https://www.notesnook.com'); }, - desc: null, + desc: 'You are using the latest version of our app.', }, ].map((item) => ( - { fontFamily: WEIGHT.regular, textAlignVertical: 'center', color: colors.pri, + width: '100%', }}> {item.name} {'\n'} @@ -1021,7 +1065,7 @@ export const Settings = ({route, navigation}) => { {item.customComponent ? item.customComponent : null} - + ))}