diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt index 2aab50243c72..045b73bbaec8 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt @@ -83,7 +83,7 @@ class ConnectViewModel( notifications, tunnelUiState, tunnelRealState, - lastKnownLocation, + lastKnownDisconnectedLocation, accountExpiry, deviceName -> if (tunnelRealState.isTunnelErrorStateDueToExpiredAccount()) { @@ -93,11 +93,11 @@ class ConnectViewModel( location = when (tunnelRealState) { is TunnelState.Disconnected -> tunnelRealState.location() - ?: lastKnownLocation + ?: lastKnownDisconnectedLocation is TunnelState.Connecting -> tunnelRealState.location is TunnelState.Connected -> tunnelRealState.location - is TunnelState.Disconnecting -> lastKnownLocation - is TunnelState.Error -> lastKnownLocation + is TunnelState.Disconnecting -> lastKnownDisconnectedLocation + is TunnelState.Error -> lastKnownDisconnectedLocation }, relayLocation = relayLocation, tunnelUiState = tunnelUiState, diff --git a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/TunnelState.kt b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/TunnelState.kt index a2fec5716130..4ab925d01427 100644 --- a/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/TunnelState.kt +++ b/android/lib/model/src/main/kotlin/net/mullvad/mullvadvpn/model/TunnelState.kt @@ -26,10 +26,10 @@ sealed class TunnelState : Parcelable { fun location(): GeoIpLocation? { return when (this) { - is Connected -> this.location - is Connecting -> this.location + is Connected -> location + is Connecting -> location is Disconnecting -> null - is Disconnected -> this.location + is Disconnected -> location is Error -> null } }