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