Repository navigation
fix(deeplink): handle incoming links in the SDK and report organic installs - #14
Merged
Merged
Conversation
…stalls initialize() now subscribes to app_links' link stream, which carries the link that launched the app as well as links opened while it runs, and passes each to the deep link handler. A link that arrives before any onDeepLink callback is registered is held and delivered to the callbacks registered by the next microtask, so registering after initialize() returns receives the launch link. The same URL passed to handleDeepLink() again within 10 seconds is ignored, so an app that also forwards links from its own app_links listener gets each link once. onDeferredDeepLink is called with null for an organic install. LinkFortyConfig.attributionWindowHours is used when reporting the install; the initialize() argument overrides it when given. The install link is recorded for last-click attribution only on the launch that reports the install, and not over a direct deep link opened on that same launch. The example app registers its callbacks after initialize().
This file contains hidden or 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
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.
Summary
initialize()listens for incoming links. It subscribes toapp_links'uriLinkStream, which carries the link that launched the app (cold start) and links opened while it runs, and passes each to the deep link handler.onDeepLinkcallbacks receive the server-resolved link data with no app-sideapp_linkscode.onDeepLinkcallback is registered is held and delivered to the callbacks registered by the next microtask, so the documented pattern (register afterawait LinkForty.initialize(...)) receives it.handleDeepLink()again within 10 seconds is ignored, so an app that also forwards links from its ownapp_linkslistener gets each link once. That listener can be removed.onDeferredDeepLink(null)for organic installs, as the README describes.LinkFortyConfig.attributionWindowHoursis used when reporting the install; theinitialize()argument overrides it when given.initialize()could be overwritten by the install link.initialize(); README updated (including turning off Flutter's built-in deep linking when it's in use).pubspec.yamlandSdkInfo.version.Behavior changes for existing apps
onDeferredDeepLinknow also fires for organic installs, withnull.handleDeepLink()from its ownapp_linkslistener keeps working and gets each link once.Test plan
flutter test: 138 passing (9 new)flutter analyze: no issuesdart pub publish --dry-run: no warnings beyond uncommitted files