diff --git a/app-android/src/main/java/io/github/droidkaigi/confsched/KaigiApp.kt b/app-android/src/main/java/io/github/droidkaigi/confsched/KaigiApp.kt index 2e32ebe23..1af5e33d5 100644 --- a/app-android/src/main/java/io/github/droidkaigi/confsched/KaigiApp.kt +++ b/app-android/src/main/java/io/github/droidkaigi/confsched/KaigiApp.kt @@ -133,6 +133,7 @@ private fun KaigiNavHost( displayFeatures: PersistentList, modifier: Modifier = Modifier, navController: NavHostController = rememberNavController(), + mainNestedNavController: NavHostController = rememberNavController(), externalNavController: ExternalNavController = rememberExternalNavController(), ) { SharedTransitionLayout(modifier = modifier) { @@ -144,9 +145,10 @@ private fun KaigiNavHost( startDestination = mainScreenRoute, ) { mainScreen( - windowSize, - navController, - externalNavController, + windowSize = windowSize, + navController = navController, + mainNestedNavController = mainNestedNavController, + externalNavController = externalNavController, ) sessionScreens( onNavigationIconClick = navController::popBackStack, @@ -197,12 +199,14 @@ private fun KaigiNavHost( private fun NavGraphBuilder.mainScreen( windowSize: WindowSizeClass, navController: NavHostController, + mainNestedNavController: NavHostController, @Suppress("UnusedParameter") externalNavController: ExternalNavController, ) { mainScreen( windowSize = windowSize, mainNestedGraphStateHolder = KaigiAppMainNestedGraphStateHolder(), + mainNestedNavController = mainNestedNavController, mainNestedGraph = { mainNestedNavController, contentPadding -> nestedSessionScreens( modifier = Modifier, diff --git a/app-ios-shared/src/commonMain/kotlin/io/github/droidkaigi/confsched/shared/IosComposeKaigiApp.kt b/app-ios-shared/src/commonMain/kotlin/io/github/droidkaigi/confsched/shared/IosComposeKaigiApp.kt index 7fcbe7e53..f4eab5d9a 100644 --- a/app-ios-shared/src/commonMain/kotlin/io/github/droidkaigi/confsched/shared/IosComposeKaigiApp.kt +++ b/app-ios-shared/src/commonMain/kotlin/io/github/droidkaigi/confsched/shared/IosComposeKaigiApp.kt @@ -197,11 +197,13 @@ private fun KaigiNavHost( onLicenseScreenRequest: () -> Unit, onAccessCalendarIsDenied: () -> Unit, navController: NavHostController = rememberNavController(), + mainNestedNavController: NavHostController = rememberNavController(), ) { NavHostWithSharedAxisX(navController = navController, startDestination = mainScreenRoute) { mainScreen( windowSize = windowSize, navController = navController, + mainNestedNavController = mainNestedNavController, externalNavController = externalNavController, onLicenseScreenRequest = onLicenseScreenRequest, ) @@ -257,12 +259,14 @@ private fun KaigiNavHost( private fun NavGraphBuilder.mainScreen( windowSize: WindowSizeClass, navController: NavHostController, + mainNestedNavController: NavHostController, externalNavController: ExternalNavController, onLicenseScreenRequest: () -> Unit, ) { mainScreen( windowSize = windowSize, mainNestedGraphStateHolder = KaigiAppMainNestedGraphStateHolder(), + mainNestedNavController = mainNestedNavController, mainNestedGraph = { mainNestedNavController, contentPadding -> nestedSessionScreens( modifier = Modifier, diff --git a/feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreen.kt b/feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreen.kt index ac34ea6fb..2ff1cf812 100644 --- a/feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreen.kt +++ b/feature/main/src/commonMain/kotlin/io/github/droidkaigi/confsched/main/MainScreen.kt @@ -30,10 +30,10 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavHostController import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.currentBackStackEntryAsState -import androidx.navigation.compose.rememberNavController import conference_app_2024.core.designsystem.generated.resources.ic_fav_off import conference_app_2024.core.designsystem.generated.resources.ic_fav_on import conference_app_2024.core.designsystem.generated.resources.ic_info_off @@ -73,6 +73,7 @@ const val mainScreenRoute = "main" fun NavGraphBuilder.mainScreen( windowSize: WindowSizeClass, mainNestedGraphStateHolder: MainNestedGraphStateHolder, + mainNestedNavController: NavHostController, mainNestedGraph: NavGraphBuilder.(mainNestedNavController: NavController, PaddingValues) -> Unit, ) { composable(mainScreenRoute) { @@ -82,6 +83,7 @@ fun NavGraphBuilder.mainScreen( MainScreen( windowSize = windowSize, mainNestedGraphStateHolder = mainNestedGraphStateHolder, + mainNestedNavController = mainNestedNavController, mainNestedNavGraph = mainNestedGraph, ) } @@ -108,6 +110,7 @@ enum class NavigationType { fun MainScreen( windowSize: WindowSizeClass, mainNestedGraphStateHolder: MainNestedGraphStateHolder, + mainNestedNavController: NavHostController, mainNestedNavGraph: NavGraphBuilder.(NavController, PaddingValues) -> Unit, eventFlow: EventFlow = rememberEventFlow(), uiState: MainScreenUiState = mainScreenPresenter(eventFlow), @@ -139,6 +142,7 @@ fun MainScreen( navigationType = navigationType, routeToTab = mainNestedGraphStateHolder::routeToTab, onTabSelected = mainNestedGraphStateHolder::onTabSelected, + mainNestedNavController = mainNestedNavController, mainNestedNavGraph = mainNestedNavGraph, ) } @@ -201,11 +205,10 @@ fun MainScreen( navigationType: NavigationType, routeToTab: String.() -> MainScreenTab?, onTabSelected: (NavController, MainScreenTab) -> Unit, + mainNestedNavController: NavHostController, mainNestedNavGraph: NavGraphBuilder.(NavController, PaddingValues) -> Unit, modifier: Modifier = Modifier, ) { - val mainNestedNavController = rememberNavController() - val navBackStackEntryRoute = mainNestedNavController.currentBackStackEntryAsState().value?.destination?.route