From aba2b2c1548f6f2e960ca964afc42fbff633db0b Mon Sep 17 00:00:00 2001 From: Don Turner Date: Mon, 13 May 2024 17:56:51 -0700 Subject: [PATCH] Remove different deeplink destination, add route for nested nav host Change-Id: Idb9586752d815449243d6d529e9b655c45e395ad --- .../ui/interests2pane/InterestsListDetailScreen.kt | 3 ++- .../feature/foryou/navigation/ForYouNavigation.kt | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt index 2b2082df81..1eddde8e6a 100644 --- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt +++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt @@ -134,7 +134,8 @@ internal fun InterestsListDetailScreen( key(nestedNavKey) { NavHost( navController = nestedNavController, - startDestination = nestedNavHostStartDestination + startDestination = nestedNavHostStartDestination, + route = DetailPaneNavHostDestination::class ) { topicScreen( showBackButton = !listDetailNavigator.isListPaneVisible(), diff --git a/feature/foryou/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/navigation/ForYouNavigation.kt b/feature/foryou/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/navigation/ForYouNavigation.kt index a5ca0b8383..e0874bbf8a 100644 --- a/feature/foryou/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/navigation/ForYouNavigation.kt +++ b/feature/foryou/src/main/kotlin/com/google/samples/apps/nowinandroid/feature/foryou/navigation/ForYouNavigation.kt @@ -31,16 +31,13 @@ const val LINKED_NEWS_RESOURCE_ID = "linkedNewsResourceId" private const val DEEP_LINK_BASE_PATH = "$DEEP_LINK_SCHEME_AND_HOST/$FOR_YOU_PATH" @Serializable data class ForYouDestination(val linkedNewsResourceId: String? = null) -// For deeplinks the news resource ID cannot be null so we use a different type with the same -// argument name to enforce this requirement. -@Serializable data class ForYouDeeplink(val linkedNewsResourceId: String) fun NavController.navigateToForYou(navOptions: NavOptions) = navigate(route = ForYouDestination(), navOptions) fun NavGraphBuilder.forYouScreen(onTopicClick: (String) -> Unit) { composable( deepLinks = listOf( - navDeepLink(basePath = DEEP_LINK_BASE_PATH), + navDeepLink(basePath = DEEP_LINK_BASE_PATH), ), ) { ForYouRoute(onTopicClick)