Loading src/ios/APPLocalNotification.m +15 −13 Changes for src/ios/APPLocalNotification.m: 15 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; NSString* id = [notification.userInfo objectForKey:@"id"]; NSString* json = [notification.userInfo objectForKey:@"json"]; [self cancelNotificationWithId:id]; [self cancelNotificationWithId:id fireEvent:NO]; [self archiveNotification:notification]; [self fireEvent:@"add" id:id json:json]; Loading @@ -77,10 +77,7 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; NSArray* arguments = [command arguments]; NSString* id = [arguments objectAtIndex:0]; UILocalNotification* notification = [self cancelNotificationWithId:id]; NSString* json = [notification.userInfo objectForKey:@"json"]; [self fireEvent:@"cancel" id:id json:json]; [self cancelNotificationWithId:id fireEvent:YES]; }]; } Loading @@ -96,7 +93,7 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; { if ([key hasPrefix:kAPP_LOCALNOTIFICATION]) { [[NSUserDefaults standardUserDefaults] removeObjectForKey:key]; [self cancelNotificationWithId:key fireEvent:YES]; } } Loading @@ -112,11 +109,14 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; * * @param {NSString} id Die ID der Notification */ - (UILocalNotification*) cancelNotificationWithId:(NSString*)id - (void) cancelNotificationWithId:(NSString*)id fireEvent:(BOOL)fireEvent { if (![self strIsNullOrEmpty:id]) { NSString* key = [kAPP_LOCALNOTIFICATION stringByAppendingString:id]; NSString* key = ([id hasPrefix:kAPP_LOCALNOTIFICATION]) ? id : [kAPP_LOCALNOTIFICATION stringByAppendingString:id]; NSData* data = [[NSUserDefaults standardUserDefaults] objectForKey:key]; if (data) Loading @@ -126,11 +126,14 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; [[NSUserDefaults standardUserDefaults] removeObjectForKey:key]; [[UIApplication sharedApplication] cancelLocalNotification:notification]; return notification; if (fireEvent) { NSString* json = [notification.userInfo objectForKey:@"json"]; [self fireEvent:@"cancel" id:id json:json]; } } } return NULL; } /** Loading Loading @@ -211,7 +214,6 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; notification.applicationIconBadgeNumber = badge; if (![self strIsNullOrEmpty:msg]) { if (![self strIsNullOrEmpty:title]) Loading Loading @@ -257,7 +259,7 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; if (autoCancel && !isActive) { [self cancelNotificationWithId:id]; [self cancelNotificationWithId:id fireEvent:YES]; } [self fireEvent:event id:id json:json]; Loading Loading
src/ios/APPLocalNotification.m +15 −13 Changes for src/ios/APPLocalNotification.m: 15 added lines, 13 removed lines. Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; NSString* id = [notification.userInfo objectForKey:@"id"]; NSString* json = [notification.userInfo objectForKey:@"json"]; [self cancelNotificationWithId:id]; [self cancelNotificationWithId:id fireEvent:NO]; [self archiveNotification:notification]; [self fireEvent:@"add" id:id json:json]; Loading @@ -77,10 +77,7 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; NSArray* arguments = [command arguments]; NSString* id = [arguments objectAtIndex:0]; UILocalNotification* notification = [self cancelNotificationWithId:id]; NSString* json = [notification.userInfo objectForKey:@"json"]; [self fireEvent:@"cancel" id:id json:json]; [self cancelNotificationWithId:id fireEvent:YES]; }]; } Loading @@ -96,7 +93,7 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; { if ([key hasPrefix:kAPP_LOCALNOTIFICATION]) { [[NSUserDefaults standardUserDefaults] removeObjectForKey:key]; [self cancelNotificationWithId:key fireEvent:YES]; } } Loading @@ -112,11 +109,14 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; * * @param {NSString} id Die ID der Notification */ - (UILocalNotification*) cancelNotificationWithId:(NSString*)id - (void) cancelNotificationWithId:(NSString*)id fireEvent:(BOOL)fireEvent { if (![self strIsNullOrEmpty:id]) { NSString* key = [kAPP_LOCALNOTIFICATION stringByAppendingString:id]; NSString* key = ([id hasPrefix:kAPP_LOCALNOTIFICATION]) ? id : [kAPP_LOCALNOTIFICATION stringByAppendingString:id]; NSData* data = [[NSUserDefaults standardUserDefaults] objectForKey:key]; if (data) Loading @@ -126,11 +126,14 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; [[NSUserDefaults standardUserDefaults] removeObjectForKey:key]; [[UIApplication sharedApplication] cancelLocalNotification:notification]; return notification; if (fireEvent) { NSString* json = [notification.userInfo objectForKey:@"json"]; [self fireEvent:@"cancel" id:id json:json]; } } } return NULL; } /** Loading Loading @@ -211,7 +214,6 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; notification.applicationIconBadgeNumber = badge; if (![self strIsNullOrEmpty:msg]) { if (![self strIsNullOrEmpty:title]) Loading Loading @@ -257,7 +259,7 @@ NSString *const kAPP_LOCALNOTIFICATION = @"APP_LOCALNOTIFICATION"; if (autoCancel && !isActive) { [self cancelNotificationWithId:id]; [self cancelNotificationWithId:id fireEvent:YES]; } [self fireEvent:event id:id json:json]; Loading