Lock Screen: Fix hanging log out (#3672)
This commit is contained in:
parent
a141f9c8ac
commit
68ef919c66
@ -37,6 +37,7 @@ import {
|
|||||||
reset as resetUpdatesManager,
|
reset as resetUpdatesManager,
|
||||||
scheduleGetChannelDifference,
|
scheduleGetChannelDifference,
|
||||||
} from '../updateManager';
|
} from '../updateManager';
|
||||||
|
import { pause } from '../../../util/schedulers';
|
||||||
|
|
||||||
const DEFAULT_USER_AGENT = 'Unknown UserAgent';
|
const DEFAULT_USER_AGENT = 'Unknown UserAgent';
|
||||||
const DEFAULT_PLATFORM = 'Unknown platform';
|
const DEFAULT_PLATFORM = 'Unknown platform';
|
||||||
@ -163,9 +164,13 @@ export function setIsPremium({ isPremium }: { isPremium: boolean }) {
|
|||||||
client.setIsPremium(isPremium);
|
client.setIsPremium(isPremium);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const LOG_OUT_TIMEOUT = 2500;
|
||||||
export async function destroy(noLogOut = false, noClearLocalDb = false) {
|
export async function destroy(noLogOut = false, noClearLocalDb = false) {
|
||||||
if (!noLogOut) {
|
if (!noLogOut && client.isConnected()) {
|
||||||
await invokeRequest(new GramJs.auth.LogOut());
|
await Promise.race([
|
||||||
|
invokeRequest(new GramJs.auth.LogOut()),
|
||||||
|
pause(LOG_OUT_TIMEOUT),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noClearLocalDb) {
|
if (!noClearLocalDb) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user