Decouple settings screens from NavHostController (#3450)

This commit is contained in:
Phil Oliver 2025-10-13 13:52:44 -04:00 committed by GitHub
parent d4a6c8b7cb
commit 5c745bdd90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 383 additions and 519 deletions

View file

@ -53,8 +53,8 @@ private fun NavGraphBuilder.configRoutes(navController: NavHostController) {
composable(configRoute.route::class) { backStackEntry ->
val parentEntry = remember(backStackEntry) { navController.getBackStackEntry(ChannelsRoutes.ChannelsGraph) }
when (configRoute) {
ConfigRoute.CHANNELS -> ChannelConfigScreen(navController, hiltViewModel(parentEntry))
ConfigRoute.LORA -> LoRaConfigScreen(navController, hiltViewModel(parentEntry))
ConfigRoute.CHANNELS -> ChannelConfigScreen(hiltViewModel(parentEntry), navController::popBackStack)
ConfigRoute.LORA -> LoRaConfigScreen(hiltViewModel(parentEntry), navController::popBackStack)
else -> Unit // Should not happen if ConfigRoute enum is exhaustive for this context
}
}

View file

@ -63,6 +63,6 @@ private fun NavGraphBuilder.configRoutes(navController: NavHostController) {
composable<SettingsRoutes.LoRa> { backStackEntry ->
val parentEntry =
remember(backStackEntry) { navController.getBackStackEntry(ConnectionsRoutes.ConnectionsGraph) }
LoRaConfigScreen(navController = navController, viewModel = hiltViewModel<RadioConfigViewModel>(parentEntry))
LoRaConfigScreen(viewModel = hiltViewModel<RadioConfigViewModel>(parentEntry), navController::popBackStack)
}
}