https://kotlinlang.org logo
#ballast
Title
# ballast
c

Cherrio LLC

09/25/2023, 2:29 PM
Hello again, we are creating a ballast navigation extention library that can ease our navigation setups each time we begin a new project. We have written a small function to handle deeplinks on android automatically, but we are facing a race condition issue. When the user deeplinks to a particular destination, it gets overriden by the initial screen destination which is not what we want. Right now we are hacking it by delaying the navigation to the requested deeplink destination by 100ms so that the initial screen would have entered the backstack before the deeplink screen. Is there a better way to manage this? Thanks for the awesome library 😊
c

Casey Brooks

09/25/2023, 2:48 PM
The
withRouter()
function can take the
initialRoute
as
null
, allowing you to customize the logic for providing the initial route. You can see the source here, which you can manually apply to your Router’s VM config. You basically just need to put the deeplink handling logic into the
BootstrapInterceptor { }
block.
👍 1