diff --git a/native/redux/handle-redux-migration-failure.js b/native/redux/handle-redux-migration-failure.js --- a/native/redux/handle-redux-migration-failure.js +++ b/native/redux/handle-redux-migration-failure.js @@ -25,6 +25,9 @@ 'integrityStore', 'communityStore', 'keyserverStore', + 'enabledApps', + 'alertStore', + 'globalThemeInfo', ]; function handleReduxMigrationFailure(oldState: AppState): 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 = 92; +const storeVersion = 93; 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 @@ -44,6 +44,8 @@ convertReportsToReplaceReportOps, reportStoreOpsHandlers, } from 'lib/ops/report-store-ops.js'; +import type { ClientDBSyncedMetadataStoreOperation } from 'lib/ops/synced-metadata-store-ops'; +import { createReplaceSyncedMetadataOperation } from 'lib/ops/synced-metadata-store-ops.js'; import { type ClientDBThreadActivityStoreOperation, threadActivityStoreOpsHandlers, @@ -106,6 +108,7 @@ ClientReportCreationRequest, } from 'lib/types/report-types.js'; import { defaultConnectionInfo } from 'lib/types/socket-types.js'; +import { syncedMetadataNames } from 'lib/types/synced-metadata-types.js'; import { defaultGlobalThemeInfo } from 'lib/types/theme-types.js'; import { userSurfacedPermissions, @@ -1637,6 +1640,32 @@ ops, }; }: MigrationFunction), + [93]: (async (state: AppState) => { + const { enabledApps, globalThemeInfo, alertStore } = state; + + const syncedMetadataStoreOperations: $ReadOnlyArray = + [ + createReplaceSyncedMetadataOperation( + syncedMetadataNames.ENABLED_APPS, + JSON.stringify(enabledApps), + ), + createReplaceSyncedMetadataOperation( + syncedMetadataNames.GLOBAL_THEME_INFO, + JSON.stringify(globalThemeInfo), + ), + createReplaceSyncedMetadataOperation( + syncedMetadataNames.ALERT_STORE, + JSON.stringify(alertStore), + ), + ]; + + return { + state, + ops: { + syncedMetadataStoreOperations, + }, + }; + }: MigrationFunction), }); const persistConfig = { diff --git a/web/redux/handle-redux-migration-failure.js b/web/redux/handle-redux-migration-failure.js --- a/web/redux/handle-redux-migration-failure.js +++ b/web/redux/handle-redux-migration-failure.js @@ -7,10 +7,7 @@ import { nonUserSpecificFieldsWeb, type AppState } from './redux-setup.js'; const persistWhitelist = [ - 'enabledApps', - 'alertStore', 'commServicesAccessToken', - 'globalThemeInfo', 'customServer', 'messageStore', 'tunnelbrokerDeviceToken', 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 = 92; +const storeVersion = 93; 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 @@ -18,6 +18,8 @@ messageStoreOpsHandlers, type ReplaceMessageStoreLocalMessageInfoOperation, } from 'lib/ops/message-store-ops.js'; +import type { ClientDBSyncedMetadataStoreOperation } from 'lib/ops/synced-metadata-store-ops.js'; +import { createReplaceSyncedMetadataOperation } from 'lib/ops/synced-metadata-store-ops.js'; import type { ClientDBThreadStoreOperation, ThreadStoreOperation, @@ -39,6 +41,7 @@ import { cookieTypes } from 'lib/types/session-types.js'; import { defaultConnectionInfo } from 'lib/types/socket-types.js'; import type { StoreOperations } from 'lib/types/store-ops-types.js'; +import { syncedMetadataNames } from 'lib/types/synced-metadata-types.js'; import { defaultGlobalThemeInfo } from 'lib/types/theme-types.js'; import type { ThreadRolePermissionsBlob } from 'lib/types/thread-permission-types.js'; import { userSurfacedPermissions } from 'lib/types/thread-permission-types.js'; @@ -851,6 +854,32 @@ ops, }; }: MigrationFunction), + [93]: (async (state: AppState) => { + const { enabledApps, globalThemeInfo, alertStore } = state; + + const syncedMetadataStoreOperations: $ReadOnlyArray = + [ + createReplaceSyncedMetadataOperation( + syncedMetadataNames.ENABLED_APPS, + JSON.stringify(enabledApps), + ), + createReplaceSyncedMetadataOperation( + syncedMetadataNames.GLOBAL_THEME_INFO, + JSON.stringify(globalThemeInfo), + ), + createReplaceSyncedMetadataOperation( + syncedMetadataNames.ALERT_STORE, + JSON.stringify(alertStore), + ), + ]; + + return { + state, + ops: { + syncedMetadataStoreOperations, + }, + }; + }: MigrationFunction), }; const persistConfig: PersistConfig = {