Changeset View
Changeset View
Standalone View
Standalone View
native/redux/persist.js
Show All 35 Lines | import { | ||||
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 { | import { | ||||
convertClientDBThreadInfoToRawThreadInfo, | convertClientDBThreadInfoToRawThreadInfo, | ||||
convertRawThreadInfoToClientDBThreadInfo, | convertRawThreadInfoToClientDBThreadInfo, | ||||
convertThreadStoreOperationsToClientDBOperations, | convertThreadStoreOperationsToClientDBOperations, | ||||
} from 'lib/utils/thread-ops-utils.js'; | } from 'lib/utils/thread-ops-utils.js'; | ||||
import { getUUID } from 'lib/utils/uuid.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'; | ||||
import { persistMigrationForManagePinsThreadPermission } from './manage-pins-permission-migration.js'; | import { persistMigrationForManagePinsThreadPermission } from './manage-pins-permission-migration.js'; | ||||
import type { AppState } from './state-types.js'; | import type { AppState } from './state-types.js'; | ||||
import { unshimClientDB } from './unshim-utils.js'; | import { unshimClientDB } from './unshim-utils.js'; | ||||
import { updateRolesAndPermissions } from './update-roles-and-permissions.js'; | import { updateRolesAndPermissions } from './update-roles-and-permissions.js'; | ||||
import { commCoreModule } from '../native-modules.js'; | import { commCoreModule } from '../native-modules.js'; | ||||
▲ Show 20 Lines • Show All 478 Lines • ▼ Show 20 Lines | [37]: state => { | ||||
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 => | [40]: state => | ||||
updateClientDBThreadStoreThreadInfos(state, updateRolesAndPermissions), | updateClientDBThreadStoreThreadInfos(state, updateRolesAndPermissions), | ||||
[41]: (state: AppState) => { | |||||
const queuedReports = state.reportStore.queuedReports.map(report => ({ | |||||
...report, | |||||
id: getUUID(), | |||||
})); | |||||
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: 40, | version: 41, | ||||
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 |