Skip to content

Commit

Permalink
Revert "Temporary changes for staff release"
Browse files Browse the repository at this point in the history
This reverts commit a04a84f.
  • Loading branch information
atulsmadhugiri committed Jun 29, 2022
1 parent 7cac0c4 commit 63233aa
Showing 1 changed file with 8 additions and 26 deletions.
34 changes: 8 additions & 26 deletions native/redux/redux-setup.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow

import { isEqual } from 'lodash/lang';
import { AppState as NativeAppState, Platform, Alert } from 'react-native';
import ExitApp from 'react-native-exit-app';
import Orientation from 'react-native-orientation-locker';
Expand Down Expand Up @@ -33,10 +32,7 @@ import type { ThreadStoreOperation } from 'lib/types/thread-types';
import { updateTypes } from 'lib/types/update-types';
import { reduxLoggerMiddleware } from 'lib/utils/action-logger';
import { setNewSessionActionType } from 'lib/utils/action-utils';
import {
convertMessageStoreOperationsToClientDBOperations,
translateClientDBMessageInfosToRawMessageInfos,
} from 'lib/utils/message-ops-utils';
import { convertMessageStoreOperationsToClientDBOperations } from 'lib/utils/message-ops-utils';
import { convertThreadStoreOperationsToClientDBOperations } from 'lib/utils/thread-ops-utils';

import { defaultNavInfo } from '../navigation/default-state';
Expand Down Expand Up @@ -317,27 +313,6 @@ function reducer(state: AppState = defaultState, action: Action) {
const convertedMessageStoreOperations = convertMessageStoreOperationsToClientDBOperations(
messageStoreOperations,
);

if (convertedMessageStoreOperations.length > 0) {
global.CommCoreModule.processMessageStoreOperationsSync(
convertedMessageStoreOperations,
);
}

const messages = global.CommCoreModule.getAllMessagesSync();
const rawMsgsFromSQLite = translateClientDBMessageInfosToRawMessageInfos(
messages,
);

const ignoreList = ['@@INIT', 'persist/REHYDRATE', 'persist/PERSIST'];
if (
!isEqual(rawMsgsFromSQLite, state.messageStore.messages) &&
!ignoreList.includes(action.type) &&
!action.type.includes('@@redux/INIT')
) {
Alert.alert(`${action.type}: NOT EQUAL`);
}

(async () => {
try {
const promises = [];
Expand All @@ -348,6 +323,13 @@ function reducer(state: AppState = defaultState, action: Action) {
),
);
}
if (convertedMessageStoreOperations.length > 0) {
promises.push(
global.CommCoreModule.processMessageStoreOperations(
convertedMessageStoreOperations,
),
);
}
await Promise.all(promises);
} catch {
dispatch({
Expand Down

0 comments on commit 63233aa

Please sign in to comment.