diff options
| author | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2025-05-05 11:35:43 +0200 |
|---|---|---|
| committer | Jonatan Rhodin <jonatan.rhodin@mullvad.net> | 2025-05-05 22:47:54 +0200 |
| commit | 7dfffe68f3f9c66790c069bb1cb7fb4da6eaa98d (patch) | |
| tree | b91240aba001a9cabcec51e3eeb4a5d7838bc77b /android/app/src/main | |
| parent | dc860e549ad9b88416ec38b8bd2b7f8936a65856 (diff) | |
| download | mullvadvpn-7dfffe68f3f9c66790c069bb1cb7fb4da6eaa98d.tar.xz mullvadvpn-7dfffe68f3f9c66790c069bb1cb7fb4da6eaa98d.zip | |
Fix select location button text in connect screen
- Remove unnecessary show location boolean
- Remove reliance on disconnected location
- Align state behaviour with desktop
- Update screen tests with the new behaviour
Diffstat (limited to 'android/app/src/main')
4 files changed, 7 insertions, 19 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/preview/ConnectUiStatePreviewParameterProvider.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/preview/ConnectUiStatePreviewParameterProvider.kt index d3c704d0a2..ea19fba8e7 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/preview/ConnectUiStatePreviewParameterProvider.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/preview/ConnectUiStatePreviewParameterProvider.kt @@ -45,7 +45,6 @@ private fun generateOtherStates(): Sequence<ConnectUiState> = ), selectedRelayItemTitle = "Relay Title", tunnelState = state, - showLocation = true, inAppNotification = if (index == 0) InAppNotification.NewDevice("Test Device") else null, deviceName = "Cool Beans", diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt index 7de950efc8..2a3474c755 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt @@ -687,7 +687,7 @@ private fun ButtonPanel( Column(modifier = Modifier.padding(vertical = Dimens.tinyPadding)) { SwitchLocationButton( text = - if (state.showLocation && state.selectedRelayItemTitle != null) { + if (state.selectedRelayItemTitle != null) { state.selectedRelayItemTitle } else { stringResource(id = R.string.switch_location) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/ConnectUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/ConnectUiState.kt index 63b596d513..956b1506a7 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/ConnectUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/ConnectUiState.kt @@ -8,7 +8,6 @@ data class ConnectUiState( val location: GeoIpLocation?, val selectedRelayItemTitle: String?, val tunnelState: TunnelState, - val showLocation: Boolean, val inAppNotification: InAppNotification?, val deviceName: String?, val daysLeftUntilExpiry: Long?, @@ -24,7 +23,6 @@ data class ConnectUiState( location = null, selectedRelayItemTitle = null, tunnelState = TunnelState.Disconnected(), - showLocation = false, inAppNotification = null, deviceName = null, daysLeftUntilExpiry = null, 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 3a100736b2..2ccb138a5f 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 @@ -95,22 +95,13 @@ class ConnectViewModel( } is TunnelState.Error -> lastKnownDisconnectedLocation }, - selectedRelayItemTitle = selectedRelayItemTitle, - tunnelState = tunnelState, - showLocation = - when (tunnelState) { - is TunnelState.Disconnected -> tunnelState.location != null - is TunnelState.Disconnecting -> { - when (tunnelState.actionAfterDisconnect) { - ActionAfterDisconnect.Nothing -> false - ActionAfterDisconnect.Block -> true - ActionAfterDisconnect.Reconnect -> false - } - } - is TunnelState.Connecting -> false - is TunnelState.Connected -> false - is TunnelState.Error -> true + selectedRelayItemTitle = + if (tunnelState is TunnelState.Disconnected) { + selectedRelayItemTitle + } else { + null }, + tunnelState = tunnelState, inAppNotification = notifications.firstOrNull(), deviceName = deviceName, daysLeftUntilExpiry = accountData?.expiryDate?.daysFromNow(), |
