Joseph Hawkes-Cates
03/02/2023, 4:44 PMroot > destination nav graph (ng1) > Start destination (A) > deeplink destination (B)
. When I use navController.navigation(deeplink=uri)
with navOptions to popUpTo the root nav graph, A
is not inserted into the backstack behind B
like it is with the external deeplinks.Joseph Hawkes-Cates
03/02/2023, 4:45 PMJoseph Hawkes-Cates
03/02/2023, 4:45 PMmgrazianodecastro
03/02/2023, 4:46 PMmgrazianodecastro
03/02/2023, 4:47 PMJoseph Hawkes-Cates
03/02/2023, 4:48 PMmgrazianodecastro
03/02/2023, 4:50 PMmgrazianodecastro
03/02/2023, 4:50 PMJoseph Hawkes-Cates
03/02/2023, 4:56 PMnavController.handleDeepLink(intent)
and this gets the backstack in the state I expect, but it still shows the splash screenJoseph Hawkes-Cates
03/02/2023, 4:57 PMdazza5000
03/02/2023, 5:11 PMJoseph Hawkes-Cates
03/02/2023, 5:11 PMJoseph Hawkes-Cates
03/02/2023, 5:11 PMJoseph Hawkes-Cates
03/02/2023, 5:30 PMnavController.navigate(deeplink = uri)
is as designed: https://issuetracker.google.com/issues/154760276Joseph Hawkes-Cates
03/02/2023, 5:30 PMJoseph Hawkes-Cates
03/02/2023, 5:31 PMmgrazianodecastro
03/02/2023, 5:33 PMJoseph Hawkes-Cates
03/02/2023, 5:38 PMdorche
03/02/2023, 6:14 PMJoseph Hawkes-Cates
03/02/2023, 6:16 PMJoseph Hawkes-Cates
03/02/2023, 6:16 PMdorche
03/02/2023, 6:32 PMJoseph Hawkes-Cates
03/02/2023, 6:32 PMdorche
03/02/2023, 6:35 PMJoseph Hawkes-Cates
03/02/2023, 6:38 PMJoseph Hawkes-Cates
03/02/2023, 6:39 PMdorche
03/02/2023, 6:47 PMJoseph Hawkes-Cates
03/02/2023, 9:57 PMval deepLinkMatch = navController.graph.matchDeepLink(NavDeepLinkRequest(deepLinkUri, null, null))
if (deepLinkMatch != null) {
val graphStartRoute = deepLinkMatch.destination.parent?.startDestinationRoute
val deeplinkMatchRoute = deepLinkMatch.destination.route
var backstackPopped = false
// If the deeplink is not the start of its graph, we need to put the start destination on the backstack
// This only handles a single level of nav graph nesting so a nav graph nested
// within a nav graph may not work as intended.
if (graphStartRoute != null && graphStartRoute != deeplinkMatchRoute) {
navController.navigate(
graphStartRoute,
navOptions {
popUpTo(RootNavGraph.route)
}
)
backstackPopped = true
}
navController.navigate(
deepLinkUri,
navOptions {
launchSingleTop = true
if (!backstackPopped) {
popUpTo(RootNavGraph.route)
}
}
)
Joseph Hawkes-Cates
03/02/2023, 10:03 PM