diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-09-15 10:22:39 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2018-09-19 09:45:11 -0300 |
| commit | ee93bb7a824eba8d53e0b68d11795948ba1a003a (patch) | |
| tree | 6ac4a132604f4c08f4f7256ecd781b214e83423f | |
| parent | 5bef2df9f74d82e982db9cfee0657c019666b8ab (diff) | |
| download | mullvadvpn-ee93bb7a824eba8d53e0b68d11795948ba1a003a.tar.xz mullvadvpn-ee93bb7a824eba8d53e0b68d11795948ba1a003a.zip | |
Show `Reconnecting` message
Avoid showing multiple `Disconnecting` and `Connecting` messages in
sequence.
| -rw-r--r-- | gui/packages/desktop/src/renderer/lib/notification-controller.js | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/gui/packages/desktop/src/renderer/lib/notification-controller.js b/gui/packages/desktop/src/renderer/lib/notification-controller.js index c5bf201d90..9f53524295 100644 --- a/gui/packages/desktop/src/renderer/lib/notification-controller.js +++ b/gui/packages/desktop/src/renderer/lib/notification-controller.js @@ -3,15 +3,18 @@ import { remote } from 'electron'; import log from 'electron-log'; -import type { TunnelState } from './daemon-rpc'; +import type { TunnelStateTransition } from './daemon-rpc'; export default class NotificationController { _activeNotification: ?Notification; + _reconnecting = false; - notify(tunnelState: TunnelState) { - switch (tunnelState) { + notify(tunnelState: TunnelStateTransition) { + switch (tunnelState.state) { case 'connecting': - this._show('Connecting'); + if (!this._reconnecting) { + this._show('Connecting'); + } break; case 'connected': this._show('Secured'); @@ -23,11 +26,22 @@ export default class NotificationController { this._show('Blocked all connections'); break; case 'disconnecting': - // no-op + switch (tunnelState.details) { + case 'nothing': + case 'block': + // no-op + break; + case 'reconnect': + this._show('Reconnecting'); + this._reconnecting = true; + return; + } break; default: - log.error(`Unexpected TunnelStateTransition: ${(tunnelState: empty)}`); + log.error(`Unexpected TunnelStateTransition: ${(tunnelState.state: empty)}`); } + + this._reconnecting = false; } _show(message: string) { |
