diff --git a/native/redux/persist.js b/native/redux/persist.js --- a/native/redux/persist.js +++ b/native/redux/persist.js @@ -16,6 +16,11 @@ convertConnectionInfoToNewIDSchema, } from 'lib/_generated/migration-utils.js'; import { extractKeyserverIDFromID } from 'lib/keyserver-conn/keyserver-call-utils.js'; +import { + type ClientDBIntegrityStoreOperation, + integrityStoreOpsHandlers, + type ReplaceIntegrityThreadHashesOperation, +} from 'lib/ops/integrity-store-ops.js'; import { type ClientDBKeyserverStoreOperation, keyserverStoreOpsHandlers, @@ -1125,6 +1130,30 @@ } return newState; }, + [64]: async (state: AppState) => { + const replaceOp: ReplaceIntegrityThreadHashesOperation = { + type: 'replace_integrity_thread_hashes', + payload: { + threadHashes: state.integrityStore.threadHashes, + }, + }; + + const dbOperations: $ReadOnlyArray = + integrityStoreOpsHandlers.convertOpsToClientDBOps([ + { type: 'remove_all_integrity_thread_hashes' }, + replaceOp, + ]); + + try { + await commCoreModule.processIntegrityStoreOperations(dbOperations); + } catch (exception) { + if (isTaskCancelledError(exception)) { + return state; + } + return handleReduxMigrationFailure(state); + } + return state; + }, }; // After migration 31, we'll no longer want to persist `messageStore.messages` @@ -1192,7 +1221,7 @@ storage: AsyncStorage, blacklist: persistBlacklist, debug: __DEV__, - version: 63, + version: 64, transforms: [ messageStoreMessagesBlocklistTransform, reportStoreTransform,