Commit aa4e07b0 by Sebastián Katzer

Ignore delegates if triggered by push notifications (ios)

parent 16c9c426
......@@ -504,10 +504,15 @@
willPresentNotification:(UNNotification *)notification
withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler
{
APPNotificationOptions* options = notification.request.options;
UNNotificationRequest* toast = notification.request;
if ([toast.trigger isKindOfClass:UNPushNotificationTrigger.class])
return;
APPNotificationOptions* options = toast.options;
if (![notification.request wasUpdated]) {
[self fireEvent:@"trigger" notification:notification.request];
[self fireEvent:@"trigger" notification:toast];
}
if (options.silent) {
......@@ -525,15 +530,19 @@
*/
- (void) userNotificationCenter:(UNUserNotificationCenter *)center
didReceiveNotificationResponse:(UNNotificationResponse *)response
withCompletionHandler:(void (^)())completionHandler
withCompletionHandler:(void (^)(void))completionHandler
{
UNNotificationRequest* notification = response.notification.request;
UNNotificationRequest* toast = response.notification.request;
completionHandler();
if ([toast.trigger isKindOfClass:UNPushNotificationTrigger.class])
return;
NSMutableDictionary* data = [[NSMutableDictionary alloc] init];
NSString* action = response.actionIdentifier;
NSString* event = action;
completionHandler();
if ([action isEqualToString:UNNotificationDefaultActionIdentifier]) {
event = @"click";
} else
......@@ -542,11 +551,11 @@
}
if (!deviceready && [event isEqualToString:@"click"]) {
_launchDetails = @[notification.options.id, event];
_launchDetails = @[toast.options.id, event];
}
if (![event isEqualToString:@"clear"]) {
[self fireEvent:@"clear" notification:notification];
[self fireEvent:@"clear" notification:toast];
}
if ([response isKindOfClass:UNTextInputNotificationResponse.class]) {
......@@ -554,7 +563,7 @@
forKey:@"text"];
}
[self fireEvent:event notification:notification data:data];
[self fireEvent:event notification:toast data:data];
}
#pragma mark -
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment