From 4196a543b2ad07df5ea4488162a9c0c0adc921ce Mon Sep 17 00:00:00 2001 From: Zane Schepke Date: Tue, 31 Dec 2024 19:13:15 -0500 Subject: [PATCH] fix: location disclosure screen navigation bug --- .../ui/screens/settings/SettingsScreen.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/settings/SettingsScreen.kt b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/settings/SettingsScreen.kt index f3852fb..2ed40e6 100644 --- a/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/settings/SettingsScreen.kt +++ b/app/src/main/java/com/zaneschepke/wireguardautotunnel/ui/screens/settings/SettingsScreen.kt @@ -112,6 +112,11 @@ fun SettingsScreen(viewModel: SettingsViewModel = hiltViewModel(), appViewModel: }, ), ) { + val onAutoTunnelClick = { + if (!uiState.generalState.isLocationDisclosureShown) { + navController.navigate(Route.LocationDisclosure) + } else navController.navigate(Route.AutoTunnel) + } SurfaceSelectionGroupButton( listOf( SelectionItem( @@ -124,11 +129,10 @@ fun SettingsScreen(viewModel: SettingsViewModel = hiltViewModel(), appViewModel: ) }, onClick = { - if (!uiState.generalState.isLocationDisclosureShown) return@SelectionItem navController.navigate(Route.LocationDisclosure) - navController.navigate(Route.AutoTunnel) + onAutoTunnelClick() }, trailing = { - ForwardButton(Modifier.focusable()) { navController.navigate(Route.AutoTunnel) } + ForwardButton(Modifier.focusable()) { onAutoTunnelClick() } }, ), ),