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

Ensure Android deep links are only launched once and don't make the app crash #312

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

cbeyls
Copy link
Contributor

@cbeyls cbeyls commented Apr 30, 2024

  • The Activity reads intent.data after being re-created which causes the initial deep link to be launched again, even after the user navigates away to another screen or if another deep link has been received in the meantime. To avoid this, return null as deep link when savedInstanceState is non-null after re-creation.
  • addOnNewIntentListener() is called during each recomposition but the listener is never unregistered which can cause a leak and multiple navigator calls. To avoid this and make the code cleaner, use the produceState() function to encapsulate all deeplink state logic and unregister the listener in awaitDispose {}.
  • Catch IllegalStateException thrown by Navigator.navigate(url) when the url doesn't match any route.

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

Successfully merging this pull request may close these issues.

1 participant