Page MenuHomePhabricator

D14050.id46084.diff
No OneTemporary

D14050.id46084.diff

diff --git a/lib/actions/backup-actions.js b/lib/actions/backup-actions.js
new file mode 100644
--- /dev/null
+++ b/lib/actions/backup-actions.js
@@ -0,0 +1,9 @@
+// @flow
+
+const createUserKeysBackupActionTypes = Object.freeze({
+ started: 'CREATE_USER_KEYS_BACKUP_STARTED',
+ success: 'CREATE_USER_KEYS_BACKUP_SUCCESS',
+ failed: 'CREATE_USER_KEYS_BACKUP_FAILED',
+});
+
+export { createUserKeysBackupActionTypes };
diff --git a/lib/reducers/backup-reducer.js b/lib/reducers/backup-reducer.js
new file mode 100644
--- /dev/null
+++ b/lib/reducers/backup-reducer.js
@@ -0,0 +1,23 @@
+// @flow
+
+import { createUserKeysBackupActionTypes } from '../actions/backup-actions.js';
+import type { BackupStore } from '../types/backup-types.js';
+import type { BaseAction } from '../types/redux-types.js';
+
+function reduceBackupStore(
+ store: BackupStore,
+ action: BaseAction,
+): BackupStore {
+ if (action.type === createUserKeysBackupActionTypes.success) {
+ const backupID = action.payload;
+ return {
+ latestBackupInfo: {
+ backupID,
+ timestamp: Date.now(),
+ },
+ };
+ }
+ return store;
+}
+
+export { reduceBackupStore };
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -1643,6 +1643,22 @@
| {
+type: 'SET_MISSING_DEVICE_LISTS',
+payload: SetMissingDeviceListsPayload,
+ }
+ | {
+ +type: 'CREATE_USER_KEYS_BACKUP_STARTED',
+ +loadingInfo?: LoadingInfo,
+ +payload?: void,
+ }
+ | {
+ +type: 'CREATE_USER_KEYS_BACKUP_SUCCESS',
+ +payload: string,
+ +loadingInfo: LoadingInfo,
+ }
+ | {
+ +type: 'CREATE_USER_KEYS_BACKUP_FAILED',
+ +error: true,
+ +payload: Error,
+ +loadingInfo: LoadingInfo,
},
}>;
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
@@ -17,6 +17,7 @@
import { setNewSessionActionType } from 'lib/keyserver-conn/keyserver-conn-types.js';
import type { ThreadStoreOperation } from 'lib/ops/thread-store-ops.js';
import { threadStoreOpsHandlers } from 'lib/ops/thread-store-ops.js';
+import { reduceBackupStore } from 'lib/reducers/backup-reducer.js';
import { queueDBOps } from 'lib/reducers/db-ops-reducer.js';
import { reduceLoadingStatuses } from 'lib/reducers/loading-reducer.js';
import baseReducer from 'lib/reducers/master-reducer.js';
@@ -327,6 +328,7 @@
ops,
notificationsCreationData,
),
+ backupStore: reduceBackupStore(state.backupStore, action),
};
return state;

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 10:47 AM (2 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2699727
Default Alt Text
D14050.id46084.diff (2 KB)

Event Timeline