From 231d3869bbaa9fcdb1174141111152711b8618fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Wed, 25 Oct 2023 15:19:40 +0200 Subject: [PATCH] Re-order settings to be same as desktop --- .../compose/screen/VpnSettingsScreenTest.kt | 3 - .../compose/screen/VpnSettingsScreen.kt | 105 +++++++++--------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreenTest.kt index 167aabd5ec13..688c3c165b49 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreenTest.kt @@ -370,9 +370,6 @@ class VpnSettingsScreenTest { toastMessagesSharedFlow = MutableSharedFlow().asSharedFlow() ) } - composeTestRule - .onNodeWithTag(LAZY_LIST_TEST_TAG) - .performScrollToNode(hasTestTag(LAZY_LIST_LAST_ITEM_TEST_TAG)) // Assert composeTestRule.apply { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt index 4178b6632993..7290b9600fd3 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt @@ -437,6 +437,56 @@ fun VpnSettingsScreen( ) } + itemWithDivider { + Spacer(modifier = Modifier.height(Dimens.cellLabelVerticalPadding)) + InformationComposeCell( + title = stringResource(id = R.string.wireguard_port_title), + onInfoClicked = onWireguardPortInfoClicked + ) + } + + itemWithDivider { + SelectableCell( + title = stringResource(id = R.string.automatic), + isSelected = uiState.selectedWireguardPort is Constraint.Any, + onCellClicked = { onWireguardPortSelected(Constraint.Any()) } + ) + } + + WIREGUARD_PRESET_PORTS.forEach { port -> + itemWithDivider { + SelectableCell( + title = port.toString(), + testTag = String.format(LAZY_LIST_WIREGUARD_PORT_ITEM_X_TEST_TAG, port), + isSelected = uiState.selectedWireguardPort.hasValue(port), + onCellClicked = { onWireguardPortSelected(Constraint.Only(Port(port))) } + ) + } + } + + itemWithDivider { + CustomPortCell( + title = stringResource(id = R.string.wireguard_custon_port_title), + isSelected = uiState.selectedWireguardPort.isCustom(), + port = + if (uiState.selectedWireguardPort.isCustom()) { + uiState.selectedWireguardPort.toDisplayCustomPort() + } else { + savedCustomPort.value.toDisplayCustomPort() + }, + onMainCellClicked = { + if (savedCustomPort.value is Constraint.Only) { + onWireguardPortSelected(savedCustomPort.value) + } else { + onShowCustomPortDialog() + } + }, + onPortCellClicked = { onShowCustomPortDialog() }, + mainTestTag = LAZY_LIST_WIREGUARD_CUSTOM_PORT_TEXT_TEST_TAG, + numberTestTag = LAZY_LIST_WIREGUARD_CUSTOM_PORT_NUMBER_TEST_TAG + ) + } + itemWithDivider { Spacer(modifier = Modifier.height(Dimens.cellLabelVerticalPadding)) InformationComposeCell( @@ -488,68 +538,21 @@ fun VpnSettingsScreen( onCellClicked = { onSelectQuantumResistanceSetting(QuantumResistantState.On) } ) } - itemWithDivider { + item { SelectableCell( title = stringResource(id = R.string.off), testTag = LAZY_LIST_QUANTUM_ITEM_OFF_TEST_TAG, isSelected = uiState.quantumResistant == QuantumResistantState.Off, onCellClicked = { onSelectQuantumResistanceSetting(QuantumResistantState.Off) } ) - } - - itemWithDivider { Spacer(modifier = Modifier.height(Dimens.cellLabelVerticalPadding)) - InformationComposeCell( - title = stringResource(id = R.string.wireguard_port_title), - onInfoClicked = onWireguardPortInfoClicked - ) - } - - itemWithDivider { - SelectableCell( - title = stringResource(id = R.string.automatic), - isSelected = uiState.selectedWireguardPort is Constraint.Any, - onCellClicked = { onWireguardPortSelected(Constraint.Any()) } - ) - } - - WIREGUARD_PRESET_PORTS.forEach { port -> - itemWithDivider { - SelectableCell( - title = port.toString(), - testTag = String.format(LAZY_LIST_WIREGUARD_PORT_ITEM_X_TEST_TAG, port), - isSelected = uiState.selectedWireguardPort.hasValue(port), - onCellClicked = { onWireguardPortSelected(Constraint.Only(Port(port))) } - ) - } } - itemWithDivider { - CustomPortCell( - title = stringResource(id = R.string.wireguard_custon_port_title), - isSelected = uiState.selectedWireguardPort.isCustom(), - port = - if (uiState.selectedWireguardPort.isCustom()) { - uiState.selectedWireguardPort.toDisplayCustomPort() - } else { - savedCustomPort.value.toDisplayCustomPort() - }, - onMainCellClicked = { - if (savedCustomPort.value is Constraint.Only) { - onWireguardPortSelected(savedCustomPort.value) - } else { - onShowCustomPortDialog() - } - }, - onPortCellClicked = { onShowCustomPortDialog() }, - mainTestTag = LAZY_LIST_WIREGUARD_CUSTOM_PORT_TEXT_TEST_TAG, - numberTestTag = LAZY_LIST_WIREGUARD_CUSTOM_PORT_NUMBER_TEST_TAG - ) + item { MtuComposeCell(mtuValue = uiState.mtu, onEditMtu = { onMtuCellClick() }) } + item { + MtuSubtitle(modifier = Modifier.testTag(LAZY_LIST_LAST_ITEM_TEST_TAG)) Spacer(modifier = Modifier.height(Dimens.cellLabelVerticalPadding)) } - - item { MtuComposeCell(mtuValue = uiState.mtu, onEditMtu = { onMtuCellClick() }) } - item { MtuSubtitle(modifier = Modifier.testTag(LAZY_LIST_LAST_ITEM_TEST_TAG)) } } } }