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 c73e6601e560..38c461c347c2 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 @@ -15,8 +15,10 @@ import com.ramcosta.composedestinations.generated.destinations.ChangelogDestinat import com.ramcosta.composedestinations.generated.destinations.ConnectDestination import com.ramcosta.composedestinations.generated.destinations.NoDaemonDestination import com.ramcosta.composedestinations.generated.destinations.OutOfTimeDestination +import com.ramcosta.composedestinations.navigation.DestinationsNavigator import com.ramcosta.composedestinations.rememberNavHostEngine import com.ramcosta.composedestinations.utils.destination +import com.ramcosta.composedestinations.utils.rememberDestinationsNavigator import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.map import net.mullvad.mullvadvpn.compose.util.LaunchedEffectCollect @@ -35,6 +37,7 @@ private val changeLogDestinations = listOf(ConnectDestination, OutOfTimeDestinat fun MullvadApp() { val engine = rememberNavHostEngine() val navController: NavHostController = engine.rememberNavController() + val navigator: DestinationsNavigator = navController.rememberDestinationsNavigator() val serviceVm = koinViewModel() val permissionVm = koinViewModel() @@ -55,8 +58,8 @@ fun MullvadApp() { LaunchedEffectCollect(serviceVm.uiSideEffect) { when (it) { DaemonScreenEvent.Show -> - navController.navigate(NoDaemonDestination) { launchSingleTop = true } - DaemonScreenEvent.Remove -> navController.popBackStack(NoDaemonDestination, true) + navigator.navigate(NoDaemonDestination) { launchSingleTop = true } + DaemonScreenEvent.Remove -> navigator.popBackStack(NoDaemonDestination, true) } } @@ -69,7 +72,7 @@ fun MullvadApp() { .map { it.destination() } .first { it in changeLogDestinations } - navController.navigate(ChangelogDestination(it).route) + navigator.navigate(ChangelogDestination(it)) } // Ask for VPN Permission