Follow-up
This commit is contained in:
parent
68c9674be7
commit
b79e495841
@ -12,7 +12,7 @@ class StorageSession extends MemorySession {
|
|||||||
this._authKeys = {};
|
this._authKeys = {};
|
||||||
|
|
||||||
if (sessionInfo && sessionInfo.startsWith(SESSION_DATA_PREFIX)) {
|
if (sessionInfo && sessionInfo.startsWith(SESSION_DATA_PREFIX)) {
|
||||||
void this._initFromSessionData(sessionInfo);
|
this._sessionData = sessionInfo;
|
||||||
} else if (sessionInfo) {
|
} else if (sessionInfo) {
|
||||||
this._storageKey = sessionInfo;
|
this._storageKey = sessionInfo;
|
||||||
}
|
}
|
||||||
@ -27,6 +27,11 @@ class StorageSession extends MemorySession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
|
if (this._sessionData) {
|
||||||
|
await this._loadFromSessionData();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!this._storageKey) {
|
if (!this._storageKey) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -94,8 +99,8 @@ class StorageSession extends MemorySession {
|
|||||||
void this._updateStorage();
|
void this._updateStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
async _initFromSessionData(sessionData) {
|
async _loadFromSessionData() {
|
||||||
const [, mainDcIdStr, mainDcKey] = sessionData.split(':');
|
const [, mainDcIdStr, mainDcKey] = this._sessionData.split(':');
|
||||||
const mainDcId = Number(mainDcIdStr);
|
const mainDcId = Number(mainDcIdStr);
|
||||||
const {
|
const {
|
||||||
ipAddress,
|
ipAddress,
|
||||||
|
|||||||
@ -122,6 +122,7 @@ addReducer('signOut', () => {
|
|||||||
|
|
||||||
addReducer('reset', () => {
|
addReducer('reset', () => {
|
||||||
localStorage.removeItem(GRAMJS_SESSION_ID_KEY);
|
localStorage.removeItem(GRAMJS_SESSION_ID_KEY);
|
||||||
|
localStorage.removeItem(LEGACY_SESSION_KEY);
|
||||||
updateAppBadge(0);
|
updateAppBadge(0);
|
||||||
|
|
||||||
cacheApi.clear(MEDIA_CACHE_NAME);
|
cacheApi.clear(MEDIA_CACHE_NAME);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user