-
Notifications
You must be signed in to change notification settings - Fork 231
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
INTENG-21106 Fix for double opens #1425
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initSceneSessionWithLaunchOptions will call initUserSessionAndCallCallback method only is there is a push URL or BRANCH_DEFER_INIT_FOR_PLUGIN_RUNTIME_KEY is true. In rest of the use cases initUserSessionAndCallCallback will be called by function - handleDeepLink(universal links or custom URIs ) or appDidBecomeActive (organic Opens)
NidhiDixit09
changed the title
[IN PROGRESS] INTENG-21106 Fix for double opens
INTENG-21106 Fix for double opens
Sep 5, 2024
@NidhiDixit09 I've been testing with Device ID finder and this branch and it looks like i'm still seeing two v1/open requests when cold opening the app via a universal link.
|
Thank you for tagging me for vis @NidhiDixit09! Really excited to let the customer know about this being fixed once the PR is merged + the new version of the SDK is released. Nice work! |
nsingh-branch
approved these changes
Sep 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reference
https://branch.atlassian.net/browse/INTENG-21106 - Double Opens Issue
Summary
iOS SDK sends two OPEN requests on cold launch (since Release 3.3 + ) if app is opened by clicking universal link.
First
OPEN
is sent by APIBranch.getInstance().initSessionWithLaunchOptions
and secondOPEN
is fromBranch.getInstance().continue(userActivity)
So if app sets a callback while initializing session using API
initSessionWithLaunchOptions
, this callback will be called twice on cold launch via universal link click.This behavior came as a side effect to fix - https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/pull/1369/files/2009c84ae1b603d963a5e064c2f5eb7e97f6f242.
This pull request adds back some of the checks removed in above pull requests as well as adds few more.
As per the current state of SDK,
initSessionWithLaunchOptions
will call send OPEN ( by callinginitUserSessionAndCallCallback
method ) only if ,--> There is a URL in push notification OR
--> Deffered init is enabled. OR
--> Universal Link / Cutom URI is NOT expected to come later. (Organic Open)
Motivation
This pull request fixes Double Opens Issue. Issue can be reproduced as described below -
-> Integrate latest iOS SDK with an AppDelegate only app (like device finder app). Other Apps Not Using Scenes
-> Kill app if its already running.
-> Click universal link to launch app again. Check logs. You will find two OPEN requests. If callback is set during intialization, that callback will be called twice.
Type Of Change
Testing Instructions
--> Cold Launch an AppDelegate Only app by clicking a universal link and verify only one OPEN request is sent and callback is called only once.(Ignore OPENs called by
applicationDidBecomeActive
. They dont call callbacks. )--> On organic opens, single OPEN request is sent.
--> On deferred initialization and cold launch via universal link click, links are resolved. Please refer to this pull request for more details about testing this feature.
@rob-gioia-branch This pull request is related to fix for issue INTENG-20098. So I have tagged you as well for review.
cc @BranchMetrics/saas-sdk-devs for visibility.