Browse Source

Fix loading emoji pack

master
Eduard Kuzmenko 2 years ago
parent
commit
18095d0406
  1. 8
      src/lib/appManagers/createManagers.ts
  2. 6
      src/lib/mtproto/mtproto.worker.ts

8
src/lib/appManagers/createManagers.ts

@ -102,10 +102,6 @@ export default function createManagers(appStoragesManager: AppStoragesManager, u
ctx[name] = manager; ctx[name] = manager;
} }
if(userId) {
managers.apiManager.setUserAuth(userId);
}
const promises: Array<Promise<(() => void) | void> | void>[] = []; const promises: Array<Promise<(() => void) | void> | void>[] = [];
let names = Object.keys(managers) as (keyof T)[]; let names = Object.keys(managers) as (keyof T)[];
names.unshift('appUsersManager', 'appChatsManager', 'appNotificationsManager', 'appMessagesManager', 'dialogsStorage'); names.unshift('appUsersManager', 'appChatsManager', 'appNotificationsManager', 'appMessagesManager', 'dialogsStorage');
@ -125,5 +121,9 @@ export default function createManagers(appStoragesManager: AppStoragesManager, u
} }
} }
if(userId) {
managers.apiManager.setUserAuth(userId);
}
return Promise.all(promises).then(() => managers); return Promise.all(promises).then(() => managers);
} }

6
src/lib/mtproto/mtproto.worker.ts

@ -27,6 +27,7 @@ export function isServiceWorkerOnline() {
} }
const log = logger('MTPROTO'); const log = logger('MTPROTO');
// let haveState = false;
const port = new MTProtoMessagePort<false>(); const port = new MTProtoMessagePort<false>();
port.addMultipleEventsListeners({ port.addMultipleEventsListeners({
@ -41,6 +42,10 @@ port.addMultipleEventsListeners({
}, },
state: ({state, resetStorages, pushedKeys, newVersion, oldVersion, userId}) => { state: ({state, resetStorages, pushedKeys, newVersion, oldVersion, userId}) => {
// if(haveState) {
// return;
// }
log('got state', state, pushedKeys); log('got state', state, pushedKeys);
appStateManager.userId = userId; appStateManager.userId = userId;
@ -52,6 +57,7 @@ port.addMultipleEventsListeners({
}); });
RESET_STORAGES_PROMISE.resolve(resetStorages); RESET_STORAGES_PROMISE.resolve(resetStorages);
// haveState = true;
}, },
toggleStorages: ({enabled, clearWrite}) => { toggleStorages: ({enabled, clearWrite}) => {

Loading…
Cancel
Save