Skip to content

Commit d704e96

Browse files
authored
feat: include response actionIdentifier in event (#197)
1 parent 03dd2e9 commit d704e96

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ios/RNCPushNotificationIOS.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,16 @@ @implementation RNCPushNotificationIOS
128128
}
129129

130130
API_AVAILABLE(ios(10.0))
131-
static NSDictionary *RCTFormatOpenedUNNotification(UNNotification *notification)
131+
static NSDictionary *RCTFormatOpenedUNNotification(UNNotificationResponse *response)
132132
{
133+
UNNotification* notification = response.notification;
133134
NSMutableDictionary *formattedNotification = [RCTFormatUNNotification(notification) mutableCopy];
134135
UNNotificationContent *content = notification.request.content;
135136

136137
NSMutableDictionary *userInfo = [content.userInfo mutableCopy];
137138
userInfo[@"userInteraction"] = [NSNumber numberWithInt:1];
138-
139+
userInfo[@"actionIdentifier"] = response.actionIdentifier;
140+
139141
formattedNotification[@"userInfo"] = RCTNullIfNil(RCTJSONClean(userInfo));
140142

141143
return formattedNotification;
@@ -236,7 +238,7 @@ + (void)didReceiveNotificationResponse:(UNNotificationResponse *)response
236238
API_AVAILABLE(ios(10.0)) {
237239
[[NSNotificationCenter defaultCenter] postNotificationName:kLocalNotificationReceived
238240
object:self
239-
userInfo:RCTFormatOpenedUNNotification(response.notification)];
241+
userInfo:RCTFormatOpenedUNNotification(response)];
240242
}
241243

242244
- (void)handleLocalNotificationReceived:(NSNotification *)notification

0 commit comments

Comments
 (0)