Tlaster / PreCompose

Compose Multiplatform Navigation && State Management
https://tlaster.github.io/PreCompose/
MIT License
838 stars 48 forks source link

Deeplinks are not working #228

Open herveweb opened 8 months ago

herveweb commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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 commented 8 months ago

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

inveders commented 4 months ago

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 commented 4 months ago

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: