mirror of
https://github.com/danog/telegram-tt.git
synced 2025-01-22 21:31:22 +01:00
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 { clearStoredSession, loadStoredSession, storeSession } from '../../../util/sessions';
|
||||
import { clearEncryptedSession, encryptSession, setupPasscode } from '../../../util/passcode';
|
||||
import { forceUpdateCache, serializeGlobal } from '../../cache';
|
||||
import { forceUpdateCache, migrateCache, serializeGlobal } from '../../cache';
|
||||
import { onBeforeUnload } from '../../../util/schedulers';
|
||||
import { cloneDeep } from '../../../util/iteratees';
|
||||
import { INITIAL_STATE } from '../../initialState';
|
||||
|
||||
let noLockOnUnload = false;
|
||||
onBeforeUnload(() => {
|
||||
@ -48,6 +50,8 @@ addActionHandler('unlockScreen', (global, actions, { sessionJson, globalJson })
|
||||
storeSession(session, session.userId);
|
||||
|
||||
global = JSON.parse(globalJson);
|
||||
migrateCache(global, cloneDeep(INITIAL_STATE));
|
||||
|
||||
setGlobal(updatePasscodeSettings(
|
||||
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
|
||||
if ('shouldAutoDownloadMediaFromContacts' in cached.settings.byKey) {
|
||||
const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user