Fix support of old state
This commit is contained in:
parent
b66d85ed37
commit
d5ceab476a
@ -276,21 +276,22 @@ export class AppStateManager extends EventListenerBase<{
|
||||
|
||||
//state = this.state = new Proxy(state, getHandler());
|
||||
|
||||
// * support old version
|
||||
if(!state.settings.hasOwnProperty('themes') && state.settings.background) {
|
||||
const theme = STATE_INIT.settings.themes.find(t => t.name === STATE_INIT.settings.theme);
|
||||
if(theme) {
|
||||
state.settings.themes.find(t => t.name === theme.name).background = copy(state.settings.background);
|
||||
this.pushToState('settings', state.settings);
|
||||
}
|
||||
}
|
||||
|
||||
// * support old version
|
||||
if(!state.settings.hasOwnProperty('theme') && state.settings.hasOwnProperty('nightTheme')) {
|
||||
state.settings.theme = state.settings.nightTheme ? 'night' : 'day';
|
||||
this.pushToState('settings', state.settings);
|
||||
}
|
||||
|
||||
// * support old version
|
||||
if(!state.settings.hasOwnProperty('themes') && state.settings.background) {
|
||||
state.settings.themes = copy(STATE_INIT.settings.themes);
|
||||
const theme = state.settings.themes.find(t => t.name === state.settings.theme);
|
||||
if(theme) {
|
||||
theme.background = state.settings.background;
|
||||
this.pushToState('settings', state.settings);
|
||||
}
|
||||
}
|
||||
|
||||
validateInitObject(STATE_INIT, state, (missingKey) => {
|
||||
// @ts-ignore
|
||||
this.pushToState(missingKey, state[missingKey]);
|
||||
|
@ -6,9 +6,6 @@
|
||||
|
||||
import apiManager from '../lib/mtproto/mtprotoworker';
|
||||
import Page from './page';
|
||||
import pageIm from './pageIm';
|
||||
import pagePassword from './pagePassword';
|
||||
import pageSignIn from './pageSignIn';
|
||||
import serverTimeManager from '../lib/mtproto/serverTimeManager';
|
||||
import { AuthAuthorization, AuthLoginToken } from '../layer';
|
||||
import { bytesCmp, bytesToBase64 } from '../helpers/bytes';
|
||||
@ -48,7 +45,7 @@ let onFirstMount = async() => {
|
||||
container.append(h4, helpList, inputWrapper);
|
||||
|
||||
btnBack.addEventListener('click', () => {
|
||||
pageSignIn.mount();
|
||||
import('./pageSignIn').then(m => m.default.mount());
|
||||
stop = true;
|
||||
});
|
||||
|
||||
@ -89,7 +86,7 @@ let onFirstMount = async() => {
|
||||
if(loginToken._ === 'auth.loginTokenSuccess') {
|
||||
const authorization = loginToken.authorization as any as AuthAuthorization.authAuthorization;
|
||||
apiManager.setUserAuth(authorization.user.id);
|
||||
pageIm.mount();
|
||||
import('./pageIm').then(m => m.default.mount());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -201,7 +198,7 @@ let onFirstMount = async() => {
|
||||
case 'SESSION_PASSWORD_NEEDED':
|
||||
console.warn('pageSignQR: SESSION_PASSWORD_NEEDED');
|
||||
err.handled = true;
|
||||
pagePassword.mount();
|
||||
import('./pagePassword').then(m => m.default.mount());
|
||||
stop = true;
|
||||
cachedPromise = null;
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user