Browse Source

Update version

master
Eduard Kuzmenko 4 years ago
parent
commit
994a29263d
  1. 2
      src/config/app.ts
  2. 19
      src/index.ts

2
src/config/app.ts

@ -12,7 +12,7 @@
const App = { const App = {
id: 1025907, id: 1025907,
hash: '452b0359b988148995f22ff0f4229750', hash: '452b0359b988148995f22ff0f4229750',
version: '0.4.3', version: '0.5.0',
langPackVersion: '0.1.6', langPackVersion: '0.1.6',
langPack: 'macos', langPack: 'macos',
langPackCode: 'en', langPackCode: 'en',

19
src/index.ts

@ -268,6 +268,9 @@ console.timeEnd('get storage1'); */
I18n.default.getLangPack(langPack.lang_code); I18n.default.getLangPack(langPack.lang_code);
} }
/**
* won't fire if font is loaded too fast
*/
function fadeInWhenFontsReady(elem: HTMLElement, promise: Promise<void>) { function fadeInWhenFontsReady(elem: HTMLElement, promise: Promise<void>) {
elem.style.opacity = '0'; elem.style.opacity = '0';
@ -302,27 +305,33 @@ console.timeEnd('get storage1'); */
scrollable.append(placeholder.cloneNode()); scrollable.append(placeholder.cloneNode());
} }
let pagePromise: Promise<void>;
//langPromise.then(async() => { //langPromise.then(async() => {
switch(authState._) { switch(authState._) {
case 'authStateSignIn': case 'authStateSignIn':
(await import('./pages/pageSignIn')).default.mount(); pagePromise = (await import('./pages/pageSignIn')).default.mount();
break; break;
case 'authStateSignQr': case 'authStateSignQr':
(await import('./pages/pageSignQR')).default.mount(); pagePromise = (await import('./pages/pageSignQR')).default.mount();
break; break;
case 'authStateAuthCode': case 'authStateAuthCode':
(await import('./pages/pageAuthCode')).default.mount(authState.sentCode); pagePromise = (await import('./pages/pageAuthCode')).default.mount(authState.sentCode);
break; break;
case 'authStatePassword': case 'authStatePassword':
(await import('./pages/pagePassword')).default.mount(); pagePromise = (await import('./pages/pagePassword')).default.mount();
break; break;
case 'authStateSignUp': case 'authStateSignUp':
(await import('./pages/pageSignUp')).default.mount(authState.authCode); pagePromise = (await import('./pages/pageSignUp')).default.mount(authState.authCode);
break; break;
} }
//}); //});
if(scrollable) { if(scrollable) {
// wait for text appear
if(pagePromise) {
await pagePromise;
}
// @ts-ignore // @ts-ignore
const promise = 'fonts' in document ? document.fonts.ready : Promise.resolve(); const promise = 'fonts' in document ? document.fonts.ready : Promise.resolve();
fadeInWhenFontsReady(scrollable, promise); fadeInWhenFontsReady(scrollable, promise);

Loading…
Cancel
Save