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

iOS plugin not necessarily returning the latest params #88

Closed
pragunvohra opened this issue Mar 25, 2016 · 3 comments
Closed

iOS plugin not necessarily returning the latest params #88

pragunvohra opened this issue Mar 25, 2016 · 3 comments

Comments

@pragunvohra
Copy link
Contributor

Alternating between opening our app from the home screen and opening it via a link that I generated (https://bnc.lt/BpSc/6rY8bdZZXr) (note the latest code is not on production so grabbing the production app from the App store won't help here), the following code in JS doesn't necessarily return the latest params. Sometimes when I open the app from my home screen, the latest referring params say that they are from the link and vice versa:

window.Branch.initSession().then(function(params) { 
    console.log("The latest params should be: ", params);
}
window.Branch.initSession().then(function() { 
  window.Branch.getLatestReferringParams().then(function(params) {
    console.log("The latest params should be: ", params);
  }
}

We call initSession in these places:

deviceReady().then(...);
document.addEventListener("resume", ...);
onRegister // function that is hit when a new user registers

Many times I receive these params in DeepLinkHandler (which are wrong):

{+is_first_session: false, +clicked_branch_link: false}

and sometimes I receive the proper params for my link, but when I navigate open the app from my iPhone's home screen instead of via a link.

I haven't looked into if the issue happens for getFirstReferringParams().

This is potentially the last issue that is blocking us from deploying to production, so a resolution here would be great.

Thanks.

@aaustin
Copy link
Contributor

aaustin commented Mar 27, 2016

Hey @pragunvohra - I think the problem is that you're trying to call getLatestReferring in the callback to initSession. We fetch the params asynchronously and will pass them back to the DeepLinkHandler method when they're available: see initSession:
https://github.com/BranchMetrics/Cordova-Ionic-PhoneGap-Deferred-Deep-Linking-SDK#initsession

If you call getLatest before the params are fetched from the server, it will return an empty set.

@pragunvohra
Copy link
Contributor Author

Thanks for the response, @aaustin. I thought the same thing as well, though I was also manually calling into getLatestReferringParams() from the console and seeing the same behavior (well past my initParams call) so I ruled that out, though I'll verify again on my end and update here.

@aaustin
Copy link
Contributor

aaustin commented Apr 23, 2016

We've confirmed that this is the intended functionality of the library and will be closing this out. Apologies.

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

2 participants