diff --git a/js/background.js b/js/background.js index 509f83101..8f5c67f9b 100644 --- a/js/background.js +++ b/js/background.js @@ -221,6 +221,7 @@ if (e.name === 'HTTPError' && (e.code == 401 || e.code == 403)) { Whisper.Registration.remove(); + Whisper.events.trigger('unauthorized'); extension.install(); return; } @@ -231,9 +232,7 @@ console.log('retrying in 1 minute'); setTimeout(init, 60000); - if (owsDesktopApp.inboxView) { - owsDesktopApp.inboxView.networkStatusView.setSocketReconnectInterval(60000); - } + Whisper.events.trigger('reconnectTimer'); } else { console.log('offline'); messageReceiver.close(); diff --git a/js/views/network_status_view.js b/js/views/network_status_view.js index 951329540..93e4fb851 100644 --- a/js/views/network_status_view.js +++ b/js/views/network_status_view.js @@ -19,6 +19,8 @@ window.addEventListener('online', this.update.bind(this)); window.addEventListener('offline', this.update.bind(this)); + Whisper.events.on('unauthorized', this.update, this); + Whisper.events.on('reconnectTimer', this.onReconnectTimer, this); this.model = new Backbone.Model(); this.listenTo(this.model, 'change', this.onChange); @@ -26,6 +28,9 @@ events: { 'click .openInstaller': extension.install }, + onReconnectTimer: function() { + this.setSocketReconnectInterval(60000); + }, finishConnectingGracePeriod: function() { this.withinConnectingGracePeriod = false; },