Skip to content

Commit

Permalink
fix(firebase_dynamic_links): pass through utmParameters on iOS an…
Browse files Browse the repository at this point in the history
…d make property on `PendingDynamicLinkData`. (#8232)
  • Loading branch information
russellwheatley committed Mar 10, 2022
1 parent 433a08e commit 32d06e7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
if (dynamicLink.minimumAppVersion) {
iosData[@"minimumVersion"] = dynamicLink.minimumAppVersion;
}
dictionary[@"utmParameters"] = dynamicLink.utmParametersDictionary;
dictionary[@"ios"] = iosData;
return dictionary;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class MethodChannelFirebaseDynamicLinks extends FirebaseDynamicLinksPlatform {
link: Uri.parse(link),
android: androidData,
ios: iosData,
utmParameters: linkData['utmParameters'],
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import 'pending_dynamic_link_data_ios.dart';

/// Provides data from received dynamic link.
class PendingDynamicLinkData {
const PendingDynamicLinkData({required this.link, this.android, this.ios});
const PendingDynamicLinkData(
{required this.link,
this.android,
this.ios,
this.utmParameters = const {},
}
);

/// Provides Android specific data from received dynamic link.
///
Expand All @@ -24,11 +30,15 @@ class PendingDynamicLinkData {
/// Deep link parameter of the dynamic link.
final Uri link;

/// UTM parameters associated with a dynamic link.
final Map<String, String> utmParameters;

/// Returns the current instance as a [Map].
Map<String, dynamic> asMap() => <String, dynamic>{
'ios': ios?.asMap(),
'android': android?.asMap(),
'link': link.toString(),
'utmParameters': utmParameters
};

@override
Expand Down

4 comments on commit 32d06e7

@robotoss
Copy link

@robotoss robotoss commented on 32d06e7 Mar 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@russellwheatley
utmParameters is Map<String, String>;
but linkData['utmParameters'] is <Object?, Object?>
when i try use utmParameters i got an error

Unhandled Exception: type '_InternalLinkedHashMap<Object?, Object?>' is not a subtype of type 'Map<String, String>' #0 MethodChannelFirebaseDynamicLinks._getPendingDynamicLinkDataFromMap (package:firebase_dynamic_links_platform_interface/src/method_channel/method_channel_firebase_dynamic_links.dart:107:30) #1 MethodChannelFirebaseDynamicLinks.getInitialLink (package:firebase_dynamic_links_platform_interface/src/method_channel/method_channel_firebase_dynamic_links.dart:120:14)

@ramamurthyk
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest update is breaking the app silently. I was wondering why the stream subscription (FirebaseDynamicLinks.instance.onLink.listen(...) was not being invoked whilst using dynamic links but there was no error or exception until I switched on all exceptions which showed: "type '_InternalLinkedHashMap<Object?, Object?>' is not a subtype of type 'Map<String, String>'".

Would really appreciate if this can be fixed and latest upgrade pushed to pub.dev?

Thanks

@AdamBridges
Copy link

@AdamBridges AdamBridges commented on 32d06e7 Mar 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unhandled Exception: type '_InternalLinkedHashMap<Object?, Object?>' is not a subtype of type 'Map<String, String>' #0 MethodChannelFirebaseDynamicLinks._getPendingDynamicLinkDataFromMap (package:firebase_dynamic_links_platform_interface/src/method_channel/method_channel_firebase_dynamic_links.dart:107:30) #1 MethodChannelFirebaseDynamicLinks.getInitialLink (package:firebase_dynamic_links_platform_interface/src/method_channel/method_channel_firebase_dynamic_links.dart:120:14)

Can confirm this error is occurring on iOS (12.5.5) with a real device on release build.

@kalloszsolty
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Occurs for me too. Temporal fix: change pubspec.yaml

  firebase_dynamic_links: 4.0.8
  firebase_dynamic_links_platform_interface: 0.2.1+1

Please sign in to comment.