From 0e19b762c23bf6609f7e9102bc3ba69efd33c9d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Mon, 15 Jul 2024 12:26:40 +0200 Subject: [PATCH 1/5] Add dependency to Destinations --- android/test/arch/build.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/android/test/arch/build.gradle.kts b/android/test/arch/build.gradle.kts index 2665083cb057..d2debc07dd98 100644 --- a/android/test/arch/build.gradle.kts +++ b/android/test/arch/build.gradle.kts @@ -32,6 +32,7 @@ dependencies { testRuntimeOnly(Dependencies.junitEngine) testImplementation(Dependencies.Compose.uiToolingAndroidPreview) + testImplementation(Dependencies.Compose.destinations) testImplementation(Dependencies.AndroidX.appcompat) testImplementation(Dependencies.junitApi) testImplementation(Dependencies.konsist) From afce27d5922636f08e5b7a86c4e2c2f2be9ff8b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Mon, 15 Jul 2024 12:27:09 +0200 Subject: [PATCH 2/5] Update gradle lockfile --- android/gradle/verification-metadata.xml | 56 ++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/android/gradle/verification-metadata.xml b/android/gradle/verification-metadata.xml index 3246b3765094..70333d352fe3 100644 --- a/android/gradle/verification-metadata.xml +++ b/android/gradle/verification-metadata.xml @@ -66,6 +66,14 @@ + + + + + + + + @@ -82,6 +90,14 @@ + + + + + + + + @@ -119,6 +135,14 @@ + + + + + + + + @@ -216,9 +240,6 @@ - - - @@ -488,6 +509,14 @@ + + + + + + + + @@ -685,6 +714,11 @@ + + + + + @@ -1095,6 +1129,9 @@ + + + @@ -1596,6 +1633,14 @@ + + + + + + + + @@ -1665,6 +1710,11 @@ + + + + + From 0bb1d8ecc81398db073aeb550ee4295284b515f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Mon, 15 Jul 2024 12:27:25 +0200 Subject: [PATCH 3/5] Add ComposeDestinationsTests --- .../arch/compose/ComposeDestinationsTest.kt | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposeDestinationsTest.kt diff --git a/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposeDestinationsTest.kt b/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposeDestinationsTest.kt new file mode 100644 index 000000000000..7a638fb242d1 --- /dev/null +++ b/android/test/arch/src/test/kotlin/net/mullvad/mullvadvpn/test/arch/compose/ComposeDestinationsTest.kt @@ -0,0 +1,28 @@ +package net.mullvad.mullvadvpn.test.arch.compose + +import com.lemonappdev.konsist.api.Konsist +import com.lemonappdev.konsist.api.ext.list.withAllAnnotationsOf +import com.lemonappdev.konsist.api.verify.assertTrue +import com.ramcosta.composedestinations.annotation.Destination +import org.junit.jupiter.api.Test + +class ComposeDestinationsTest { + @Test + fun `ensure all destinations functions does not have invalid suffix`() = + allDestinationsFunctions().assertTrue { destinationFunction -> + DESTINATION_SUFFIXES.none { suffix -> destinationFunction.name.endsWith(suffix) } + } + + @Test + fun `ensure all files that contains destinations ends with a valid suffix`() = + allDestinationsFunctions().assertTrue { destinationFunction -> + DESTINATION_SUFFIXES.any { destinationFunction.containingFile.name.endsWith(it) } + } + + private fun allDestinationsFunctions() = + Konsist.scopeFromProduction("app").functions().withAllAnnotationsOf(Destination::class) + + companion object { + private val DESTINATION_SUFFIXES = listOf("Screen", "Dialog") + } +} From 59f1724ce48fed87199279ab5190fa954637a2bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Mon, 15 Jul 2024 12:27:46 +0200 Subject: [PATCH 4/5] Align Screen and Dialog names --- .../dialog/ApiAccessMethodInfoDialog.kt | 4 +- .../dialog/ContentBlockersInfoDialog.kt | 2 +- .../compose/dialog/CustomDnsInfoDialog.kt | 4 +- .../compose/dialog/DeviceNameInfoDialog.kt | 2 +- .../compose/dialog/DiscardChangesDialog.kt | 2 +- .../mullvadvpn/compose/dialog/DnsDialog.kt | 2 +- .../dialog/LocalNetworkSharingInfoDialog.kt | 4 +- .../compose/dialog/MalwareInfoDialog.kt | 4 +- .../mullvadvpn/compose/dialog/MtuDialog.kt | 4 +- .../compose/dialog/ObfuscationInfoDialog.kt | 4 +- .../dialog/QuantumResistanceInfoDialog.kt | 4 +- .../dialog/RemoveDeviceConfirmationDialog.kt | 4 +- .../dialog/ReportProblemNoEmailDialog.kt | 4 +- .../dialog/ServerIpOverridesInfoDialog.kt | 4 +- .../dialog/UdpOverTcpPortInfoDialog.kt | 4 +- .../dialog/WireguardCustomPortDialog.kt | 4 +- .../compose/dialog/WireguardPortInfoDialog.kt | 7 +-- .../payment/VerificationPendingDialog.kt | 2 +- .../compose/screen/AccountScreen.kt | 9 ++-- .../compose/screen/ApiAccessListScreen.kt | 4 +- .../screen/CustomListLocationsScreen.kt | 6 +-- .../compose/screen/DeviceListScreen.kt | 7 ++- .../screen/EditApiAccessMethodScreen.kt | 6 +-- .../mullvadvpn/compose/screen/FilterScreen.kt | 2 +- .../mullvadvpn/compose/screen/MullvadApp.kt | 6 +-- .../compose/screen/NoDaemonScreen.kt | 2 +- .../compose/screen/OutOfTimeScreen.kt | 4 +- .../compose/screen/ReportProblemScreen.kt | 6 +-- .../compose/screen/SelectLocationScreen.kt | 4 +- .../compose/screen/ServerIpOverridesScreen.kt | 5 +- .../compose/screen/VpnSettingsScreen.kt | 53 +++++++++---------- .../compose/screen/WelcomeScreen.kt | 8 +-- .../compose/transitions/SettingsTransition.kt | 6 +-- .../SlideInFromBottomTransition.kt | 10 ++-- .../SlideInFromRightLeafTransition.kt | 4 +- .../transitions/SlideInFromRightTransition.kt | 6 +-- .../viewmodel/DnsDialogViewModel.kt | 4 +- .../viewmodel/MtuDialogViewModel.kt | 4 +- 38 files changed, 107 insertions(+), 114 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ApiAccessMethodInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ApiAccessMethodInfoDialog.kt index 8b607fe676b6..db0f6a2ca18b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ApiAccessMethodInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ApiAccessMethodInfoDialog.kt @@ -15,12 +15,12 @@ import net.mullvad.mullvadvpn.lib.theme.AppTheme @Preview @Composable private fun PreviewApiAccessMethodInfoDialog() { - AppTheme { ApiAccessMethodInfoDialog(EmptyDestinationsNavigator) } + AppTheme { ApiAccessMethodInfo(EmptyDestinationsNavigator) } } @Destination(style = DestinationStyle.Dialog::class) @Composable -fun ApiAccessMethodInfoDialog(navigator: DestinationsNavigator) { +fun ApiAccessMethodInfo(navigator: DestinationsNavigator) { InfoDialog( message = buildString { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ContentBlockersInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ContentBlockersInfoDialog.kt index 9e1913b498b6..bde7cfa73cbc 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ContentBlockersInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ContentBlockersInfoDialog.kt @@ -12,7 +12,7 @@ import net.mullvad.mullvadvpn.compose.component.textResource @Destination(style = DestinationStyle.Dialog::class) @Composable -fun ContentBlockersInfoDialog(navigator: DestinationsNavigator) { +fun ContentBlockersInfo(navigator: DestinationsNavigator) { InfoDialog( message = buildString { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CustomDnsInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CustomDnsInfoDialog.kt index d8e52d96cde7..7aa1f00c793d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CustomDnsInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/CustomDnsInfoDialog.kt @@ -14,12 +14,12 @@ import net.mullvad.mullvadvpn.R @Preview @Composable private fun PreviewCustomDnsInfoDialog() { - CustomDnsInfoDialog(EmptyDestinationsNavigator) + CustomDnsInfo(EmptyDestinationsNavigator) } @Destination(style = DestinationStyle.Dialog::class) @Composable -fun CustomDnsInfoDialog(navigator: DestinationsNavigator) { +fun CustomDnsInfo(navigator: DestinationsNavigator) { InfoDialog( message = stringResource(id = R.string.settings_changes_effect_warning_content_blocker), onDismiss = dropUnlessResumed { navigator.navigateUp() } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceNameInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceNameInfoDialog.kt index 98d1c4a87c65..f0b0923a3f19 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceNameInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DeviceNameInfoDialog.kt @@ -11,7 +11,7 @@ import net.mullvad.mullvadvpn.R @Destination(style = DestinationStyle.Dialog::class) @Composable -fun DeviceNameInfoDialog(navigator: DestinationsNavigator) { +fun DeviceNameInfo(navigator: DestinationsNavigator) { InfoDialog( message = buildString { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DiscardChangesDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DiscardChangesDialog.kt index b6cb66ad9370..61dfa4c85c8f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DiscardChangesDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DiscardChangesDialog.kt @@ -18,7 +18,7 @@ import net.mullvad.mullvadvpn.compose.button.PrimaryButton @Destination(style = DestinationStyle.Dialog::class) @Composable -fun DiscardChangesDialog(resultBackNavigator: ResultBackNavigator) { +fun DiscardChanges(resultBackNavigator: ResultBackNavigator) { AlertDialog( onDismissRequest = dropUnlessResumed { resultBackNavigator.navigateBack() }, title = { Text(text = stringResource(id = R.string.discard_changes)) }, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt index 518539dd6453..9adaa5710d06 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/DnsDialog.kt @@ -58,7 +58,7 @@ data class DnsDialogNavArgs( @Destination(style = DestinationStyle.Dialog::class, navArgs = DnsDialogNavArgs::class) @Composable -fun DnsDialog( +fun Dns( resultNavigator: ResultBackNavigator, ) { val viewModel = koinViewModel() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/LocalNetworkSharingInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/LocalNetworkSharingInfoDialog.kt index 9f210ead706f..66c9a72a7039 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/LocalNetworkSharingInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/LocalNetworkSharingInfoDialog.kt @@ -15,12 +15,12 @@ import net.mullvad.mullvadvpn.compose.component.textResource @Preview @Composable private fun PreviewLocalNetworkSharingInfoDialog() { - LocalNetworkSharingInfoDialog(EmptyDestinationsNavigator) + LocalNetworkSharingInfo(EmptyDestinationsNavigator) } @Destination(style = DestinationStyle.Dialog::class) @Composable -fun LocalNetworkSharingInfoDialog(navigator: DestinationsNavigator) { +fun LocalNetworkSharingInfo(navigator: DestinationsNavigator) { InfoDialog( message = stringResource(id = R.string.local_network_sharing_info), additionalInfo = diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MalwareInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MalwareInfoDialog.kt index 13e6c886328c..a013ec0bcba2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MalwareInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MalwareInfoDialog.kt @@ -14,12 +14,12 @@ import net.mullvad.mullvadvpn.R @Preview @Composable private fun PreviewMalwareInfoDialog() { - MalwareInfoDialog(EmptyDestinationsNavigator) + MalwareInfo(EmptyDestinationsNavigator) } @Destination(style = DestinationStyle.Dialog::class) @Composable -fun MalwareInfoDialog(navigator: DestinationsNavigator) { +fun MalwareInfo(navigator: DestinationsNavigator) { InfoDialog( message = stringResource(id = R.string.malware_info), onDismiss = dropUnlessResumed { navigator.navigateUp() } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MtuDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MtuDialog.kt index f90182640dbb..a52fea2c4851 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MtuDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/MtuDialog.kt @@ -38,14 +38,14 @@ import org.koin.androidx.compose.koinViewModel @Preview @Composable private fun PreviewMtuDialog() { - AppTheme { MtuDialog(EmptyResultBackNavigator()) } + AppTheme { Mtu(EmptyResultBackNavigator()) } } data class MtuNavArgs(val initialMtu: Mtu? = null) @Destination(style = DestinationStyle.Dialog::class, navArgs = MtuNavArgs::class) @Composable -fun MtuDialog(navigator: ResultBackNavigator) { +fun Mtu(navigator: ResultBackNavigator) { val viewModel = koinViewModel() val uiState by viewModel.uiState.collectAsStateWithLifecycle() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ObfuscationInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ObfuscationInfoDialog.kt index ba286e030270..e6096ca00d6f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ObfuscationInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ObfuscationInfoDialog.kt @@ -14,12 +14,12 @@ import net.mullvad.mullvadvpn.R @Preview @Composable private fun PreviewObfuscationInfoDialog() { - ObfuscationInfoDialog(EmptyDestinationsNavigator) + ObfuscationInfo(EmptyDestinationsNavigator) } @Destination(style = DestinationStyle.Dialog::class) @Composable -fun ObfuscationInfoDialog(navigator: DestinationsNavigator) { +fun ObfuscationInfo(navigator: DestinationsNavigator) { InfoDialog( message = stringResource(id = R.string.obfuscation_info), onDismiss = dropUnlessResumed { navigator.navigateUp() } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/QuantumResistanceInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/QuantumResistanceInfoDialog.kt index deaa8a118006..91ce85dbd326 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/QuantumResistanceInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/QuantumResistanceInfoDialog.kt @@ -14,12 +14,12 @@ import net.mullvad.mullvadvpn.R @Preview @Composable private fun PreviewQuantumResistanceInfoDialog() { - QuantumResistanceInfoDialog(EmptyDestinationsNavigator) + QuantumResistanceInfo(EmptyDestinationsNavigator) } @Destination(style = DestinationStyle.Dialog::class) @Composable -fun QuantumResistanceInfoDialog(navigator: DestinationsNavigator) { +fun QuantumResistanceInfo(navigator: DestinationsNavigator) { InfoDialog( message = stringResource(id = R.string.quantum_resistant_info_first_paragaph), additionalInfo = stringResource(id = R.string.quantum_resistant_info_second_paragaph), diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RemoveDeviceConfirmationDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RemoveDeviceConfirmationDialog.kt index c37bd2dbb00f..47d6a3cfccb4 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RemoveDeviceConfirmationDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/RemoveDeviceConfirmationDialog.kt @@ -37,12 +37,12 @@ import net.mullvad.mullvadvpn.lib.theme.Dimens private fun PreviewRemoveDeviceConfirmationDialog( @PreviewParameter(DevicePreviewParameterProvider::class) device: Device ) { - AppTheme { RemoveDeviceConfirmationDialog(EmptyResultBackNavigator(), device = device) } + AppTheme { RemoveDeviceConfirmation(EmptyResultBackNavigator(), device = device) } } @Destination(style = DestinationStyle.Dialog::class) @Composable -fun RemoveDeviceConfirmationDialog(navigator: ResultBackNavigator, device: Device) { +fun RemoveDeviceConfirmation(navigator: ResultBackNavigator, device: Device) { AlertDialog( onDismissRequest = dropUnlessResumed { navigator.navigateBack() }, icon = { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ReportProblemNoEmailDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ReportProblemNoEmailDialog.kt index 344ea1ca9f86..43072eb18c7a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ReportProblemNoEmailDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ReportProblemNoEmailDialog.kt @@ -27,12 +27,12 @@ import net.mullvad.mullvadvpn.lib.theme.Dimens @Preview @Composable private fun PreviewReportProblemNoEmailDialog() { - AppTheme { ReportProblemNoEmailDialog(EmptyResultBackNavigator()) } + AppTheme { ReportProblemNoEmail(EmptyResultBackNavigator()) } } @Destination(style = DestinationStyle.Dialog::class) @Composable -fun ReportProblemNoEmailDialog(resultBackNavigator: ResultBackNavigator) { +fun ReportProblemNoEmail(resultBackNavigator: ResultBackNavigator) { AlertDialog( onDismissRequest = dropUnlessResumed { resultBackNavigator.navigateBack() }, icon = { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ServerIpOverridesInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ServerIpOverridesInfoDialog.kt index 777ac5d195aa..3fe00ce818fd 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ServerIpOverridesInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/ServerIpOverridesInfoDialog.kt @@ -14,12 +14,12 @@ import net.mullvad.mullvadvpn.R @Preview @Composable private fun PreviewServerIpOverridesInfoDialog() { - ServerIpOverridesInfoDialog(EmptyDestinationsNavigator) + ServerIpOverridesInfo(EmptyDestinationsNavigator) } @Destination(style = DestinationStyle.Dialog::class) @Composable -fun ServerIpOverridesInfoDialog(navigator: DestinationsNavigator) { +fun ServerIpOverridesInfo(navigator: DestinationsNavigator) { InfoDialog( message = buildString { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/UdpOverTcpPortInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/UdpOverTcpPortInfoDialog.kt index a49380b8eeb0..ea8beaa8fc22 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/UdpOverTcpPortInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/UdpOverTcpPortInfoDialog.kt @@ -15,12 +15,12 @@ import net.mullvad.mullvadvpn.lib.theme.AppTheme @Preview @Composable private fun PreviewUdpOverTcpPortInfoDialog() { - AppTheme { UdpOverTcpPortInfoDialog(EmptyDestinationsNavigator) } + AppTheme { UdpOverTcpPortInfo(EmptyDestinationsNavigator) } } @Destination(style = DestinationStyle.Dialog::class) @Composable -fun UdpOverTcpPortInfoDialog(navigator: DestinationsNavigator) { +fun UdpOverTcpPortInfo(navigator: DestinationsNavigator) { InfoDialog( message = stringResource(id = R.string.udp_over_tcp_port_info), onDismiss = dropUnlessResumed { navigator.navigateUp() } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardCustomPortDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardCustomPortDialog.kt index ace0be15c0d6..54b0807d8f56 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardCustomPortDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardCustomPortDialog.kt @@ -39,7 +39,7 @@ import net.mullvad.mullvadvpn.util.inAnyOf @Composable private fun PreviewWireguardCustomPortDialog() { AppTheme { - WireguardCustomPortDialog( + WireguardCustomPort( WireguardCustomPortNavArgs( customPort = null, allowedPortRanges = listOf(PortRange(10..10), PortRange(40..50)), @@ -57,7 +57,7 @@ data class WireguardCustomPortNavArgs( @Destination(style = DestinationStyle.Dialog::class) @Composable -fun WireguardCustomPortDialog( +fun WireguardCustomPort( navArg: WireguardCustomPortNavArgs, backNavigator: ResultBackNavigator, ) { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardPortInfoDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardPortInfoDialog.kt index 0484c995fbf4..d5a73c74e2c1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardPortInfoDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/WireguardPortInfoDialog.kt @@ -20,7 +20,7 @@ import net.mullvad.mullvadvpn.util.asString @Composable private fun PreviewWireguardPortInfoDialog() { AppTheme { - WireguardPortInfoDialog( + WireguardPortInfo( EmptyDestinationsNavigator, argument = WireguardPortInfoDialogArgument(listOf(PortRange(1..2))) ) @@ -31,10 +31,7 @@ private fun PreviewWireguardPortInfoDialog() { @Destination(style = DestinationStyle.Dialog::class) @Composable -fun WireguardPortInfoDialog( - navigator: DestinationsNavigator, - argument: WireguardPortInfoDialogArgument -) { +fun WireguardPortInfo(navigator: DestinationsNavigator, argument: WireguardPortInfoDialogArgument) { InfoDialog( message = stringResource(id = R.string.wireguard_port_info_description), additionalInfo = diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/VerificationPendingDialog.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/VerificationPendingDialog.kt index 6af4a328bfde..739bacbf1427 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/VerificationPendingDialog.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/dialog/payment/VerificationPendingDialog.kt @@ -25,7 +25,7 @@ private fun PreviewVerificationPendingDialog() { @Destination(style = DestinationStyle.Dialog::class) @Composable -fun VerificationPendingDialog(navigator: DestinationsNavigator) { +fun VerificationPending(navigator: DestinationsNavigator) { VerificationPendingDialog(onClose = dropUnlessResumed { navigator.navigateUp() }) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt index 7e4ee70c640f..8329c11ec91a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/AccountScreen.kt @@ -28,11 +28,11 @@ import androidx.lifecycle.compose.dropUnlessResumed import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.generated.NavGraphs -import com.ramcosta.composedestinations.generated.destinations.DeviceNameInfoDialogDestination +import com.ramcosta.composedestinations.generated.destinations.DeviceNameInfoDestination import com.ramcosta.composedestinations.generated.destinations.LoginDestination import com.ramcosta.composedestinations.generated.destinations.PaymentDestination import com.ramcosta.composedestinations.generated.destinations.RedeemVoucherDestination -import com.ramcosta.composedestinations.generated.destinations.VerificationPendingDialogDestination +import com.ramcosta.composedestinations.generated.destinations.VerificationPendingDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.result.NavResult import com.ramcosta.composedestinations.result.ResultRecipient @@ -136,12 +136,11 @@ fun Account( }, onCopyAccountNumber = vm::onCopyAccountNumber, onBackClick = dropUnlessResumed { navigator.navigateUp() }, - navigateToDeviceInfo = - dropUnlessResumed { navigator.navigate(DeviceNameInfoDialogDestination) }, + navigateToDeviceInfo = dropUnlessResumed { navigator.navigate(DeviceNameInfoDestination) }, onPurchaseBillingProductClick = dropUnlessResumed { productId -> navigator.navigate(PaymentDestination(productId)) }, navigateToVerificationPendingDialog = - dropUnlessResumed { navigator.navigate(VerificationPendingDialogDestination) } + dropUnlessResumed { navigator.navigate(VerificationPendingDestination) } ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessListScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessListScreen.kt index b1a7334a1d5f..247e009f59a1 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessListScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ApiAccessListScreen.kt @@ -22,7 +22,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.generated.destinations.ApiAccessMethodDetailsDestination -import com.ramcosta.composedestinations.generated.destinations.ApiAccessMethodInfoDialogDestination +import com.ramcosta.composedestinations.generated.destinations.ApiAccessMethodInfoDestination import com.ramcosta.composedestinations.generated.destinations.EditApiAccessMethodDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import net.mullvad.mullvadvpn.R @@ -67,7 +67,7 @@ fun ApiAccessList(navigator: DestinationsNavigator) { navigator.navigate(ApiAccessMethodDetailsDestination(it.id)) { launchSingleTop = true } }, onApiAccessInfoClick = { - navigator.navigate(ApiAccessMethodInfoDialogDestination) { launchSingleTop = true } + navigator.navigate(ApiAccessMethodInfoDestination) { launchSingleTop = true } }, onBackClick = navigator::navigateUp ) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListLocationsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListLocationsScreen.kt index 9350b8776e8a..19b548153a6b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListLocationsScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/CustomListLocationsScreen.kt @@ -29,7 +29,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.dropUnlessResumed import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.RootGraph -import com.ramcosta.composedestinations.generated.destinations.DiscardChangesDialogDestination +import com.ramcosta.composedestinations.generated.destinations.DiscardChangesDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.result.NavResult import com.ramcosta.composedestinations.result.ResultBackNavigator @@ -80,7 +80,7 @@ data class CustomListLocationsNavArgs( fun CustomListLocations( navigator: DestinationsNavigator, backNavigator: ResultBackNavigator, - discardChangesResultRecipient: ResultRecipient, + discardChangesResultRecipient: ResultRecipient, ) { val customListsViewModel = koinViewModel() @@ -122,7 +122,7 @@ fun CustomListLocations( onBackClick = dropUnlessResumed { if (state.hasUnsavedChanges) { - navigator.navigate(DiscardChangesDialogDestination) + navigator.navigate(DiscardChangesDestination) } else { backNavigator.navigateBack() } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceListScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceListScreen.kt index 74d4714d6de9..67f2dde6d4c3 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceListScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/DeviceListScreen.kt @@ -35,7 +35,7 @@ import androidx.lifecycle.compose.dropUnlessResumed import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.generated.destinations.LoginDestination -import com.ramcosta.composedestinations.generated.destinations.RemoveDeviceConfirmationDialogDestination +import com.ramcosta.composedestinations.generated.destinations.RemoveDeviceConfirmationDestination import com.ramcosta.composedestinations.generated.destinations.SettingsDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.result.NavResult @@ -108,8 +108,7 @@ data class DeviceListNavArgs(val accountNumber: AccountNumber) @Composable fun DeviceList( navigator: DestinationsNavigator, - confirmRemoveResultRecipient: - ResultRecipient + confirmRemoveResultRecipient: ResultRecipient ) { val viewModel = koinViewModel() val state by viewModel.uiState.collectAsStateWithLifecycle() @@ -156,7 +155,7 @@ fun DeviceList( onTryAgainClicked = viewModel::fetchDevices, navigateToRemoveDeviceConfirmationDialog = dropUnlessResumed { - navigator.navigate(RemoveDeviceConfirmationDialogDestination(it)) + navigator.navigate(RemoveDeviceConfirmationDestination(it)) } ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt index 84162e501eb7..8e5104ca755d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/EditApiAccessMethodScreen.kt @@ -33,7 +33,7 @@ import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.RootGraph -import com.ramcosta.composedestinations.generated.destinations.DiscardChangesDialogDestination +import com.ramcosta.composedestinations.generated.destinations.DiscardChangesDestination import com.ramcosta.composedestinations.generated.destinations.SaveApiAccessMethodDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.result.ResultBackNavigator @@ -93,7 +93,7 @@ fun EditApiAccessMethod( navigator: DestinationsNavigator, backNavigator: ResultBackNavigator, saveApiAccessMethodResultRecipient: ResultRecipient, - discardChangesResultRecipient: ResultRecipient, + discardChangesResultRecipient: ResultRecipient, ) { val viewModel = koinViewModel() @@ -179,7 +179,7 @@ fun EditApiAccessMethod( onAddMethod = viewModel::trySave, onNavigateBack = { if (state.hasChanges()) { - navigator.navigate(DiscardChangesDialogDestination) { launchSingleTop = true } + navigator.navigate(DiscardChangesDestination) { launchSingleTop = true } } else { navigator.navigateUp() } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt index b9a551731c99..3c3fe9e05bc0 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt @@ -70,7 +70,7 @@ private fun PreviewFilterScreen() { @Destination(style = SlideInFromRightTransition::class) @Composable -fun FilterScreen(navigator: DestinationsNavigator) { +fun Filter(navigator: DestinationsNavigator) { val viewModel = koinViewModel() val state by viewModel.uiState.collectAsStateWithLifecycle() diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/MullvadApp.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/MullvadApp.kt index 89d96f0189f6..c73e6601e560 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/MullvadApp.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/MullvadApp.kt @@ -13,7 +13,7 @@ import com.ramcosta.composedestinations.DestinationsNavHost import com.ramcosta.composedestinations.generated.NavGraphs import com.ramcosta.composedestinations.generated.destinations.ChangelogDestination import com.ramcosta.composedestinations.generated.destinations.ConnectDestination -import com.ramcosta.composedestinations.generated.destinations.NoDaemonScreenDestination +import com.ramcosta.composedestinations.generated.destinations.NoDaemonDestination import com.ramcosta.composedestinations.generated.destinations.OutOfTimeDestination import com.ramcosta.composedestinations.rememberNavHostEngine import com.ramcosta.composedestinations.utils.destination @@ -55,8 +55,8 @@ fun MullvadApp() { LaunchedEffectCollect(serviceVm.uiSideEffect) { when (it) { DaemonScreenEvent.Show -> - navController.navigate(NoDaemonScreenDestination) { launchSingleTop = true } - DaemonScreenEvent.Remove -> navController.popBackStack(NoDaemonScreenDestination, true) + navController.navigate(NoDaemonDestination) { launchSingleTop = true } + DaemonScreenEvent.Remove -> navController.popBackStack(NoDaemonDestination, true) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/NoDaemonScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/NoDaemonScreen.kt index 863cb632586a..f86edb4e5401 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/NoDaemonScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/NoDaemonScreen.kt @@ -44,7 +44,7 @@ private fun PreviewNoDaemonScreen() { // Set this as the start destination of the default nav graph @Destination(style = DefaultTransition::class) @Composable -fun NoDaemonScreen(navigator: DestinationsNavigator) { +fun NoDaemon(navigator: DestinationsNavigator) { NoDaemonScreen(dropUnlessResumed { navigator.navigate(SettingsDestination) }) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/OutOfTimeScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/OutOfTimeScreen.kt index b1a64ed6c2b0..ebdb0fe225a5 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/OutOfTimeScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/OutOfTimeScreen.kt @@ -32,7 +32,7 @@ import com.ramcosta.composedestinations.generated.destinations.ConnectDestinatio import com.ramcosta.composedestinations.generated.destinations.PaymentDestination import com.ramcosta.composedestinations.generated.destinations.RedeemVoucherDestination import com.ramcosta.composedestinations.generated.destinations.SettingsDestination -import com.ramcosta.composedestinations.generated.destinations.VerificationPendingDialogDestination +import com.ramcosta.composedestinations.generated.destinations.VerificationPendingDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.result.NavResult import com.ramcosta.composedestinations.result.ResultRecipient @@ -159,7 +159,7 @@ fun OutOfTime( onPurchaseBillingProductClick = dropUnlessResumed { productId -> navigator.navigate(PaymentDestination(productId)) }, navigateToVerificationPendingDialog = - dropUnlessResumed { navigator.navigate(VerificationPendingDialogDestination) } + dropUnlessResumed { navigator.navigate(VerificationPendingDestination) } ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ReportProblemScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ReportProblemScreen.kt index 82d0ad6a6b07..19aa05b7f953 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ReportProblemScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ReportProblemScreen.kt @@ -30,7 +30,7 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.dropUnlessResumed import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.RootGraph -import com.ramcosta.composedestinations.generated.destinations.ReportProblemNoEmailDialogDestination +import com.ramcosta.composedestinations.generated.destinations.ReportProblemNoEmailDestination import com.ramcosta.composedestinations.generated.destinations.ViewLogsDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.result.NavResult @@ -99,7 +99,7 @@ private fun PreviewReportProblemErrorScreen() { @Composable fun ReportProblem( navigator: DestinationsNavigator, - noEmailConfirmResultRecipent: ResultRecipient + noEmailConfirmResultRecipent: ResultRecipient ) { val vm = koinViewModel() val state by vm.uiState.collectAsStateWithLifecycle() @@ -107,7 +107,7 @@ fun ReportProblem( LaunchedEffectCollect(vm.uiSideEffect) { when (it) { is ReportProblemSideEffect.ShowConfirmNoEmail -> - navigator.navigate(ReportProblemNoEmailDialogDestination) + navigator.navigate(ReportProblemNoEmailDestination) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt index 27d9e55fd78a..555983d51d9a 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/SelectLocationScreen.kt @@ -54,7 +54,7 @@ import com.ramcosta.composedestinations.generated.destinations.CustomListLocatio import com.ramcosta.composedestinations.generated.destinations.CustomListsDestination import com.ramcosta.composedestinations.generated.destinations.DeleteCustomListDestination import com.ramcosta.composedestinations.generated.destinations.EditCustomListNameDestination -import com.ramcosta.composedestinations.generated.destinations.FilterScreenDestination +import com.ramcosta.composedestinations.generated.destinations.FilterDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.result.NavResult import com.ramcosta.composedestinations.result.ResultBackNavigator @@ -204,7 +204,7 @@ fun SelectLocation( onSelectRelay = vm::selectRelay, onSearchTermInput = vm::onSearchTermInput, onBackClick = dropUnlessResumed { backNavigator.navigateBack() }, - onFilterClick = dropUnlessResumed { navigator.navigate(FilterScreenDestination) }, + onFilterClick = dropUnlessResumed { navigator.navigate(FilterDestination) }, onCreateCustomList = dropUnlessResumed { relayItem -> navigator.navigate( diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ServerIpOverridesScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ServerIpOverridesScreen.kt index a067c1afb12b..c323fcce3f6c 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ServerIpOverridesScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/ServerIpOverridesScreen.kt @@ -45,7 +45,7 @@ import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.generated.destinations.ImportOverridesByTextDestination import com.ramcosta.composedestinations.generated.destinations.ResetServerIpOverridesConfirmationDestination -import com.ramcosta.composedestinations.generated.destinations.ServerIpOverridesInfoDialogDestination +import com.ramcosta.composedestinations.generated.destinations.ServerIpOverridesInfoDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.result.ResultRecipient import kotlinx.coroutines.launch @@ -146,8 +146,7 @@ fun ServerIpOverrides( ServerIpOverridesScreen( state, onBackClick = dropUnlessResumed { navigator.navigateUp() }, - onInfoClick = - dropUnlessResumed { navigator.navigate(ServerIpOverridesInfoDialogDestination) }, + onInfoClick = dropUnlessResumed { navigator.navigate(ServerIpOverridesInfoDestination) }, onResetOverridesClick = dropUnlessResumed { navigator.navigate(ResetServerIpOverridesConfirmationDestination) }, onImportByFile = dropUnlessResumed { openFileLauncher.launch("application/json") }, 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 bed832b55438..d92694afc25a 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 @@ -35,18 +35,18 @@ import androidx.lifecycle.compose.dropUnlessResumed import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.generated.destinations.AutoConnectAndLockdownModeDestination -import com.ramcosta.composedestinations.generated.destinations.ContentBlockersInfoDialogDestination -import com.ramcosta.composedestinations.generated.destinations.CustomDnsInfoDialogDestination -import com.ramcosta.composedestinations.generated.destinations.DnsDialogDestination -import com.ramcosta.composedestinations.generated.destinations.LocalNetworkSharingInfoDialogDestination -import com.ramcosta.composedestinations.generated.destinations.MalwareInfoDialogDestination -import com.ramcosta.composedestinations.generated.destinations.MtuDialogDestination -import com.ramcosta.composedestinations.generated.destinations.ObfuscationInfoDialogDestination -import com.ramcosta.composedestinations.generated.destinations.QuantumResistanceInfoDialogDestination +import com.ramcosta.composedestinations.generated.destinations.ContentBlockersInfoDestination +import com.ramcosta.composedestinations.generated.destinations.CustomDnsInfoDestination +import com.ramcosta.composedestinations.generated.destinations.DnsDestination +import com.ramcosta.composedestinations.generated.destinations.LocalNetworkSharingInfoDestination +import com.ramcosta.composedestinations.generated.destinations.MalwareInfoDestination +import com.ramcosta.composedestinations.generated.destinations.MtuDestination +import com.ramcosta.composedestinations.generated.destinations.ObfuscationInfoDestination +import com.ramcosta.composedestinations.generated.destinations.QuantumResistanceInfoDestination import com.ramcosta.composedestinations.generated.destinations.ServerIpOverridesDestination -import com.ramcosta.composedestinations.generated.destinations.UdpOverTcpPortInfoDialogDestination -import com.ramcosta.composedestinations.generated.destinations.WireguardCustomPortDialogDestination -import com.ramcosta.composedestinations.generated.destinations.WireguardPortInfoDialogDestination +import com.ramcosta.composedestinations.generated.destinations.UdpOverTcpPortInfoDestination +import com.ramcosta.composedestinations.generated.destinations.WireguardCustomPortDestination +import com.ramcosta.composedestinations.generated.destinations.WireguardPortInfoDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.result.ResultRecipient import kotlinx.coroutines.launch @@ -145,9 +145,9 @@ private fun PreviewVpnSettings() { @Suppress("LongMethod") fun VpnSettings( navigator: DestinationsNavigator, - dnsDialogResult: ResultRecipient, - customWgPortResult: ResultRecipient, - mtuDialogResult: ResultRecipient, + dnsDialogResult: ResultRecipient, + customWgPortResult: ResultRecipient, + mtuDialogResult: ResultRecipient, ) { val vm = koinViewModel() val state by vm.uiState.collectAsStateWithLifecycle() @@ -184,7 +184,7 @@ fun VpnSettings( is VpnSettingsSideEffect.ShowToast -> launch { snackbarHostState.showSnackbarImmediately(message = it.message(context)) } VpnSettingsSideEffect.NavigateToDnsDialog -> - navigator.navigate(DnsDialogDestination(null, null)) { launchSingleTop = true } + navigator.navigate(DnsDestination(null, null)) { launchSingleTop = true } } } @@ -203,29 +203,28 @@ fun VpnSettings( state = state, snackbarHostState = snackbarHostState, navigateToContentBlockersInfo = - dropUnlessResumed { navigator.navigate(ContentBlockersInfoDialogDestination) }, + dropUnlessResumed { navigator.navigate(ContentBlockersInfoDestination) }, navigateToAutoConnectScreen = dropUnlessResumed { navigator.navigate(AutoConnectAndLockdownModeDestination) }, navigateToCustomDnsInfo = - dropUnlessResumed { navigator.navigate(CustomDnsInfoDialogDestination) }, - navigateToMalwareInfo = - dropUnlessResumed { navigator.navigate(MalwareInfoDialogDestination) }, + dropUnlessResumed { navigator.navigate(CustomDnsInfoDestination) }, + navigateToMalwareInfo = dropUnlessResumed { navigator.navigate(MalwareInfoDestination) }, navigateToObfuscationInfo = - dropUnlessResumed { navigator.navigate(ObfuscationInfoDialogDestination) }, + dropUnlessResumed { navigator.navigate(ObfuscationInfoDestination) }, navigateToQuantumResistanceInfo = - dropUnlessResumed { navigator.navigate(QuantumResistanceInfoDialogDestination) }, + dropUnlessResumed { navigator.navigate(QuantumResistanceInfoDestination) }, navigateUdp2TcpInfo = - dropUnlessResumed { navigator.navigate(UdpOverTcpPortInfoDialogDestination) }, + dropUnlessResumed { navigator.navigate(UdpOverTcpPortInfoDestination) }, navigateToWireguardPortInfo = dropUnlessResumed { availablePortRanges: List -> navigator.navigate( - WireguardPortInfoDialogDestination( + WireguardPortInfoDestination( WireguardPortInfoDialogArgument(availablePortRanges) ), ) }, navigateToLocalNetworkSharingInfo = - dropUnlessResumed { navigator.navigate(LocalNetworkSharingInfoDialogDestination) }, + dropUnlessResumed { navigator.navigate(LocalNetworkSharingInfoDestination) }, navigateToServerIpOverrides = dropUnlessResumed { navigator.navigate(ServerIpOverridesDestination) }, onToggleBlockTrackers = vm::onToggleBlockTrackers, @@ -237,10 +236,10 @@ fun VpnSettings( onToggleBlockGambling = vm::onToggleBlockGambling, onToggleBlockSocialMedia = vm::onToggleBlockSocialMedia, navigateToMtuDialog = - dropUnlessResumed { mtu: Mtu? -> navigator.navigate(MtuDialogDestination(mtu)) }, + dropUnlessResumed { mtu: Mtu? -> navigator.navigate(MtuDestination(mtu)) }, navigateToDns = dropUnlessResumed { index: Int?, address: String? -> - navigator.navigate(DnsDialogDestination(index, address)) + navigator.navigate(DnsDestination(index, address)) }, navigateToWireguardPortDialog = dropUnlessResumed { @@ -249,7 +248,7 @@ fun VpnSettings( state.customWireguardPort?.toPortOrNull(), state.availablePortRanges ) - navigator.navigate(WireguardCustomPortDialogDestination(args)) + navigator.navigate(WireguardCustomPortDestination(args)) }, onToggleDnsClick = vm::onToggleCustomDns, onBackClick = dropUnlessResumed { navigator.navigateUp() }, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreen.kt index 0c9e1244f3d1..34aee5d0bb4b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/WelcomeScreen.kt @@ -33,11 +33,11 @@ import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.generated.NavGraphs import com.ramcosta.composedestinations.generated.destinations.AccountDestination import com.ramcosta.composedestinations.generated.destinations.ConnectDestination -import com.ramcosta.composedestinations.generated.destinations.DeviceNameInfoDialogDestination +import com.ramcosta.composedestinations.generated.destinations.DeviceNameInfoDestination import com.ramcosta.composedestinations.generated.destinations.PaymentDestination import com.ramcosta.composedestinations.generated.destinations.RedeemVoucherDestination import com.ramcosta.composedestinations.generated.destinations.SettingsDestination -import com.ramcosta.composedestinations.generated.destinations.VerificationPendingDialogDestination +import com.ramcosta.composedestinations.generated.destinations.VerificationPendingDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.result.NavResult import com.ramcosta.composedestinations.result.ResultRecipient @@ -151,12 +151,12 @@ fun Welcome( onSettingsClick = dropUnlessResumed { navigator.navigate(SettingsDestination) }, onAccountClick = dropUnlessResumed { navigator.navigate(AccountDestination) }, navigateToDeviceInfoDialog = - dropUnlessResumed { navigator.navigate(DeviceNameInfoDialogDestination) }, + dropUnlessResumed { navigator.navigate(DeviceNameInfoDestination) }, onPurchaseBillingProductClick = dropUnlessResumed { productId -> navigator.navigate(PaymentDestination(productId)) }, onDisconnectClick = vm::onDisconnectClick, navigateToVerificationPendingDialog = - dropUnlessResumed { navigator.navigate(VerificationPendingDialogDestination) } + dropUnlessResumed { navigator.navigate(VerificationPendingDestination) } ) } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SettingsTransition.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SettingsTransition.kt index 1ec403428112..d9c9bd2f5882 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SettingsTransition.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SettingsTransition.kt @@ -11,7 +11,7 @@ import androidx.compose.animation.slideInVertically import androidx.compose.animation.slideOutHorizontally import androidx.compose.animation.slideOutVertically import androidx.navigation.NavBackStackEntry -import com.ramcosta.composedestinations.generated.destinations.NoDaemonScreenDestination +import com.ramcosta.composedestinations.generated.destinations.NoDaemonDestination import com.ramcosta.composedestinations.spec.DestinationStyle import com.ramcosta.composedestinations.utils.destination import net.mullvad.mullvadvpn.constant.SCREEN_ANIMATION_TIME_MILLIS @@ -29,7 +29,7 @@ object SettingsTransition : DestinationStyle.Animated() { AnimatedContentTransitionScope.() -> ExitTransition = { when (targetState.destination()) { - NoDaemonScreenDestination -> fadeOut(snap(SCREEN_ANIMATION_TIME_MILLIS)) + NoDaemonDestination -> fadeOut(snap(SCREEN_ANIMATION_TIME_MILLIS)) else -> slideOutHorizontally(targetOffsetX = { -it.withHorizontalScalingFactor() }) } } @@ -38,7 +38,7 @@ object SettingsTransition : DestinationStyle.Animated() { AnimatedContentTransitionScope.() -> EnterTransition = { when (initialState.destination()) { - NoDaemonScreenDestination -> fadeIn(snap(0)) + NoDaemonDestination -> fadeIn(snap(0)) else -> slideInHorizontally(initialOffsetX = { -it.withHorizontalScalingFactor() }) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SlideInFromBottomTransition.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SlideInFromBottomTransition.kt index 14dde875d7e1..7e796e5e01e2 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SlideInFromBottomTransition.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SlideInFromBottomTransition.kt @@ -11,7 +11,7 @@ import androidx.compose.animation.slideInVertically import androidx.compose.animation.slideOutHorizontally import androidx.compose.animation.slideOutVertically import androidx.navigation.NavBackStackEntry -import com.ramcosta.composedestinations.generated.destinations.NoDaemonScreenDestination +import com.ramcosta.composedestinations.generated.destinations.NoDaemonDestination import com.ramcosta.composedestinations.spec.DestinationStyle import com.ramcosta.composedestinations.utils.destination import net.mullvad.mullvadvpn.constant.SCREEN_ANIMATION_TIME_MILLIS @@ -28,7 +28,7 @@ object SlideInFromBottomTransition : DestinationStyle.Animated() { AnimatedContentTransitionScope.() -> ExitTransition? = { when (targetState.destination()) { - NoDaemonScreenDestination -> fadeOut(snap(SCREEN_ANIMATION_TIME_MILLIS)) + NoDaemonDestination -> fadeOut(snap(SCREEN_ANIMATION_TIME_MILLIS)) else -> fadeOut() } } @@ -37,7 +37,7 @@ object SlideInFromBottomTransition : DestinationStyle.Animated() { AnimatedContentTransitionScope.() -> EnterTransition = { when (initialState.destination()) { - NoDaemonScreenDestination -> fadeIn(snap(0)) + NoDaemonDestination -> fadeIn(snap(0)) else -> fadeIn() } } @@ -62,7 +62,7 @@ object SelectLocationTransition : DestinationStyle.Animated() { AnimatedContentTransitionScope.() -> ExitTransition = { when (targetState.destination()) { - NoDaemonScreenDestination -> fadeOut(snap(SCREEN_ANIMATION_TIME_MILLIS)) + NoDaemonDestination -> fadeOut(snap(SCREEN_ANIMATION_TIME_MILLIS)) else -> slideOutHorizontally { -it.withHorizontalScalingFactor() } } } @@ -71,7 +71,7 @@ object SelectLocationTransition : DestinationStyle.Animated() { AnimatedContentTransitionScope.() -> EnterTransition = { when (initialState.destination()) { - NoDaemonScreenDestination -> fadeIn(snap(0)) + NoDaemonDestination -> fadeIn(snap(0)) else -> slideInHorizontally { -it.withHorizontalScalingFactor() } } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SlideInFromRightLeafTransition.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SlideInFromRightLeafTransition.kt index 670877dfaa73..c27ec162549e 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SlideInFromRightLeafTransition.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SlideInFromRightLeafTransition.kt @@ -9,7 +9,7 @@ import androidx.compose.animation.fadeOut import androidx.compose.animation.slideInHorizontally import androidx.compose.animation.slideOutHorizontally import androidx.navigation.NavBackStackEntry -import com.ramcosta.composedestinations.generated.destinations.NoDaemonScreenDestination +import com.ramcosta.composedestinations.generated.destinations.NoDaemonDestination import com.ramcosta.composedestinations.spec.DestinationStyle import com.ramcosta.composedestinations.utils.destination import net.mullvad.mullvadvpn.constant.SCREEN_ANIMATION_TIME_MILLIS @@ -25,7 +25,7 @@ object SlideInFromRightLeafTransition : DestinationStyle.Animated() { AnimatedContentTransitionScope.() -> ExitTransition = { when (targetState.destination()) { - NoDaemonScreenDestination -> fadeOut(snap(SCREEN_ANIMATION_TIME_MILLIS)) + NoDaemonDestination -> fadeOut(snap(SCREEN_ANIMATION_TIME_MILLIS)) else -> fadeOut() } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SlideInFromRightTransition.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SlideInFromRightTransition.kt index 6ff49210f6aa..fe785e1f6a4f 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SlideInFromRightTransition.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/transitions/SlideInFromRightTransition.kt @@ -9,7 +9,7 @@ import androidx.compose.animation.fadeOut import androidx.compose.animation.slideInHorizontally import androidx.compose.animation.slideOutHorizontally import androidx.navigation.NavBackStackEntry -import com.ramcosta.composedestinations.generated.destinations.NoDaemonScreenDestination +import com.ramcosta.composedestinations.generated.destinations.NoDaemonDestination import com.ramcosta.composedestinations.spec.DestinationStyle import com.ramcosta.composedestinations.utils.destination import net.mullvad.mullvadvpn.constant.SCREEN_ANIMATION_TIME_MILLIS @@ -26,7 +26,7 @@ object SlideInFromRightTransition : DestinationStyle.Animated() { AnimatedContentTransitionScope.() -> ExitTransition = { when (targetState.destination()) { - NoDaemonScreenDestination -> fadeOut(snap(SCREEN_ANIMATION_TIME_MILLIS)) + NoDaemonDestination -> fadeOut(snap(SCREEN_ANIMATION_TIME_MILLIS)) else -> slideOutHorizontally(targetOffsetX = { -it.withHorizontalScalingFactor() }) } } @@ -35,7 +35,7 @@ object SlideInFromRightTransition : DestinationStyle.Animated() { AnimatedContentTransitionScope.() -> EnterTransition = { when (initialState.destination()) { - NoDaemonScreenDestination -> fadeIn(snap(0)) + NoDaemonDestination -> fadeIn(snap(0)) else -> slideInHorizontally(initialOffsetX = { -it.withHorizontalScalingFactor() }) } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt index 14d154498d84..f9e2dd27c2f8 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/DnsDialogViewModel.kt @@ -6,7 +6,7 @@ import androidx.lifecycle.viewModelScope import arrow.core.Either import arrow.core.raise.either import arrow.core.raise.ensure -import com.ramcosta.composedestinations.generated.destinations.DnsDialogDestination +import com.ramcosta.composedestinations.generated.destinations.DnsDestination import java.net.InetAddress import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers @@ -53,7 +53,7 @@ class DnsDialogViewModel( savedStateHandle: SavedStateHandle, private val dispatcher: CoroutineDispatcher = Dispatchers.IO, ) : ViewModel() { - private val navArgs = DnsDialogDestination.argsFrom(savedStateHandle) + private val navArgs = DnsDestination.argsFrom(savedStateHandle) private val currentIndex = MutableStateFlow(navArgs.index) private val _ipAddressInput = MutableStateFlow(navArgs.initialValue ?: EMPTY_STRING) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/MtuDialogViewModel.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/MtuDialogViewModel.kt index fa29558f13e4..04484e5dbbd0 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/MtuDialogViewModel.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/viewmodel/MtuDialogViewModel.kt @@ -3,7 +3,7 @@ package net.mullvad.mullvadvpn.viewmodel import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.ramcosta.composedestinations.generated.destinations.MtuDialogDestination +import com.ramcosta.composedestinations.generated.destinations.MtuDestination import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.channels.Channel @@ -22,7 +22,7 @@ class MtuDialogViewModel( savedStateHandle: SavedStateHandle, private val dispatcher: CoroutineDispatcher = Dispatchers.IO ) : ViewModel() { - private val navArgs = MtuDialogDestination.argsFrom(savedStateHandle) + private val navArgs = MtuDestination.argsFrom(savedStateHandle) private val _mtuInput = MutableStateFlow(navArgs.initialMtu?.value?.toString() ?: "") private val _isValidMtu = MutableStateFlow(true) From 7f616dd1b42792138c36d63a6c0e0ff816ef9b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Mon, 15 Jul 2024 12:40:57 +0200 Subject: [PATCH 5/5] Update baseline --- android/config/baseline.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/android/config/baseline.xml b/android/config/baseline.xml index 36bd121a1266..9e87be5c2586 100644 --- a/android/config/baseline.xml +++ b/android/config/baseline.xml @@ -5,10 +5,9 @@ CyclomaticComplexMethod:MockApiDispatcher.kt$MockApiDispatcher$override fun dispatch(request: RecordedRequest): MockResponse EmptyFunctionBlock:AccountTestRule.kt$AccountTestRule${} EmptyKtFile:build.gradle.kts$.build.gradle.kts - LargeClass:ConnectScreenTest.kt$ConnectScreenTest LongMethod:ApiAccessMethodDetailsScreen.kt$@Destination<RootGraph>( style = SlideInFromRightTransition::class, navArgs = ApiAccessMethodDetailsNavArgs::class ) @Composable fun ApiAccessMethodDetails( navigator: DestinationsNavigator, confirmDeleteListResultRecipient: ResultRecipient<DeleteApiAccessMethodConfirmationDestination, Boolean> ) LongMethod:ConnectionButton.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable private fun ConnectionButton( text: String, mainClick: () -> Unit, reconnectClick: () -> Unit, isReconnectButtonEnabled: Boolean, containerColor: Color, contentColor: Color, modifier: Modifier = Modifier, reconnectButtonTestTag: String = "" ) - LongMethod:EditApiAccessMethodScreen.kt$@Destination<RootGraph>( style = SlideInFromRightTransition::class, navArgs = EditApiAccessMethodNavArgs::class ) @Composable fun EditApiAccessMethod( navigator: DestinationsNavigator, backNavigator: ResultBackNavigator<Boolean>, saveApiAccessMethodResultRecipient: ResultRecipient<SaveApiAccessMethodDestination, Boolean>, discardChangesResultRecipient: ResultRecipient<DiscardChangesDialogDestination, Boolean>, ) + LongMethod:EditApiAccessMethodScreen.kt$@Destination<RootGraph>( style = SlideInFromRightTransition::class, navArgs = EditApiAccessMethodNavArgs::class ) @Composable fun EditApiAccessMethod( navigator: DestinationsNavigator, backNavigator: ResultBackNavigator<Boolean>, saveApiAccessMethodResultRecipient: ResultRecipient<SaveApiAccessMethodDestination, Boolean>, discardChangesResultRecipient: ResultRecipient<DiscardChangesDestination, Boolean>, ) LongMethod:NotificationBanner.kt$@Composable private fun Notification(notificationBannerData: NotificationData) MagicNumber:Chevron.kt$100 MagicNumber:Chevron.kt$270f