Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3522186
D14050.id46177.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D14050.id46177.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,20 @@
+// @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 latestBackupInfo = action.payload;
+ return {
+ latestBackupInfo,
+ };
+ }
+ return store;
+}
+
+export { reduceBackupStore };
diff --git a/lib/types/backup-types.js b/lib/types/backup-types.js
--- a/lib/types/backup-types.js
+++ b/lib/types/backup-types.js
@@ -50,7 +50,7 @@
},
);
-type LocalLatestBackupInfo = {
+export type LocalLatestBackupInfo = {
+backupID: string,
+timestamp: number,
};
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
@@ -30,6 +30,7 @@
UpdateUserAvatarRequest,
UpdateUserAvatarResponse,
} from './avatar-types.js';
+import type { LocalLatestBackupInfo } from './backup-types.js';
import type {
CommunityStore,
AddCommunityPayload,
@@ -1643,6 +1644,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: LocalLatestBackupInfo,
+ +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 24, 6:01 AM (20 h, 12 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2698627
Default Alt Text
D14050.id46177.diff (3 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