Page MenuHomePhabricator

D11922.id39991.diff
No OneTemporary

D11922.id39991.diff

diff --git a/native/redux/persist.js b/native/redux/persist.js
--- a/native/redux/persist.js
+++ b/native/redux/persist.js
@@ -690,14 +690,14 @@
const draftOperations = generateIDSchemaMigrationOpsForDrafts(drafts);
try {
- await Promise.all([
- commCoreModule.processMessageStoreOperations([
+ await commCoreModule.processDBStoreOperations({
+ messageStoreOperations: [
...messageStoreMessagesOperations,
...messageStoreThreadsOperations,
- ]),
- commCoreModule.processThreadStoreOperations(threadOperations),
- commCoreModule.processDraftStoreOperations(draftOperations),
- ]);
+ ],
+ threadStoreOperations: threadOperations,
+ draftStoreOperations: draftOperations,
+ });
} catch (exception) {
console.log(exception);
return { ...state, cookie: null };
@@ -963,7 +963,9 @@
userStoreOpsHandlers.convertOpsToClientDBOps(userStoreOperations);
try {
- await commCoreModule.processUserStoreOperations(dbOperations);
+ await commCoreModule.processDBStoreOperations({
+ userStoreOperations: dbOperations,
+ });
} catch (exception) {
if (isTaskCancelledError(exception)) {
return state;
@@ -1065,7 +1067,9 @@
]);
try {
- await commCoreModule.processKeyserverStoreOperations(dbOperations);
+ await commCoreModule.processDBStoreOperations({
+ keyserverStoreOperations: dbOperations,
+ });
} catch (exception) {
if (isTaskCancelledError(exception)) {
return state;
@@ -1105,7 +1109,9 @@
),
};
try {
- await commCoreModule.processKeyserverStoreOperations(dbOperations);
+ await commCoreModule.processDBStoreOperations({
+ keyserverStoreOperations: dbOperations,
+ });
} catch (exception) {
if (isTaskCancelledError(exception)) {
return newState;
@@ -1133,7 +1139,9 @@
]);
try {
- await commCoreModule.processIntegrityStoreOperations(dbOperations);
+ await commCoreModule.processDBStoreOperations({
+ integrityStoreOperations: dbOperations,
+ });
} catch (exception) {
if (isTaskCancelledError(exception)) {
return state;
@@ -1169,9 +1177,9 @@
]);
try {
- await commCoreModule.processKeyserverStoreOperations(
+ await commCoreModule.processDBStoreOperations({
keyserverStoreOperations,
- );
+ });
} catch (exception) {
if (isTaskCancelledError(exception)) {
return state;
@@ -1246,7 +1254,9 @@
]);
try {
- await commCoreModule.processThreadActivityStoreOperations(dbOperations);
+ await commCoreModule.processDBStoreOperations({
+ threadActivityStoreOperations: dbOperations,
+ });
} catch (exception) {
if (isTaskCancelledError(exception)) {
return state;
diff --git a/native/redux/redux-utils.js b/native/redux/redux-utils.js
--- a/native/redux/redux-utils.js
+++ b/native/redux/redux-utils.js
@@ -16,6 +16,7 @@
import { threadStoreOpsHandlers } from 'lib/ops/thread-store-ops.js';
import { userStoreOpsHandlers } from 'lib/ops/user-store-ops.js';
import type { StoreOperations } from 'lib/types/store-ops-types.js';
+import { values } from 'lib/utils/objects.js';
import type { AppState } from './state-types.js';
import { commCoreModule } from '../native-modules.js';
@@ -74,51 +75,6 @@
try {
const promises = [];
- if (convertedThreadStoreOperations.length > 0) {
- promises.push(
- commCoreModule.processThreadStoreOperations(
- convertedThreadStoreOperations,
- ),
- );
- }
- if (convertedMessageStoreOperations.length > 0) {
- promises.push(
- commCoreModule.processMessageStoreOperations(
- convertedMessageStoreOperations,
- ),
- );
- }
- if (draftStoreOperations.length > 0) {
- promises.push(
- commCoreModule.processDraftStoreOperations(draftStoreOperations),
- );
- }
- if (convertedReportStoreOperations.length > 0) {
- promises.push(
- commCoreModule.processReportStoreOperations(
- convertedReportStoreOperations,
- ),
- );
- }
- if (convertedUserStoreOperations.length > 0) {
- promises.push(
- commCoreModule.processUserStoreOperations(convertedUserStoreOperations),
- );
- }
- if (convertedKeyserverStoreOperations.length > 0) {
- promises.push(
- commCoreModule.processKeyserverStoreOperations(
- convertedKeyserverStoreOperations,
- ),
- );
- }
- if (convertedCommunityStoreOperations.length > 0) {
- promises.push(
- commCoreModule.processCommunityStoreOperations(
- convertedCommunityStoreOperations,
- ),
- );
- }
if (keyserversToRemoveFromNotifsStore.length > 0) {
promises.push(
commCoreModule.removeKeyserverDataFromNotifStorage(
@@ -126,33 +82,22 @@
),
);
}
- if (convertedIntegrityStoreOperations.length > 0) {
- promises.push(
- commCoreModule.processIntegrityStoreOperations(
- convertedIntegrityStoreOperations,
- ),
- );
- }
- if (convertedSyncedMetadataStoreOperations.length > 0) {
- promises.push(
- commCoreModule.processSyncedMetadataStoreOperations(
- convertedSyncedMetadataStoreOperations,
- ),
- );
- }
- if (convertedAuxUserStoreOperations.length > 0) {
- promises.push(
- commCoreModule.processAuxUserStoreOperations(
- convertedAuxUserStoreOperations,
- ),
- );
- }
- if (convertedThreadActivityStoreOperations.length > 0) {
- promises.push(
- commCoreModule.processThreadActivityStoreOperations(
- convertedThreadActivityStoreOperations,
- ),
- );
+
+ const dbOps = {
+ draftStoreOperations,
+ threadStoreOperations: convertedThreadStoreOperations,
+ messageStoreOperations: convertedMessageStoreOperations,
+ reportStoreOperations: convertedReportStoreOperations,
+ userStoreOperations: convertedUserStoreOperations,
+ keyserverStoreOperations: convertedKeyserverStoreOperations,
+ communityStoreOperations: convertedCommunityStoreOperations,
+ integrityStoreOperations: convertedIntegrityStoreOperations,
+ syncedMetadataStoreOperations: convertedSyncedMetadataStoreOperations,
+ auxUserStoreOperations: convertedAuxUserStoreOperations,
+ threadActivityStoreOperations: convertedThreadActivityStoreOperations,
+ };
+ if (values(dbOps).some(ops => ops.length > 0)) {
+ promises.push(commCoreModule.processDBStoreOperations(dbOps));
}
await Promise.all(promises);
} catch (e) {

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 6:27 PM (21 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2540100
Default Alt Text
D11922.id39991.diff (6 KB)

Event Timeline