diff --git a/src/config/app.ts b/src/config/app.ts index 7a1cde86..4ca77c4b 100644 --- a/src/config/app.ts +++ b/src/config/app.ts @@ -12,7 +12,7 @@ const App = { id: 1025907, hash: '452b0359b988148995f22ff0f4229750', - version: '0.4.3', + version: '0.5.0', langPackVersion: '0.1.6', langPack: 'macos', langPackCode: 'en', diff --git a/src/index.ts b/src/index.ts index 1e9d36d8..332255fa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -268,6 +268,9 @@ console.timeEnd('get storage1'); */ I18n.default.getLangPack(langPack.lang_code); } + /** + * won't fire if font is loaded too fast + */ function fadeInWhenFontsReady(elem: HTMLElement, promise: Promise) { elem.style.opacity = '0'; @@ -302,27 +305,33 @@ console.timeEnd('get storage1'); */ scrollable.append(placeholder.cloneNode()); } + let pagePromise: Promise; //langPromise.then(async() => { switch(authState._) { case 'authStateSignIn': - (await import('./pages/pageSignIn')).default.mount(); + pagePromise = (await import('./pages/pageSignIn')).default.mount(); break; case 'authStateSignQr': - (await import('./pages/pageSignQR')).default.mount(); + pagePromise = (await import('./pages/pageSignQR')).default.mount(); break; case 'authStateAuthCode': - (await import('./pages/pageAuthCode')).default.mount(authState.sentCode); + pagePromise = (await import('./pages/pageAuthCode')).default.mount(authState.sentCode); break; case 'authStatePassword': - (await import('./pages/pagePassword')).default.mount(); + pagePromise = (await import('./pages/pagePassword')).default.mount(); break; case 'authStateSignUp': - (await import('./pages/pageSignUp')).default.mount(authState.authCode); + pagePromise = (await import('./pages/pageSignUp')).default.mount(authState.authCode); break; } //}); if(scrollable) { + // wait for text appear + if(pagePromise) { + await pagePromise; + } + // @ts-ignore const promise = 'fonts' in document ? document.fonts.ready : Promise.resolve(); fadeInWhenFontsReady(scrollable, promise);