Sign in page for mobiles
Fetch QR code more frequently
This commit is contained in:
parent
181ff60329
commit
11589edeff
@ -19,6 +19,7 @@ import App from '../../config/app';
|
|||||||
import DEBUG, { MOUNT_CLASS_TO } from '../../config/debug';
|
import DEBUG, { MOUNT_CLASS_TO } from '../../config/debug';
|
||||||
import AppStorage from '../storage';
|
import AppStorage from '../storage';
|
||||||
import { Chat } from '../../layer';
|
import { Chat } from '../../layer';
|
||||||
|
import { isMobile } from '../../helpers/userAgent';
|
||||||
|
|
||||||
const REFRESH_EVERY = 24 * 60 * 60 * 1000; // 1 day
|
const REFRESH_EVERY = 24 * 60 * 60 * 1000; // 1 day
|
||||||
const STATE_VERSION = App.version;
|
const STATE_VERSION = App.version;
|
||||||
@ -96,7 +97,7 @@ export const STATE_INIT: State = {
|
|||||||
recentSearch: [],
|
recentSearch: [],
|
||||||
version: STATE_VERSION,
|
version: STATE_VERSION,
|
||||||
authState: {
|
authState: {
|
||||||
_: 'authStateSignQr'
|
_: isMobile ? 'authStateSignIn' : 'authStateSignQr'
|
||||||
},
|
},
|
||||||
hiddenPinnedMessages: {},
|
hiddenPinnedMessages: {},
|
||||||
settings: {
|
settings: {
|
||||||
|
@ -18,6 +18,8 @@ import rootScope from '../lib/rootScope';
|
|||||||
import { putPreloader } from '../components/misc';
|
import { putPreloader } from '../components/misc';
|
||||||
import getLanguageChangeButton from '../components/languageChangeButton';
|
import getLanguageChangeButton from '../components/languageChangeButton';
|
||||||
|
|
||||||
|
const FETCH_INTERVAL = 3;
|
||||||
|
|
||||||
let onFirstMount = async() => {
|
let onFirstMount = async() => {
|
||||||
const pageElement = page.pageEl;
|
const pageElement = page.pageEl;
|
||||||
const imageDiv = pageElement.querySelector('.auth-image') as HTMLDivElement;
|
const imageDiv = pageElement.querySelector('.auth-image') as HTMLDivElement;
|
||||||
@ -194,7 +196,7 @@ let onFirstMount = async() => {
|
|||||||
let timestamp = Date.now() / 1000;
|
let timestamp = Date.now() / 1000;
|
||||||
let diff = loginToken.expires - timestamp - serverTimeManager.serverTimeOffset;
|
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) {
|
} catch(err) {
|
||||||
switch(err.type) {
|
switch(err.type) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user