Browse Source

Sign in page for mobiles

Fetch QR code more frequently
master
morethanwords 4 years ago
parent
commit
11589edeff
  1. 3
      src/lib/appManagers/appStateManager.ts
  2. 4
      src/pages/pageSignQR.ts

3
src/lib/appManagers/appStateManager.ts

@ -19,6 +19,7 @@ import App from '../../config/app'; @@ -19,6 +19,7 @@ import App from '../../config/app';
import DEBUG, { MOUNT_CLASS_TO } from '../../config/debug';
import AppStorage from '../storage';
import { Chat } from '../../layer';
import { isMobile } from '../../helpers/userAgent';
const REFRESH_EVERY = 24 * 60 * 60 * 1000; // 1 day
const STATE_VERSION = App.version;
@ -96,7 +97,7 @@ export const STATE_INIT: State = { @@ -96,7 +97,7 @@ export const STATE_INIT: State = {
recentSearch: [],
version: STATE_VERSION,
authState: {
_: 'authStateSignQr'
_: isMobile ? 'authStateSignIn' : 'authStateSignQr'
},
hiddenPinnedMessages: {},
settings: {

4
src/pages/pageSignQR.ts

@ -18,6 +18,8 @@ import rootScope from '../lib/rootScope'; @@ -18,6 +18,8 @@ import rootScope from '../lib/rootScope';
import { putPreloader } from '../components/misc';
import getLanguageChangeButton from '../components/languageChangeButton';
const FETCH_INTERVAL = 3;
let onFirstMount = async() => {
const pageElement = page.pageEl;
const imageDiv = pageElement.querySelector('.auth-image') as HTMLDivElement;
@ -194,7 +196,7 @@ let onFirstMount = async() => { @@ -194,7 +196,7 @@ let onFirstMount = async() => {
let timestamp = Date.now() / 1000;
let diff = loginToken.expires - timestamp - serverTimeManager.serverTimeOffset;
await pause(diff > 5 ? 5e3 : 1e3 * diff | 0);
await pause(diff > FETCH_INTERVAL ? 1e3 * FETCH_INTERVAL : 1e3 * diff | 0);
}
} catch(err) {
switch(err.type) {

Loading…
Cancel
Save