summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-12-04 12:10:23 -0200
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-12-04 12:10:23 -0200
commit6c2befe0a2818112531198d615cff7ca70482940 (patch)
treea1e9371f5888198af263a7b0259ce804d82f99e4
parentd57a62158a508c90ccd2812d5c0e0957eb6403a3 (diff)
parent9207574ac7315e07f91fb68858d7363d70ec3751 (diff)
downloadmullvadvpn-6c2befe0a2818112531198d615cff7ca70482940.tar.xz
mullvadvpn-6c2befe0a2818112531198d615cff7ca70482940.zip
Merge branch 'fix-location'
-rw-r--r--gui/packages/desktop/src/main/index.js20
1 files changed, 6 insertions, 14 deletions
diff --git a/gui/packages/desktop/src/main/index.js b/gui/packages/desktop/src/main/index.js
index 0af3747330..5cc11a29b1 100644
--- a/gui/packages/desktop/src/main/index.js
+++ b/gui/packages/desktop/src/main/index.js
@@ -454,11 +454,9 @@ const ApplicationMain = {
},
_setTunnelState(newState: TunnelStateTransition) {
- const oldState = this._tunnelState;
-
this._tunnelState = newState;
this._updateTrayIcon(newState.state);
- this._updateLocation(oldState);
+ this._updateLocation();
if (!this._shouldSuppressNotifications()) {
this._notificationController.notifyTunnelState(newState);
@@ -619,20 +617,14 @@ const ApplicationMain = {
return this._windowController && this._windowController.isVisible();
},
- async _updateLocation(oldState: TunnelStateTransition) {
- const newState = this._tunnelState;
+ async _updateLocation() {
+ const state = this._tunnelState.state;
- if (
- newState.state === 'connected' ||
- newState.state === 'disconnected' ||
- // Guard from fetching the location during reconnection loop.
- (newState.state === 'connecting' &&
- !(oldState.state === 'disconnecting' && oldState.details === 'reconnect'))
- ) {
+ if (state === 'connected' || state === 'disconnected' || state === 'connecting') {
try {
// It may take some time to fetch the new user location.
// So take the user to the last known location when disconnected.
- if (newState.state === 'disconnected' && this._lastDisconnectedLocation) {
+ if (state === 'disconnected' && this._lastDisconnectedLocation) {
this._setLocation(this._lastDisconnectedLocation);
}
@@ -648,7 +640,7 @@ const ApplicationMain = {
// Broadcast the new location.
// There is a chance that the location is not stale if the tunnel state before the location
// request is the same as after receiving the response.
- if (this._tunnelState.state === newState.state) {
+ if (this._tunnelState.state === state) {
this._setLocation(location);
}
} catch (error) {