Florian Walther (live streaming)
12/29/2021, 12:26 PMFunkyMuse
12/29/2021, 10:38 PMFlorian Walther (live streaming)
12/30/2021, 12:01 PMJulien Raad
04/30/2023, 11:38 PMIan Lake
05/01/2023, 1:41 AMJulien Raad
05/01/2023, 9:11 AMonNewIntent
then reselecting the last selected bottom item always navigates to the deep link destination. The above issue tracker link summerizes the issue I am also having perfectly. Note that I am handling the deeplink in onNewIntent
with navController.navigate with a deep link request param and nav options
instead of using navController.handleDeeplink
because I don't want the synthetic back stack to replace my current back stack, I am trying to preserve the last back stack state before deep linking happens. But there is always some corner case that is not behaving correctly. I wonder how YouTube for example does thatdorche
05/01/2023, 1:50 PMIan Lake
05/01/2023, 2:33 PMnavigate
, all that is going to do by default is add that on whatever back stack you are on. It just does exactly what you told it to dodorche
05/01/2023, 3:10 PMIan Lake
05/01/2023, 3:36 PMhandleDeepLink()
is working as expected (with the caveat of always putting the user in an understandable, consistent place rather than the merge kind of behavior you are trying for), then the problem is with your custom logic in onNewIntent
dorche
05/01/2023, 3:44 PMJulien Raad
05/01/2023, 5:40 PMonNewIntent.
However, I'm struggling to find a proper solution. I'ma quickly highlight the issue maybe anyone is able to provide help.
• The app has 3 bottom navigation tabs, each associated with a nav-graph, consider GraphA, GraphB, GraphC.
• The user is on GraphB
- the app is in the background.
• The app receives a deep link to C1
• onNewIntent
calls navController.navigate(deeplink)
• The app correctly navigates to C1
Now the problem, C1
is on top of GraphB
and this is normal, because I added no navOptions
to the navigate function, so when NavItemB
clicked nothing happens since nav component just added the deeplink destination on top of it's stack.
Adding navOptions
popupTo
navController.graph.startDestinationId will make C1
to be pushed on top of the right nav-graph GraphC
BUT pressing back now goes back to GraphA
, meaning it has not respected the previous destination before the deeplink happened.
What navOptions logic
can be added or any other logic so that pressing back goes back to GraphB,
or in other terms to previous destination before the deeplink.Ian Lake
05/01/2023, 5:44 PMJulien Raad
05/01/2023, 5:47 PM