summaryrefslogtreecommitdiffhomepage
path: root/android/app/src
diff options
context:
space:
mode:
authorDavid Göransson <david.goransson@mullvad.net>2025-04-09 09:02:37 +0200
committerJonatan Rhodin <jonatan.rhodin@mullvad.net>2025-04-10 17:29:33 +0200
commit4fdf70105137c33b63a56a08688b27b7d3ec2260 (patch)
tree23ca41e984b0742882bedf192bcd808708df55fb /android/app/src
parent70ac76921d33ebcba57a3792ed3b37ce6e77dc9d (diff)
downloadmullvadvpn-4fdf70105137c33b63a56a08688b27b7d3ec2260.tar.xz
mullvadvpn-4fdf70105137c33b63a56a08688b27b7d3ec2260.zip
Add support for DAITA: Multihop indicator
Diffstat (limited to 'android/app/src')
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt2
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt3
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt93
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VpnSettingItem.kt2
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt8
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelState.kt4
-rw-r--r--android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelTest.kt4
7 files changed, 12 insertions, 104 deletions
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt
index c3f0a14f35..8e22be8b7e 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt
@@ -148,7 +148,7 @@ fun BaseSubtitleCell(
start = Dimens.cellStartPadding,
top = Dimens.cellFooterTopPadding,
end = Dimens.cellEndPadding,
- bottom = Dimens.cellVerticalSpacing
+ bottom = Dimens.cellVerticalSpacing,
)
.fillMaxWidth()
.wrapContentHeight(),
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt
index 1cfe26c27a..afd13a7382 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/component/connectioninfo/FeatureIndicatorsPanel.kt
@@ -136,7 +136,8 @@ private fun FeatureIndicator.text(): String {
FeatureIndicator.SERVER_IP_OVERRIDE -> R.string.server_ip_override
FeatureIndicator.CUSTOM_MTU -> R.string.feature_custom_mtu
FeatureIndicator.DAITA -> R.string.daita
- FeatureIndicator.DAITA_MULTIHOP -> R.string.daita_multihop
+ FeatureIndicator.DAITA_MULTIHOP ->
+ return textResource(R.string.daita_multihop, textResource(R.string.daita))
FeatureIndicator.MULTIHOP -> R.string.multihop
}
return textResource(resource)
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 60368d7d0f..3be45210e9 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
@@ -417,6 +417,7 @@ fun VpnSettingsScreen(
onSelectDeviceIpVersion,
onToggleIpv6,
navigateToIpv6Info,
+ navigateToDeviceIpInfo,
)
}
}
@@ -461,6 +462,7 @@ fun VpnSettingsContent(
onSelectDeviceIpVersion: (ipVersion: Constraint<IpVersion>) -> Unit,
onToggleIpv6: (Boolean) -> Unit,
navigateToIpv6Info: () -> Unit,
+ navigateToDeviceIpInfo: () -> Unit,
) {
val initialIndexFocus =
when (initialScrollToFeature) {
@@ -616,6 +618,7 @@ fun VpnSettingsContent(
item(key = it::class.simpleName) {
InformationComposeCell(
title = stringResource(R.string.device_ip_version_title),
+ onInfoClicked = navigateToDeviceIpInfo,
modifier = Modifier.animateItem(),
)
}
@@ -640,17 +643,6 @@ fun VpnSettingsContent(
)
}
- VpnSettingItem.DeviceIpVersionInfo -> {
- item(key = it::class.simpleName) {
- BaseSubtitleCell(
- text = stringResource(R.string.device_ip_version_subtitle),
- style = MaterialTheme.typography.labelMedium,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- modifier = Modifier.animateItem(),
- )
- }
- }
-
VpnSettingItem.Divider -> {
item(contentType = it::class.simpleName) {
HorizontalDivider(
@@ -685,84 +677,6 @@ fun VpnSettingsContent(
modifier = Modifier.animateItem(),
)
}
-
-<<<<<<< HEAD
- itemWithDivider {
- InformationComposeCell(
- title = stringResource(R.string.device_ip_version_title),
- onInfoClicked = navigateToDeviceIpInfo,
- )
- }
- itemWithDivider {
- SelectableCell(
- title = stringResource(id = R.string.automatic),
- isSelected = state.deviceIpVersion == Constraint.Any,
- onCellClicked = { onSelectDeviceIpVersion(Constraint.Any) },
- )
- }
- itemWithDivider {
- SelectableCell(
- title = stringResource(id = R.string.ipv4),
- isSelected = state.deviceIpVersion.getOrNull() == IpVersion.IPV4,
- onCellClicked = { onSelectDeviceIpVersion(Constraint.Only(IpVersion.IPV4)) },
- )
- }
- item {
- SelectableCell(
- title = stringResource(id = R.string.ipv6),
- isSelected = state.deviceIpVersion.getOrNull() == IpVersion.IPV6,
- onCellClicked = { onSelectDeviceIpVersion(Constraint.Only(IpVersion.IPV6)) },
- )
- }
- item {
- MtuComposeCell(mtuValue = state.mtu, onEditMtu = { navigateToMtuDialog(state.mtu) })
- }
- item { MtuSubtitle(modifier = Modifier.testTag(LAZY_LIST_LAST_ITEM_TEST_TAG)) }
-||||||| parent of f714aa727f (Implement quick access to active features)
- itemWithDivider {
- InformationComposeCell(title = stringResource(R.string.device_ip_version_title))
- }
- itemWithDivider {
- SelectableCell(
- title = stringResource(id = R.string.automatic),
- isSelected = state.deviceIpVersion == Constraint.Any,
- onCellClicked = { onSelectDeviceIpVersion(Constraint.Any) },
- )
- }
- itemWithDivider {
- SelectableCell(
- title = stringResource(id = R.string.ipv4),
- isSelected = state.deviceIpVersion.getOrNull() == IpVersion.IPV4,
- onCellClicked = { onSelectDeviceIpVersion(Constraint.Only(IpVersion.IPV4)) },
- )
- }
- item {
- SelectableCell(
- title = stringResource(id = R.string.ipv6),
- isSelected = state.deviceIpVersion.getOrNull() == IpVersion.IPV6,
- onCellClicked = { onSelectDeviceIpVersion(Constraint.Only(IpVersion.IPV6)) },
- )
- }
- item {
- Text(
- text = stringResource(R.string.device_ip_version_subtitle),
- style = MaterialTheme.typography.labelMedium,
- color = MaterialTheme.colorScheme.onSurfaceVariant,
- modifier =
- Modifier.padding(
- start = Dimens.cellStartPadding,
- top = topPadding,
- end = Dimens.cellEndPadding,
- ),
- )
- Spacer(modifier = Modifier.height(Dimens.cellVerticalSpacing))
- }
-
- item {
- MtuComposeCell(mtuValue = state.mtu, onEditMtu = { navigateToMtuDialog(state.mtu) })
- }
- item { MtuSubtitle(modifier = Modifier.testTag(LAZY_LIST_LAST_ITEM_TEST_TAG)) }
-=======
is VpnSettingItem.DnsContentBlockerItem.Gambling ->
item(key = it::class.simpleName) {
NormalSwitchComposeCell(
@@ -789,7 +703,6 @@ fun VpnSettingsContent(
startPadding = Dimens.indentedCellStartPadding,
)
}
->>>>>>> f714aa727f (Implement quick access to active features)
is VpnSettingItem.DnsContentBlockerItem.SocialMedia ->
item(key = it::class.simpleName) {
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VpnSettingItem.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VpnSettingItem.kt
index d953695848..6f18260f5d 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VpnSettingItem.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/VpnSettingItem.kt
@@ -122,8 +122,6 @@ sealed interface VpnSettingItem {
data class DeviceIpVersionItem(val constraint: Constraint<IpVersion>, val selected: Boolean) :
VpnSettingItem
- data object DeviceIpVersionInfo : VpnSettingItem
-
data class Mtu(val mtu: net.mullvad.mullvadvpn.lib.model.Mtu?) : VpnSettingItem
data object MtuInfo : VpnSettingItem
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt
index 6cdb9a73a3..7a4dce5820 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModel.kt
@@ -140,11 +140,9 @@ class VpnSettingsViewModel(
val hasDnsEntries = settings.addresses().isNotEmpty()
if (hasDnsEntries) {
- settingsRepository.setDnsState(if (enable) DnsState.Custom else DnsState.Default).fold({
- showGenericErrorToast()
- },{
- showApplySettingChangesWarningToast()
- })
+ settingsRepository
+ .setDnsState(if (enable) DnsState.Custom else DnsState.Default)
+ .fold({ showGenericErrorToast() }, { showApplySettingChangesWarningToast() })
} else {
// If they enable custom DNS and has no current entries we show the dialog
// to add one.
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelState.kt
index d4f395a63d..21d051156b 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelState.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelState.kt
@@ -144,7 +144,7 @@ sealed interface VpnSettingsUiState {
if (contentBlockersOptions.isAnyBlockerEnabled()) {
add(VpnSettingItem.CustomDnsUnavailable)
- } else if(customDnsItems.isEmpty()) {
+ } else if (customDnsItems.isEmpty()) {
add(VpnSettingItem.CustomDnsInfo)
} else {
add(VpnSettingItem.Spacer)
@@ -242,7 +242,7 @@ sealed interface VpnSettingsUiState {
add(VpnSettingItem.DeviceIpVersionItem(it, deviceIpVersion == it))
}
- add(VpnSettingItem.DeviceIpVersionInfo)
+ add(VpnSettingItem.Spacer)
// MTU
add(VpnSettingItem.Mtu(mtu))
diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelTest.kt
index 2dd2475ba2..abb0dc71e1 100644
--- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelTest.kt
+++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/VpnSettingsViewModelTest.kt
@@ -247,9 +247,7 @@ class VpnSettingsViewModelTest {
val content = awaitItem()
assertInstanceOf<VpnSettingsUiState.Content>(content)
- assertTrue(
- content.settings.any { it is VpnSettingItem.AutoConnectAndLockdownMode }
- )
+ assertTrue(content.settings.any { it is VpnSettingItem.AutoConnectAndLockdownMode })
}
}