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

Deeplinks are not working #228

Open
herveweb opened this issue Dec 29, 2023 · 5 comments
Open

Deeplinks are not working #228

herveweb opened this issue Dec 29, 2023 · 5 comments

Comments

@herveweb
Copy link

I've tried to setup deelinking using the deeplink field in the scene for my screen but it's not working for me.

Any chance I can please get a link to some documentation on how to set it up?

@Tlaster
Copy link
Owner

Tlaster commented Dec 29, 2023

Currently deeplink require manually handle on all platform, for example, in Android you can handle like this:

override fun onCreate(savedInstanceState: Bundle?) {
    //....
    intent.data?.let {
        navigator.navigate(it.toString())
    }
    addOnNewIntentListener {
        it?.data?.let {
            navigator.navigate(it.toString())
        }
    }
}

@herveweb
Copy link
Author

I believe it's kinda confusing when you see a deepLinks field in the Scene method. It makes us think that it's readily available for all platforms. But I guess this might be coming in the future.

image

Unfortunately, for now I had to implement it separately on each platform.
Thanks for the reply.

@Tlaster
Copy link
Owner

Tlaster commented Jan 2, 2024

Yes I agree, the keyword makes people confused, I'm still trying to implement deeplink handling automatically.

@inveders
Copy link

Currently deeplink require manually handle on all platform, for example, in Android you can handle like this:

override fun onCreate(savedInstanceState: Bundle?) {
    //....
    intent.data?.let {
        navigator.navigate(it.toString())
    }
    addOnNewIntentListener {
        it?.data?.let {
            navigator.navigate(it.toString())
        }
    }
}

Hello, An for ios how do you do that ?

@cbeyls
Copy link

cbeyls commented Apr 30, 2024

Currently deeplink require manually handle on all platform, for example, in Android you can handle like this:

override fun onCreate(savedInstanceState: Bundle?) {
    //....
    intent.data?.let {
        navigator.navigate(it.toString())
    }
    addOnNewIntentListener {
        it?.data?.let {
            navigator.navigate(it.toString())
        }
    }
}

People copy-pasting this code, please be careful not to send the deep link event multiple times on activity re-creation. Thus:

  • You should read intent.data only once when savedInstanceState is null
  • If you call addOnNewIntentListener() from a Composable function, make sure you only call it once and not on each recomposition. I would recommend using DisposableEffect to also unregister the listener when it leaves the composition.

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

4 participants