Browse Source

Only expand status bar for WebRTC reconnects

Danilo Bargen 7 years ago
parent
commit
4e39cec5d3
2 changed files with 4 additions and 3 deletions
  1. 3 2
      src/controllers/status.ts
  2. 1 1
      src/services/webclient.ts

+ 3 - 2
src/controllers/status.ts

@@ -92,6 +92,7 @@ export class StatusController {
      */
     private onStateChange(newValue: threema.GlobalConnectionState,
                           oldValue: threema.GlobalConnectionState): void {
+        this.$log.debug(this.logTag, 'State change:', oldValue, '->', newValue);
         if (newValue === oldValue) {
             return;
         }
@@ -101,13 +102,13 @@ export class StatusController {
                 this.collapseStatusBar();
                 break;
             case 'warning':
-                if (oldValue === 'ok') {
+                if (oldValue === 'ok' && this.webClientService.chosenTask === threema.ChosenTask.WebRTC) {
                     this.scheduleStatusBar();
                 }
                 break;
             case 'error':
                 if (this.stateService.wasConnected) {
-                    if (oldValue === 'ok') {
+                    if (oldValue === 'ok' && this.webClientService.chosenTask === threema.ChosenTask.WebRTC) {
                         this.scheduleStatusBar();
                     }
                     this.reconnect();

+ 1 - 1
src/services/webclient.ts

@@ -151,7 +151,7 @@ export class WebClientService {
     private webrtcTask: saltyrtc.tasks.webrtc.WebRTCTask = null;
     private relayedDataTask: saltyrtc.tasks.relayed_data.RelayedDataTask = null;
     private secureDataChannel: saltyrtc.tasks.webrtc.SecureDataChannel = null;
-    private chosenTask: threema.ChosenTask = threema.ChosenTask.None;
+    public chosenTask: threema.ChosenTask = threema.ChosenTask.None;
 
     // Messenger data
     public messages: threema.Container.Messages;