diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index 12359b191..d9ecf4914 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -1,6 +1,7 @@
import {useIsFocused} from '@react-navigation/native';
import React, {useEffect, useState} from 'react';
import {
+ Appearance,
Clipboard,
Linking,
Modal,
@@ -10,11 +11,8 @@ import {
Text,
TouchableOpacity,
View,
- Appearance,
- Pressable,
} from 'react-native';
import * as Animatable from 'react-native-animatable';
-
import QRCode from 'react-native-qrcode-generator';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {
@@ -29,24 +27,24 @@ import {
SIZE,
WEIGHT,
} from '../../common/common';
+import {PressableButton} from '../../components/PressableButton';
+import Seperator from '../../components/Seperator';
import {Toast} from '../../components/Toast';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager';
import {eOpenLoginDialog, eResetApp} from '../../services/events';
import NavigationService from '../../services/NavigationService';
+import {MMKV} from '../../utils/storage';
import {
db,
DDS,
+ hexToRGBA,
+ RGB_Linear_Shade,
setSetting,
ToastEvent,
w,
- RGB_Linear_Shade,
- hexToRGBA,
} from '../../utils/utils';
-import {MMKV} from '../../utils/storage';
-import {PressableButton} from '../../components/PressableButton';
-import Seperator from '../../components/Seperator';
export const Settings = ({route, navigation}) => {
const [state, dispatch] = useTracked();
@@ -112,6 +110,60 @@ export const Settings = ({route, navigation}) => {
}
}, [isFocused]);
+ const SectionHeader = ({title}) => (
+
+ {title}
+
+ );
+
+ const Button = ({title, tagline, customComponent, onPress, key}) => (
+
+
+ {title}
+ {tagline ? '\n' : null}
+
+
+ {tagline}
+
+
+ {customComponent ? customComponent : null}
+
+ );
+
return (
{
}}>
{user ? (
<>
-
- Account Settings
-
+
{
},
},
].map((item) => (
-
-
- {item.name}
-
-
+
))}
>
) : (
@@ -466,19 +485,7 @@ export const Settings = ({route, navigation}) => {
>
)}
-
- Appearance
-
+
{
))}
- {
await setSetting(
settings,
@@ -587,46 +597,20 @@ export const Settings = ({route, navigation}) => {
);
}
}}
- customStyle={{
- width: '100%',
- marginHorizontal: 0,
- height: 50,
- flexDirection: 'row',
- alignItems: 'center',
- justifyContent: 'space-between',
- paddingHorizontal: 12,
- }}>
-
- Use System Dark Mode{'\n'}
-
- {settings.useSystemTheme
- ? 'Switch to dark theme based on system settings'
- : 'Keep the app theme independent from system settings'}
-
-
-
-
+ customComponent={
+
+ }
+ />
- {
if (!colors.night) {
MMKV.setStringAsync('theme', JSON.stringify({night: true}));
@@ -637,39 +621,14 @@ export const Settings = ({route, navigation}) => {
changeColorScheme(COLOR_SCHEME_LIGHT);
}
}}
- activeOpacity={opacity}
- customStyle={{
- width: '100%',
- marginHorizontal: 0,
- height: 50,
- flexDirection: 'row',
- borderRadius: 0,
- alignItems: 'center',
- justifyContent: 'space-between',
- paddingHorizontal: 12,
- }}>
-
- Dark Mode{'\n'}
-
- {colors.night ? 'Turn off dark mode' : 'Turn on dark mode'}
-
-
-
-
+ customComponent={
+
+ }
+ />
{
{DDS.isTab ? (
- {
await setSetting(
settings,
@@ -767,51 +724,23 @@ export const Settings = ({route, navigation}) => {
!settings.forcePortraitOnTablet,
);
}}
- style={{
- width: '100%',
- marginHorizontal: 0,
- paddingVertical: pv + 5,
- flexDirection: 'row',
- alignItems: 'center',
- justifyContent: 'space-between',
- paddingHorizontal: 12,
- }}>
-
- Force portrait mode
-
-
-
+ customComponent={
+
+ }
+ />
) : null}
-
- Backup & Restore
-
+
{[
{
@@ -829,38 +758,7 @@ export const Settings = ({route, navigation}) => {
desc: 'Restore backup from your phone.',
},
].map((item) => (
-
-
- {item.name}
- {'\n'}
-
- {item.desc}
-
-
- {item.customComponent ? item.customComponent : null}
-
+
))}
{
- {
if (!user) {
ToastEvent.show(
@@ -963,53 +860,18 @@ export const Settings = ({route, navigation}) => {
!settings.encryptedBackup,
);
}}
- customStyle={{
- width: '100%',
- marginHorizontal: 0,
- flexDirection: 'row',
- alignItems: 'center',
- justifyContent: 'space-between',
- height: 50,
- paddingHorizontal: 12,
- }}>
-
- Encrypted Backups{'\n'}
-
- Encrypt your data before backup
-
-
-
-
+ customComponent={
+
+ }
+ />
-
- Other
-
+
{[
{
@@ -1034,38 +896,7 @@ export const Settings = ({route, navigation}) => {
desc: 'You are using the latest version of our app.',
},
].map((item) => (
-
-
- {item.name}
- {'\n'}
-
- {item.desc}
-
-
- {item.customComponent ? item.customComponent : null}
-
+
))}