Changeset View
Changeset View
Standalone View
Standalone View
native/redux/persist.js
Show All 30 Lines | import type { | ||||
ClientDBThreadInfo, | ClientDBThreadInfo, | ||||
} from 'lib/types/thread-types.js'; | } from 'lib/types/thread-types.js'; | ||||
import { | import { | ||||
convertMessageStoreOperationsToClientDBOperations, | convertMessageStoreOperationsToClientDBOperations, | ||||
translateClientDBMessageInfoToRawMessageInfo, | translateClientDBMessageInfoToRawMessageInfo, | ||||
translateRawMessageInfoToClientDBMessageInfo, | translateRawMessageInfoToClientDBMessageInfo, | ||||
} from 'lib/utils/message-ops-utils.js'; | } from 'lib/utils/message-ops-utils.js'; | ||||
import { defaultNotifPermissionAlertInfo } from 'lib/utils/push-alerts.js'; | import { defaultNotifPermissionAlertInfo } from 'lib/utils/push-alerts.js'; | ||||
import { assignReportsID } from 'lib/utils/report-utils.js'; | |||||
import { | import { | ||||
convertClientDBThreadInfoToRawThreadInfo, | convertClientDBThreadInfoToRawThreadInfo, | ||||
convertRawThreadInfoToClientDBThreadInfo, | convertRawThreadInfoToClientDBThreadInfo, | ||||
convertThreadStoreOperationsToClientDBOperations, | convertThreadStoreOperationsToClientDBOperations, | ||||
} from 'lib/utils/thread-ops-utils.js'; | } from 'lib/utils/thread-ops-utils.js'; | ||||
import { updateClientDBThreadStoreThreadInfos } from './client-db-utils.js'; | import { updateClientDBThreadStoreThreadInfos } from './client-db-utils.js'; | ||||
import { migrateThreadStoreForEditThreadPermissions } from './edit-thread-permission-migration.js'; | import { migrateThreadStoreForEditThreadPermissions } from './edit-thread-permission-migration.js'; | ||||
▲ Show 20 Lines • Show All 481 Lines • ▼ Show 20 Lines | try { | ||||
return { ...state, cookie: null }; | return { ...state, cookie: null }; | ||||
} | } | ||||
return state; | return state; | ||||
}, | }, | ||||
[38]: state => | [38]: state => | ||||
updateClientDBThreadStoreThreadInfos(state, updateRolesAndPermissions), | updateClientDBThreadStoreThreadInfos(state, updateRolesAndPermissions), | ||||
[39]: (state: AppState) => unshimClientDB(state, [messageTypes.EDIT_MESSAGE]), | [39]: (state: AppState) => unshimClientDB(state, [messageTypes.EDIT_MESSAGE]), | ||||
[40]: (state: AppState) => { | |||||
const queuedReports = assignReportsID(state.reportStore.queuedReports); | |||||
return { | |||||
...state, | |||||
reportStore: { ...state.reportStore, queuedReports }, | |||||
}; | |||||
}, | |||||
}; | }; | ||||
// After migration 31, we'll no longer want to persist `messageStore.messages` | // After migration 31, we'll no longer want to persist `messageStore.messages` | ||||
// via redux-persist. However, we DO want to continue persisting everything in | // via redux-persist. However, we DO want to continue persisting everything in | ||||
// `messageStore` EXCEPT for `messages`. The `blacklist` property in | // `messageStore` EXCEPT for `messages`. The `blacklist` property in | ||||
// `persistConfig` allows us to specify top-level keys that shouldn't be | // `persistConfig` allows us to specify top-level keys that shouldn't be | ||||
// persisted. However, we aren't able to specify nested keys in `blacklist`. | // persisted. However, we aren't able to specify nested keys in `blacklist`. | ||||
// As a result, if we want to prevent nested keys from being persisted we'll | // As a result, if we want to prevent nested keys from being persisted we'll | ||||
▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | blacklist: [ | ||||
'draftStore', | 'draftStore', | ||||
'connectivity', | 'connectivity', | ||||
'deviceOrientation', | 'deviceOrientation', | ||||
'frozen', | 'frozen', | ||||
'threadStore', | 'threadStore', | ||||
'storeLoaded', | 'storeLoaded', | ||||
], | ], | ||||
debug: __DEV__, | debug: __DEV__, | ||||
version: 39, | version: 40, | ||||
transforms: [messageStoreMessagesBlocklistTransform], | transforms: [messageStoreMessagesBlocklistTransform], | ||||
migrate: (createMigrate(migrations, { debug: __DEV__ }): any), | migrate: (createMigrate(migrations, { debug: __DEV__ }): any), | ||||
timeout: ((__DEV__ ? 0 : undefined): number | void), | timeout: ((__DEV__ ? 0 : undefined): number | void), | ||||
}; | }; | ||||
const codeVersion: number = commCoreModule.getCodeVersion(); | const codeVersion: number = commCoreModule.getCodeVersion(); | ||||
// This local exists to avoid a circular dependency where redux-setup needs to | // This local exists to avoid a circular dependency where redux-setup needs to | ||||
Show All 12 Lines |