Skip to content

Commit

Permalink
Adjusting referring application to match documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelGHSeg committed Dec 11, 2024
1 parent eeac5d8 commit d102dc0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ class AnalyticsPlugin : FlutterPlugin, NativeContextApi, EventChannel.StreamHand
private fun createChangeReceiver(events: EventSink): BroadcastReceiver {
return object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent) {
val referringApplication = intent.getStringExtra("referringApplication")
val referringApplication = intent.getStringExtra("referring_application")
// NOTE: assuming intent.getAction() is Intent.ACTION_VIEW
val dataString: String? = intent.dataString
if (dataString == null) {
events.error("UNAVAILABLE", "Link unavailable", null)
} else {
val data = mapOf("url" to dataString, "referringApplication" to referringApplication)
val data = mapOf("url" to dataString, "referring_application" to referringApplication)
events.success(data)
}
}
Expand Down Expand Up @@ -234,7 +234,7 @@ class AnalyticsPlugin : FlutterPlugin, NativeContextApi, EventChannel.StreamHand
if (this.context != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
binding.activity.intent.putExtra(
"referringApplication",
"referring_application",
binding.activity.referrer.toString()
)
}
Expand Down
6 changes: 4 additions & 2 deletions packages/core/ios/Classes/AnalyticsPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ public class AnalyticsPlugin: NSObject, FlutterPlugin, NativeContextApi, Flutter
public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool{
let sourceApplication = options[.sourceApplication] as? String;
if (_eventSink != nil) {
_eventSink?(["url": url.absoluteString, "referringApplication": sourceApplication])
_eventSink?(["url": url.absoluteString, "referring_application": sourceApplication])
}else{
pendingDeeplinkEventsQueue.append(["url": url.absoluteString, "referringApplication": sourceApplication]);
pendingDeeplinkEventsQueue.append(["url": url.absoluteString, "referring_application": sourceApplication]);
}


return false
}

Expand Down
4 changes: 2 additions & 2 deletions packages/core/lib/state.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d102dc0

Please sign in to comment.