Skip to content

Commit 87f2aec

Browse files
committed
Support new relay item in connect screen
1 parent 747cf86 commit 87f2aec

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ConnectScreen.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ fun ConnectScreen(
264264
onClick = onSwitchLocationClick,
265265
showChevron = uiState.showLocation,
266266
text =
267-
if (uiState.showLocation) {
268-
uiState.relayLocation?.locationName ?: ""
267+
if (uiState.showLocation && uiState.selectedRelayItem != null) {
268+
uiState.selectedRelayItem.locationName
269269
} else {
270270
stringResource(id = R.string.switch_location)
271271
}

android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/ConnectUiState.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import net.mullvad.talpid.net.TransportProtocol
88

99
data class ConnectUiState(
1010
val location: GeoIpLocation?,
11-
val relayLocation: RelayItem?,
11+
val selectedRelayItem: RelayItem?,
1212
val tunnelUiState: TunnelState,
1313
val tunnelRealState: TunnelState,
1414
val inAddress: Triple<String, Int, TransportProtocol>?,
@@ -23,7 +23,7 @@ data class ConnectUiState(
2323
val INITIAL =
2424
ConnectUiState(
2525
location = null,
26-
relayLocation = null,
26+
selectedRelayItem = null,
2727
tunnelUiState = TunnelState.Disconnected(),
2828
tunnelRealState = TunnelState.Disconnected(),
2929
inAddress = null,

android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/ConnectViewModel.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class ConnectViewModel(
8484
accountRepository.accountExpiryState,
8585
deviceRepository.deviceState.map { it.deviceName() }
8686
) {
87-
relayLocation,
87+
selectedRelayItem,
8888
notifications,
8989
tunnelUiState,
9090
tunnelRealState,
@@ -97,12 +97,12 @@ class ConnectViewModel(
9797
is TunnelState.Disconnected ->
9898
tunnelRealState.location() ?: lastKnownDisconnectedLocation
9999
is TunnelState.Connecting ->
100-
tunnelRealState.location ?: relayLocation?.location?.location
100+
tunnelRealState.location ?: selectedRelayItem?.location()
101101
is TunnelState.Connected -> tunnelRealState.location
102102
is TunnelState.Disconnecting -> lastKnownDisconnectedLocation
103103
is TunnelState.Error -> null
104104
},
105-
relayLocation = relayLocation,
105+
selectedRelayItem = selectedRelayItem,
106106
tunnelUiState = tunnelUiState,
107107
tunnelRealState = tunnelRealState,
108108
inAddress =

0 commit comments

Comments
 (0)