Page MenuHomePhabricator

D9010.diff
No OneTemporary

D9010.diff

diff --git a/native/backup/backup-handler.js b/native/backup/backup-handler.js
--- a/native/backup/backup-handler.js
+++ b/native/backup/backup-handler.js
@@ -19,6 +19,9 @@
const currentUserID = useSelector(
state => state.currentUserInfo && state.currentUserInfo.id,
);
+ const isBackupEnabled = useSelector(
+ state => state.localSettings.isBackupEnabled,
+ );
const loggedIn = useSelector(isLoggedIn);
const staffCanSee = useStaffCanSee();
@@ -26,7 +29,7 @@
React.useEffect(() => {
(async () => {
- if (!loggedIn || !staffCanSee) {
+ if (!isBackupEnabled || !loggedIn || !staffCanSee) {
return;
}
@@ -54,7 +57,14 @@
}
}
})();
- }, [currentUserID, loggedIn, staffCanSee, uploadBackupProtocol, userStore]);
+ }, [
+ currentUserID,
+ isBackupEnabled,
+ staffCanSee,
+ loggedIn,
+ uploadBackupProtocol,
+ userStore,
+ ]);
return null;
}
diff --git a/native/redux/action-types.js b/native/redux/action-types.js
--- a/native/redux/action-types.js
+++ b/native/redux/action-types.js
@@ -10,6 +10,7 @@
import type { AppState } from './state-types.js';
import type { DeviceCameraInfo } from '../types/camera.js';
import type { ConnectivityInfo } from '../types/connectivity.js';
+import type { LocalSettings } from '../types/local-settings-types.js';
import type { GlobalThemeInfo } from '../types/themes.js';
export const updateDimensionsActiveType = 'UPDATE_DIMENSIONS';
@@ -21,6 +22,7 @@
'UPDATE_THREAD_LAST_NAVIGATED';
export const setStoreLoadedActionType = 'SET_STORE_LOADED';
export const setReduxStateActionType = 'SET_REDUX_STATE';
+export const setLocalSettingsActionType = 'SET_LOCAL_SETTINGS';
export const backgroundActionTypes: Set<string> = new Set([
saveMessagesActionType,
@@ -62,4 +64,5 @@
}
| {
+type: 'SET_STORE_LOADED',
- };
+ }
+ | { +type: 'SET_LOCAL_SETTINGS', +payload: LocalSettings };
diff --git a/native/redux/redux-setup.js b/native/redux/redux-setup.js
--- a/native/redux/redux-setup.js
+++ b/native/redux/redux-setup.js
@@ -44,6 +44,7 @@
setReduxStateActionType,
setStoreLoadedActionType,
type Action,
+ setLocalSettingsActionType,
} from './action-types.js';
import { remoteReduxDevServerConfig } from './dev-tools.js';
import { defaultDimensionsInfo } from './dimensions-updater.react.js';
@@ -130,6 +131,9 @@
},
},
},
+ localSettings: {
+ isBackupEnabled: false,
+ },
}: AppState);
function reducer(state: AppState = defaultState, action: Action) {
@@ -300,6 +304,20 @@
});
}
return state;
+ } else if (action.type === setLocalSettingsActionType) {
+ return {
+ ...state,
+ localSettings: { ...state.localSettings, ...action.payload },
+ };
+ } else if (
+ action.type === logOutActionTypes.started ||
+ action.type === logOutActionTypes.success ||
+ action.type === deleteAccountActionTypes.success
+ ) {
+ return {
+ ...state,
+ localSettings: { isBackupEnabled: false },
+ };
}
if (action.type === setNewSessionActionType) {
diff --git a/native/redux/state-types.js b/native/redux/state-types.js
--- a/native/redux/state-types.js
+++ b/native/redux/state-types.js
@@ -23,6 +23,7 @@
import type { NavInfo } from '../navigation/default-state.js';
import type { DeviceCameraInfo } from '../types/camera.js';
import type { ConnectivityInfo } from '../types/connectivity.js';
+import type { LocalSettings } from '../types/local-settings-types.js';
import type { GlobalThemeInfo } from '../types/themes.js';
export type AppState = {
@@ -58,4 +59,5 @@
+inviteLinksStore: InviteLinksStore,
+lastCommunicatedPlatformDetails: LastCommunicatedPlatformDetails,
+keyserverStore: KeyserverStore,
+ +localSettings: LocalSettings,
};
diff --git a/native/types/local-settings-types.js b/native/types/local-settings-types.js
new file mode 100644
--- /dev/null
+++ b/native/types/local-settings-types.js
@@ -0,0 +1,5 @@
+// @flow
+
+export type LocalSettings = {
+ +isBackupEnabled: boolean,
+};

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 1:17 AM (17 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2696966
Default Alt Text
D9010.diff (3 KB)

Event Timeline