Skip to content

Commit a53d74f

Browse files
committed
Adds the action identifier
1 parent 8ad6dff commit a53d74f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/firebase_messaging/firebase_messaging/ios/firebase_messaging/Sources/firebase_messaging/FLTFirebaseMessagingPlugin.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,11 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center
370370
// coming from a terminated state.
371371
if (_notificationOpenedAppID != nil &&
372372
![_initialNotificationID isEqualToString:_notificationOpenedAppID]) {
373-
NSDictionary *notificationDict =
374-
[FLTFirebaseMessagingPlugin remoteMessageUserInfoToDict:remoteNotification];
373+
NSMutableDictionary *notificationDict =
374+
[[FLTFirebaseMessagingPlugin remoteMessageUserInfoToDict:remoteNotification] mutableCopy];
375+
if (response.actionIdentifier != nil) {
376+
notificationDict[@"actionIdentifier"] = response.actionIdentifier;
377+
}
375378
[_channel invokeMethod:@"Messaging#onMessageOpenedApp" arguments:notificationDict];
376379
}
377380

packages/firebase_messaging/firebase_messaging_platform_interface/lib/src/remote_message.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class RemoteMessage {
1111
const RemoteMessage(
1212
{this.senderId,
1313
this.category,
14+
this.actionIdentifier,
1415
this.collapseKey,
1516
this.contentAvailable = false,
1617
this.data = const <String, dynamic>{},
@@ -28,6 +29,7 @@ class RemoteMessage {
2829
return RemoteMessage(
2930
senderId: map['senderId'],
3031
category: map['category'],
32+
actionIdentifier: map['actionIdentifier'],
3133
collapseKey: map['collapseKey'],
3234
contentAvailable: map['contentAvailable'] ?? false,
3335
data: map['data'] == null
@@ -77,6 +79,9 @@ class RemoteMessage {
7779
/// The iOS category this notification is assigned to.
7880
final String? category;
7981

82+
/// The iOS action identifier for the category
83+
final String? actionIdentifier;
84+
8085
/// The collapse key a message was sent with. Used to override existing messages with the same key.
8186
final String? collapseKey;
8287

0 commit comments

Comments
 (0)