Commit ed982a76 by Sebastián Katzer

Fix issue when adding multiple notifications

parent 998ea0de
...@@ -69,15 +69,21 @@ ...@@ -69,15 +69,21 @@
*/ */
- (void) add:(CDVInvokedUrlCommand*)command - (void) add:(CDVInvokedUrlCommand*)command
{ {
NSArray* notifications = command.arguments;
[self.commandDelegate runInBackground:^{ [self.commandDelegate runInBackground:^{
for (NSDictionary* options in command.arguments) { for (NSMutableDictionary* options in notifications) {
UILocalNotification* notification; UILocalNotification* notification;
notification = [[UILocalNotification alloc] notification = [[UILocalNotification alloc]
initWithOptions:options]; initWithOptions:options];
[self scheduleLocalNotification:notification]; [self scheduleLocalNotification:[notification copy]];
[self fireEvent:@"add" localNotification:notification]; [self fireEvent:@"add" localNotification:notification];
if (notifications.count > 1) {
[NSThread sleepForTimeInterval:0.01];
}
} }
[self execCallback:command]; [self execCallback:command];
...@@ -267,13 +273,6 @@ ...@@ -267,13 +273,6 @@
{ {
[self cancelForerunnerLocalNotification:notification]; [self cancelForerunnerLocalNotification:notification];
NSString* state = self.applicationState;
if ([state isEqualToString:@"background"]) {
[[UIApplication sharedApplication]
presentLocalNotificationNow:notification];
}
[[UIApplication sharedApplication] [[UIApplication sharedApplication]
scheduleLocalNotification:notification]; scheduleLocalNotification:notification];
} }
......
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