Follow-up

This commit is contained in:
Alexander Zinchuk 2021-06-11 01:59:13 +03:00
parent 68c9674be7
commit b79e495841
2 changed files with 9 additions and 3 deletions

View File

@ -12,7 +12,7 @@ class StorageSession extends MemorySession {
this._authKeys = {};
if (sessionInfo && sessionInfo.startsWith(SESSION_DATA_PREFIX)) {
void this._initFromSessionData(sessionInfo);
this._sessionData = sessionInfo;
} else if (sessionInfo) {
this._storageKey = sessionInfo;
}
@ -27,6 +27,11 @@ class StorageSession extends MemorySession {
}
async load() {
if (this._sessionData) {
await this._loadFromSessionData();
return;
}
if (!this._storageKey) {
return;
}
@ -94,8 +99,8 @@ class StorageSession extends MemorySession {
void this._updateStorage();
}
async _initFromSessionData(sessionData) {
const [, mainDcIdStr, mainDcKey] = sessionData.split(':');
async _loadFromSessionData() {
const [, mainDcIdStr, mainDcKey] = this._sessionData.split(':');
const mainDcId = Number(mainDcIdStr);
const {
ipAddress,

View File

@ -122,6 +122,7 @@ addReducer('signOut', () => {
addReducer('reset', () => {
localStorage.removeItem(GRAMJS_SESSION_ID_KEY);
localStorage.removeItem(LEGACY_SESSION_KEY);
updateAppBadge(0);
cacheApi.clear(MEDIA_CACHE_NAME);