Page MenuHomePhabricator

D11097.id37381.diff
No OneTemporary

D11097.id37381.diff

diff --git a/native/redux/client-db-utils.js b/native/redux/client-db-utils.js
--- a/native/redux/client-db-utils.js
+++ b/native/redux/client-db-utils.js
@@ -26,6 +26,32 @@
convertRawThreadInfoToClientDBThreadInfo,
} from 'lib/utils/thread-ops-utils.js';
+import type { AppState } from './state-types.js';
+import { commCoreModule } from '../native-modules.js';
+
+function updateClientDBThreadStoreThreadInfos(
+ state: AppState,
+ migrationFunc: RawThreadInfos => RawThreadInfos,
+ handleMigrationFailure?: AppState => AppState,
+): AppState {
+ const clientDBThreadInfos = commCoreModule.getAllThreadsSync();
+ const operations = createUpdateDBOpsForThreadStoreThreadInfos(
+ clientDBThreadInfos,
+ migrationFunc,
+ );
+
+ try {
+ commCoreModule.processThreadStoreOperationsSync(operations);
+ } catch (exception) {
+ console.log(exception);
+ if (handleMigrationFailure) {
+ return handleMigrationFailure(state);
+ }
+ return ({ ...state, cookie: null }: any);
+ }
+ return state;
+}
+
function createUpdateDBOpsForThreadStoreThreadInfos(
clientDBThreadInfos: $ReadOnlyArray<ClientDBThreadInfo>,
migrationFunc: RawThreadInfos => RawThreadInfos,
@@ -113,6 +139,7 @@
}
export {
+ updateClientDBThreadStoreThreadInfos,
createUpdateDBOpsForThreadStoreThreadInfos,
createUpdateDBOpsForMessageStoreMessages,
createUpdateDBOpsForMessageStoreThreads,

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 2:15 PM (20 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2585040
Default Alt Text
D11097.id37381.diff (1 KB)

Event Timeline