diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-07-25 21:35:27 +0000 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2019-07-29 18:42:42 +0000 |
| commit | ed825987cdc365898d54c2f2ebf0511637cbda41 (patch) | |
| tree | 987c512fa68dbde1eb223e20ac5409f8092dee48 /android | |
| parent | 296d0b777a89c5ef72560f4e909f2a6ad612a274 (diff) | |
| download | mullvadvpn-ed825987cdc365898d54c2f2ebf0511637cbda41.tar.xz mullvadvpn-ed825987cdc365898d54c2f2ebf0511637cbda41.zip | |
Handle after disconnect in `SwitchLocationButton`
Diffstat (limited to 'android')
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt index d35374b29e..4d3dae8159 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/SwitchLocationButton.kt @@ -9,6 +9,7 @@ import android.graphics.drawable.Drawable import android.view.View import android.widget.Button +import net.mullvad.mullvadvpn.model.ActionAfterDisconnect import net.mullvad.mullvadvpn.model.TunnelState import net.mullvad.mullvadvpn.relaylist.RelayItem @@ -43,9 +44,17 @@ class SwitchLocationButton(val parentView: View) { private fun update() { updateJob?.cancel() updateJob = GlobalScope.launch(Dispatchers.Main) { + val state = this@SwitchLocationButton.state + when (state) { is TunnelState.Disconnected -> showLocation() - is TunnelState.Disconnecting -> showLocation() + is TunnelState.Disconnecting -> { + when (state.actionAfterDisconnect) { + is ActionAfterDisconnect.Nothing -> showLocation() + is ActionAfterDisconnect.Block -> showLocation() + is ActionAfterDisconnect.Reconnect -> showLabel() + } + } is TunnelState.Connecting -> showLabel() is TunnelState.Connected -> showLabel() is TunnelState.Blocked -> showLocation() |
