Passcode: Fix migrating locked cache
This commit is contained in:
parent
c9c744822f
commit
61c6f5a145
@ -3,8 +3,10 @@ import { addActionHandler, setGlobal, getGlobal } from '../../index';
|
|||||||
import { clearPasscodeSettings, updatePasscodeSettings } from '../../reducers';
|
import { clearPasscodeSettings, updatePasscodeSettings } from '../../reducers';
|
||||||
import { clearStoredSession, loadStoredSession, storeSession } from '../../../util/sessions';
|
import { clearStoredSession, loadStoredSession, storeSession } from '../../../util/sessions';
|
||||||
import { clearEncryptedSession, encryptSession, setupPasscode } from '../../../util/passcode';
|
import { clearEncryptedSession, encryptSession, setupPasscode } from '../../../util/passcode';
|
||||||
import { forceUpdateCache, serializeGlobal } from '../../cache';
|
import { forceUpdateCache, migrateCache, serializeGlobal } from '../../cache';
|
||||||
import { onBeforeUnload } from '../../../util/schedulers';
|
import { onBeforeUnload } from '../../../util/schedulers';
|
||||||
|
import { cloneDeep } from '../../../util/iteratees';
|
||||||
|
import { INITIAL_STATE } from '../../initialState';
|
||||||
|
|
||||||
let noLockOnUnload = false;
|
let noLockOnUnload = false;
|
||||||
onBeforeUnload(() => {
|
onBeforeUnload(() => {
|
||||||
@ -48,6 +50,8 @@ addActionHandler('unlockScreen', (global, actions, { sessionJson, globalJson })
|
|||||||
storeSession(session, session.userId);
|
storeSession(session, session.userId);
|
||||||
|
|
||||||
global = JSON.parse(globalJson);
|
global = JSON.parse(globalJson);
|
||||||
|
migrateCache(global, cloneDeep(INITIAL_STATE));
|
||||||
|
|
||||||
setGlobal(updatePasscodeSettings(
|
setGlobal(updatePasscodeSettings(
|
||||||
global,
|
global,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -137,7 +137,7 @@ function readCache(initialState: GlobalState): GlobalState {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function migrateCache(cached: GlobalState, initialState: GlobalState) {
|
export function migrateCache(cached: GlobalState, initialState: GlobalState) {
|
||||||
// Migrate from legacy setting names
|
// Migrate from legacy setting names
|
||||||
if ('shouldAutoDownloadMediaFromContacts' in cached.settings.byKey) {
|
if ('shouldAutoDownloadMediaFromContacts' in cached.settings.byKey) {
|
||||||
const {
|
const {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user