From a53d74f2a01ab9c9443523824179bc251ca355ef Mon Sep 17 00:00:00 2001 From: Brandon Butler Date: Thu, 1 May 2025 18:50:38 +0000 Subject: [PATCH] Adds the action identifier --- .../firebase_messaging/FLTFirebaseMessagingPlugin.m | 7 +++++-- .../lib/src/remote_message.dart | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/firebase_messaging/firebase_messaging/ios/firebase_messaging/Sources/firebase_messaging/FLTFirebaseMessagingPlugin.m b/packages/firebase_messaging/firebase_messaging/ios/firebase_messaging/Sources/firebase_messaging/FLTFirebaseMessagingPlugin.m index 74bbcb5142e0..36fab92c531f 100644 --- a/packages/firebase_messaging/firebase_messaging/ios/firebase_messaging/Sources/firebase_messaging/FLTFirebaseMessagingPlugin.m +++ b/packages/firebase_messaging/firebase_messaging/ios/firebase_messaging/Sources/firebase_messaging/FLTFirebaseMessagingPlugin.m @@ -370,8 +370,11 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center // coming from a terminated state. if (_notificationOpenedAppID != nil && ![_initialNotificationID isEqualToString:_notificationOpenedAppID]) { - NSDictionary *notificationDict = - [FLTFirebaseMessagingPlugin remoteMessageUserInfoToDict:remoteNotification]; + NSMutableDictionary *notificationDict = + [[FLTFirebaseMessagingPlugin remoteMessageUserInfoToDict:remoteNotification] mutableCopy]; + if (response.actionIdentifier != nil) { + notificationDict[@"actionIdentifier"] = response.actionIdentifier; + } [_channel invokeMethod:@"Messaging#onMessageOpenedApp" arguments:notificationDict]; } diff --git a/packages/firebase_messaging/firebase_messaging_platform_interface/lib/src/remote_message.dart b/packages/firebase_messaging/firebase_messaging_platform_interface/lib/src/remote_message.dart index cc596a496ba0..9604a2e8ed32 100644 --- a/packages/firebase_messaging/firebase_messaging_platform_interface/lib/src/remote_message.dart +++ b/packages/firebase_messaging/firebase_messaging_platform_interface/lib/src/remote_message.dart @@ -11,6 +11,7 @@ class RemoteMessage { const RemoteMessage( {this.senderId, this.category, + this.actionIdentifier, this.collapseKey, this.contentAvailable = false, this.data = const {}, @@ -28,6 +29,7 @@ class RemoteMessage { return RemoteMessage( senderId: map['senderId'], category: map['category'], + actionIdentifier: map['actionIdentifier'], collapseKey: map['collapseKey'], contentAvailable: map['contentAvailable'] ?? false, data: map['data'] == null @@ -77,6 +79,9 @@ class RemoteMessage { /// The iOS category this notification is assigned to. final String? category; + /// The iOS action identifier for the category + final String? actionIdentifier; + /// The collapse key a message was sent with. Used to override existing messages with the same key. final String? collapseKey;