diff --git a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/navigation/NiaNavHost.kt b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/navigation/NiaNavHost.kt index 137619332b..0610721afa 100644 --- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/navigation/NiaNavHost.kt +++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/navigation/NiaNavHost.kt @@ -21,7 +21,7 @@ import androidx.compose.ui.Modifier import androidx.navigation.compose.NavHost import com.google.samples.apps.nowinandroid.feature.bookmarks.navigation.BookmarksNavigator import com.google.samples.apps.nowinandroid.feature.foryou.navigation.ForYouBaseRoute -import com.google.samples.apps.nowinandroid.feature.foryou.navigation.forYouSection +import com.google.samples.apps.nowinandroid.feature.foryou.navigation.ForYouNavigator import com.google.samples.apps.nowinandroid.feature.interests.navigation.navigateToInterests import com.google.samples.apps.nowinandroid.feature.search.navigation.searchScreen import com.google.samples.apps.nowinandroid.feature.topic.navigation.navigateToTopic @@ -49,15 +49,21 @@ fun NiaNavHost( startDestination = ForYouBaseRoute, modifier = modifier, ) { - forYouSection( - onTopicClick = navController::navigateToTopic, - ) { - topicScreen( - showBackButton = true, - onBackClick = navController::popBackStack, + appState.navigatorProvider.get(ForYouNavigator::class.java).screen( + navGraphBuilder = this, + navController = navController, + actions = ForYouNavigator.Actions( onTopicClick = navController::navigateToTopic, - ) - } + topicDestination = { + topicScreen( + showBackButton = true, + onBackClick = navController::popBackStack, + onTopicClick = navController::navigateToTopic, + ) + }, + ), + properties = Unit, + ) appState.navigatorProvider.get(BookmarksNavigator::class.java).screen( navGraphBuilder = this, navController = navController, diff --git a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt index 00d8ebbda3..24071294e3 100644 --- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt +++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt @@ -36,7 +36,8 @@ import com.google.samples.apps.nowinandroid.core.navigation.NiaNavigatorProvider import com.google.samples.apps.nowinandroid.core.ui.TrackDisposableJank import com.google.samples.apps.nowinandroid.feature.bookmarks.navigation.BookmarksNavigator import com.google.samples.apps.nowinandroid.feature.bookmarks.navigation.BookmarksRoute -import com.google.samples.apps.nowinandroid.feature.foryou.navigation.navigateToForYou +import com.google.samples.apps.nowinandroid.feature.foryou.navigation.ForYouBaseRoute +import com.google.samples.apps.nowinandroid.feature.foryou.navigation.ForYouNavigator import com.google.samples.apps.nowinandroid.feature.interests.navigation.navigateToInterests import com.google.samples.apps.nowinandroid.feature.search.navigation.navigateToSearch import com.google.samples.apps.nowinandroid.navigation.TopLevelDestination @@ -161,8 +162,13 @@ class NiaAppState( } when (topLevelDestination) { - FOR_YOU -> navController.navigateToForYou(topLevelNavOptions) - + FOR_YOU -> navigatorProvider.get(ForYouNavigator::class.java) + .navigateToRoute( + navController = navController, + route = ForYouBaseRoute, + navOptions = topLevelNavOptions, + ) + BOOKMARKS -> navigatorProvider.get(BookmarksNavigator::class.java) .navigateToRoute( navController = navController,