diff --git a/lib/reducers/backup-reducer.js b/lib/reducers/backup-reducer.js --- a/lib/reducers/backup-reducer.js +++ b/lib/reducers/backup-reducer.js @@ -12,10 +12,12 @@ if (action.type === createUserKeysBackupActionTypes.success) { const latestBackupInfo = action.payload; return { + ...store, latestBackupInfo, }; } else if (action.type === changeIdentityUserPasswordActionTypes.success) { return { + ...store, latestBackupInfo: null, }; } 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 @@ -79,4 +79,5 @@ export type BackupStore = { +latestBackupInfo: ?LocalLatestBackupInfo, + +latestDatabaseVersion: number, }; diff --git a/native/redux/default-state.js b/native/redux/default-state.js --- a/native/redux/default-state.js +++ b/native/redux/default-state.js @@ -110,6 +110,7 @@ }, backupStore: { latestBackupInfo: null, + latestDatabaseVersion: 0, }, }: AppState); diff --git a/native/redux/persist-constants.js b/native/redux/persist-constants.js --- a/native/redux/persist-constants.js +++ b/native/redux/persist-constants.js @@ -5,6 +5,6 @@ // NOTE: renaming this constant requires updating // `native/native_rust_library/build.rs` to correctly // scrap Redux state version from this file. -const storeVersion = 91; +const storeVersion = 92; export { rootKey, storeVersion }; diff --git a/native/redux/persist.js b/native/redux/persist.js --- a/native/redux/persist.js +++ b/native/redux/persist.js @@ -118,6 +118,7 @@ MixedRawThreadInfos, RawThreadInfos, } from 'lib/types/thread-types.js'; +import { getConfig } from 'lib/utils/config.js'; import { stripMemberPermissionsFromRawThreadInfos } from 'lib/utils/member-info-utils.js'; import { translateClientDBMessageInfoToRawMessageInfo, @@ -1602,6 +1603,20 @@ }, ops: {}, }): MigrationFunction), + [92]: (async (state: AppState) => { + const { sqliteAPI } = getConfig(); + const databaseVersions = await sqliteAPI.getDatabaseVersion(); + return { + state: { + ...state, + backupStore: { + ...state.backupStore, + latestDatabaseVersion: databaseVersions, + }, + }, + ops: {}, + }; + }: MigrationFunction), }); const persistConfig = { diff --git a/web/redux/persist-constants.js b/web/redux/persist-constants.js --- a/web/redux/persist-constants.js +++ b/web/redux/persist-constants.js @@ -3,6 +3,6 @@ const rootKey = 'root'; const rootKeyPrefix = 'persist:'; const completeRootKey = `${rootKeyPrefix}${rootKey}`; -const storeVersion = 91; +const storeVersion = 92; export { rootKey, rootKeyPrefix, completeRootKey, storeVersion }; diff --git a/web/redux/persist.js b/web/redux/persist.js --- a/web/redux/persist.js +++ b/web/redux/persist.js @@ -837,6 +837,10 @@ }, ops: {}, }): MigrationFunction), + [92]: (async (state: AppState) => ({ + state, + ops: {}, + }): MigrationFunction), }; const persistConfig: PersistConfig = {