Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3399440
D14050.id46084.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D14050.id46084.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 3, 3:20 AM (20 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2609633
Default Alt Text
D14050.id46084.diff (2 KB)
Attached To
Mode
D14050: [lib][native] create action to set latest `backupID` on User Keys upload
Attached
Detach File
Event Timeline
Log In to Comment