Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for AndroidX Navigation #327

Open
RavioliWonton opened this issue Jul 6, 2021 · 2 comments
Open

Support for AndroidX Navigation #327

RavioliWonton opened this issue Jul 6, 2021 · 2 comments

Comments

@RavioliWonton
Copy link

This library is a marvelous solution for avoiding writing boilerplate code to handle DeepLink (and also thanks you great work), but I wonder do you have plan to support AndroidX Navigation library to directly support deeplinking into a Fragment or a Dialog? Nowadays DeepLinkDispatch only support navigate to Activity or launch destination defined by Intent, which is not compatible with the way Navigation library used to process DeepLink.

More specifically, AndroidX Navigation support deeplink navigation by two methods: explicitly create an PendingIntent and call send() method, or implicitly generate support code from navigation xml file. Since this library could only directly routing to Activity by annotation or indirectly launching a user-defined Intent, these two methods cannot work with DeepLinkDispatch, therefore we could only handle links in Activity holding NavHost, and manually send arguments to navController to the final destination Fragment or Dialog.

Could it be some way to deal with this situation?

@hashlin
Copy link

hashlin commented Aug 27, 2021

@RavioliWonton I run into the same situation a few months ago. Here is the workaround i made.

  • Add a custom wrapper over DeepLinkDelegate class
  • Return an Intent() without target component at deeplink function
  • Attach Navigation action together with Intent as extra
  • Check and route to Navigation action inside custom wrapper

It's a bit hacky way but works as expected.

@rossbacher
Copy link
Collaborator

@RavioliWonton did you take a look at the work we are currently doing with adding the concept of DeepLinkHandlers? I think this could work if you just write an AndroidX Navigation DeepLinkHandler. Take a look and I'm open for submissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants