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

Deeplink launches twice or more in iOS #29

Open
DanProudfoot opened this issue Feb 11, 2021 · 3 comments
Open

Deeplink launches twice or more in iOS #29

DanProudfoot opened this issue Feb 11, 2021 · 3 comments

Comments

@DanProudfoot
Copy link

HI there

Having an issue where a deeplink will fire twice (but sometimes even multiple times) after opening a Branch link in iOS. My process is as follows:

  • Click a Branch link
  • It opens my app. I handle the event in my JS and route through my app using the deeplink path.
  • I do something to cause the app to lose focus, such as going to the homescreen or opening the notification shade.
  • On returning focus to the app, the Branch link fires again and the navigation happens a second time.

As far as I can tell, this does not happen on Android. I'm thinking I have some piece of iOS setup wrong, but I've checked everything against the docs and there is no glaring omission. If I have gone wrong somewhere, what could it be?

@DanProudfoot DanProudfoot changed the title Deeplink launches twice in iOS Deeplink launches twice or more in iOS Feb 11, 2021
@KirstenStake
Copy link
Contributor

@DanProudfoot did you manage to figure this one out? seeing the same behvaviour in android.

  • user clicks branch link
  • app opens
  • gets redirected in app
  • user closes app (background mode) and uses other apps etc on phone
  • opens app again and user gets redirected back with the initial branch logic (but didn't press a branch link this time)

When looking at the app branch link data from "init" function it still has the "clickedBranchLink" as true for the visits after the initial branch link click visit.

@DanProudfoot
Copy link
Author

@KirstenStake Hi - I didn't find an answer entirely within the confines of Branch, but what I have done since that seems to be working is store the deeplink timestamp in Capacitor Storage and then compare the stored version with the next time the event is called. If it's the same, just ignore it.

@tomskopek
Copy link

I've noticed that the second time, the subscribe listener adds this param: '+rn_cached_initial_event'. You can return early if it's present.

This does not seem to be the case on getInitialUrl.

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