Set opened_from_tray true if a local notification is clicked from notification center/tray

This commit is contained in:
phips28 2017-09-12 19:01:04 +02:00
parent 122a8fb858
commit b7d4b3c5aa
1 changed files with 1 additions and 0 deletions

View File

@ -142,6 +142,7 @@ RCT_EXPORT_MODULE()
+ (void)didReceiveLocalNotification:(UILocalNotification *)notification { + (void)didReceiveLocalNotification:(UILocalNotification *)notification {
NSMutableDictionary* data = [[NSMutableDictionary alloc] initWithDictionary: notification.userInfo]; NSMutableDictionary* data = [[NSMutableDictionary alloc] initWithDictionary: notification.userInfo];
[data setValue:@"local_notification" forKey:@"_notificationType"]; [data setValue:@"local_notification" forKey:@"_notificationType"];
[data setValue:@(RCTSharedApplication().applicationState == UIApplicationStateInactive) forKey:@"opened_from_tray"];
[[NSNotificationCenter defaultCenter] postNotificationName:MESSAGING_NOTIFICATION_RECEIVED object:self userInfo:@{@"data": data}]; [[NSNotificationCenter defaultCenter] postNotificationName:MESSAGING_NOTIFICATION_RECEIVED object:self userInfo:@{@"data": data}];
} }