Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3369963
D9011.id30754.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D9011.id30754.diff
View Options
diff --git a/native/navigation/route-names.js b/native/navigation/route-names.js
--- a/native/navigation/route-names.js
+++ b/native/navigation/route-names.js
@@ -53,6 +53,7 @@
export const AppRouteName = 'App';
export const AppsRouteName = 'Apps';
export const BackgroundChatThreadListRouteName = 'BackgroundChatThreadList';
+export const BackupMenuRouteName = 'BackupMenu';
export const BlockListRouteName = 'BlockList';
export const BuildInfoRouteName = 'BuildInfo';
export const CalendarRouteName = 'Calendar';
@@ -223,6 +224,7 @@
+BlockList: void,
+LinkedDevices: void,
+SecondaryDeviceQRCodeScanner: void,
+ +BackupMenu: void,
};
export type CommunityDrawerParamList = { +TabNavigator: void };
diff --git a/native/profile/backup-menu.react.js b/native/profile/backup-menu.react.js
new file mode 100644
--- /dev/null
+++ b/native/profile/backup-menu.react.js
@@ -0,0 +1,82 @@
+// @flow
+
+import * as React from 'react';
+import { Switch, Text, View } from 'react-native';
+import { ScrollView } from 'react-native-gesture-handler';
+import { useDispatch } from 'react-redux';
+
+import { setLocalSettingsActionType } from '../redux/action-types.js';
+import { useSelector } from '../redux/redux-utils.js';
+import { useStyles } from '../themes/colors.js';
+
+// eslint-disable-next-line no-unused-vars
+function BackupMenu(props: { ... }): React.Node {
+ const styles = useStyles(unboundStyles);
+ const dispatch = useDispatch();
+
+ const isBackupEnabled = useSelector(
+ state => state.localSettings.isBackupEnabled,
+ );
+
+ const onBackupToggled = React.useCallback(
+ value => {
+ dispatch({
+ type: setLocalSettingsActionType,
+ payload: { isBackupEnabled: value },
+ });
+ },
+ [dispatch],
+ );
+
+ return (
+ <ScrollView
+ contentContainerStyle={styles.scrollViewContentContainer}
+ style={styles.scrollView}
+ >
+ <Text style={styles.header}>SETTINGS</Text>
+ <View style={styles.section}>
+ <View style={styles.submenuButton}>
+ <Text style={styles.submenuText}>Toggle automatic backup</Text>
+ <Switch value={isBackupEnabled} onValueChange={onBackupToggled} />
+ </View>
+ </View>
+ </ScrollView>
+ );
+}
+
+const unboundStyles = {
+ scrollViewContentContainer: {
+ paddingTop: 24,
+ },
+ scrollView: {
+ backgroundColor: 'panelBackground',
+ },
+ section: {
+ backgroundColor: 'panelForeground',
+ borderBottomWidth: 1,
+ borderColor: 'panelForegroundBorder',
+ borderTopWidth: 1,
+ marginBottom: 24,
+ marginVertical: 2,
+ },
+ header: {
+ color: 'panelBackgroundLabel',
+ fontSize: 12,
+ fontWeight: '400',
+ paddingBottom: 3,
+ paddingHorizontal: 24,
+ },
+ submenuButton: {
+ flexDirection: 'row',
+ paddingHorizontal: 24,
+ paddingVertical: 10,
+ alignItems: 'center',
+ },
+ submenuText: {
+ color: 'panelForegroundLabel',
+ flex: 1,
+ fontSize: 16,
+ },
+};
+
+export default BackupMenu;
diff --git a/native/profile/profile-screen.react.js b/native/profile/profile-screen.react.js
--- a/native/profile/profile-screen.react.js
+++ b/native/profile/profile-screen.react.js
@@ -36,6 +36,7 @@
PrivacyPreferencesRouteName,
DefaultNotificationsPreferencesRouteName,
LinkedDevicesRouteName,
+ BackupMenuRouteName,
} from '../navigation/route-names.js';
import { useSelector } from '../redux/redux-utils.js';
import { type Colors, useColors, useStyles } from '../themes/colors.js';
@@ -86,7 +87,7 @@
}
render() {
- let developerTools, defaultNotifications;
+ let developerTools, defaultNotifications, backupMenu;
const { staffCanSee } = this.props;
if (staffCanSee) {
developerTools = (
@@ -99,6 +100,10 @@
onPress={this.onPressDefaultNotifications}
/>
);
+
+ backupMenu = (
+ <ProfileRow content="Backup menu" onPress={this.onPressBackupMenu} />
+ );
}
let passwordEditionUI;
@@ -170,6 +175,7 @@
<ProfileRow content="Appearance" onPress={this.onPressAppearance} />
<ProfileRow content="Privacy" onPress={this.onPressPrivacy} />
{defaultNotifications}
+ {backupMenu}
</View>
<View style={this.props.styles.section}>
{linkedDevices}
@@ -301,6 +307,10 @@
onPressBlockList = () => {
this.navigateIfActive(BlockListRouteName);
};
+
+ onPressBackupMenu = () => {
+ this.navigateIfActive(BackupMenuRouteName);
+ };
}
const unboundStyles = {
diff --git a/native/profile/profile.react.js b/native/profile/profile.react.js
--- a/native/profile/profile.react.js
+++ b/native/profile/profile.react.js
@@ -10,6 +10,7 @@
import { View, useWindowDimensions } from 'react-native';
import AppearancePreferences from './appearance-preferences.react.js';
+import BackupMenu from './backup-menu.react.js';
import BuildInfo from './build-info.react.js';
import DefaultNotificationsPreferences from './default-notifications-preferences.react.js';
import DeleteAccount from './delete-account.react.js';
@@ -41,6 +42,7 @@
BlockListRouteName,
LinkedDevicesRouteName,
SecondaryDeviceQRCodeScannerRouteName,
+ BackupMenuRouteName,
type ScreenParamList,
type ProfileParamList,
} from '../navigation/route-names.js';
@@ -59,6 +61,7 @@
// eslint-disable-next-line react/display-name
headerRight: () => <LinkedDevicesHeaderRightButton />,
};
+const backupMenuOptions = { headerTitle: 'Backup menu' };
const secondaryDeviceQRCodeScannerOptions = {
headerTitle: '',
headerBackTitleVisible: false,
@@ -148,6 +151,11 @@
component={LinkedDevices}
options={linkedDevicesOptions}
/>
+ <Profile.Screen
+ name={BackupMenuRouteName}
+ component={BackupMenu}
+ options={backupMenuOptions}
+ />
<Profile.Screen
name={SecondaryDeviceQRCodeScannerRouteName}
component={SecondaryDeviceQRCodeScanner}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 12:26 AM (17 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2587034
Default Alt Text
D9011.id30754.diff (5 KB)
Attached To
Mode
D9011: [client-backup] add backup menu screen
Attached
Detach File
Event Timeline
Log In to Comment