浏览代码

Fix process response/receivers after response/profile has been processed (#771)

Lennart Grahl 6 年之前
父节点
当前提交
6b229405d7
共有 1 个文件被更改,包括 11 次插入6 次删除
  1. 11 6
      src/services/webclient.ts

+ 11 - 6
src/services/webclient.ts

@@ -2172,11 +2172,16 @@ export class WebClientService {
             return future.reject('invalidResponse');
         }
 
-        // Store receivers
-        this.sortContacts(data.contact);
-        this.receivers.set(data);
-        this.registerInitializationStep(InitializationStep.Receivers);
-        future.resolve();
+        // Run delayed as it requires the profile to be initialised
+        this.runAfterInitializationSteps([
+            InitializationStep.Profile,
+        ], () => {
+            // Store receivers
+            this.sortContacts(data.contact);
+            this.receivers.set(data);
+            this.registerInitializationStep(InitializationStep.Receivers);
+            future.resolve();
+        });
     }
 
     private _receiveResponseContactDetail(message: threema.WireMessage): void {
@@ -2470,7 +2475,7 @@ export class WebClientService {
             return future.reject('invalidResponse');
         }
 
-        // Run delayed...
+        // Run delayed as it requires the receivers to be available
         this.runAfterInitializationSteps([
             InitializationStep.Receivers,
         ], () => {