Loading src/ios/PushPlugin.m +29 −6 Changes for src/ios/PushPlugin.m: 29 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -49,34 +49,51 @@ NSMutableDictionary* options = [command.arguments objectAtIndex:0]; UIUserNotificationType UserNotificationTypes = UIUserNotificationTypeNone; UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeNone; id badgeArg = [options objectForKey:@"badge"]; id soundArg = [options objectForKey:@"sound"]; id alertArg = [options objectForKey:@"alert"]; if ([badgeArg isKindOfClass:[NSString class]]) { if ([badgeArg isEqualToString:@"true"]) if ([badgeArg isEqualToString:@"true"]) { notificationTypes |= UIRemoteNotificationTypeBadge; UserNotificationTypes |= UIUserNotificationTypeBadge; } } else if ([badgeArg boolValue]) else if ([badgeArg boolValue]) { notificationTypes |= UIRemoteNotificationTypeBadge; UserNotificationTypes |= UIUserNotificationTypeBadge; } if ([soundArg isKindOfClass:[NSString class]]) { if ([soundArg isEqualToString:@"true"]) if ([soundArg isEqualToString:@"true"]) { notificationTypes |= UIRemoteNotificationTypeSound; UserNotificationTypes |= UIUserNotificationTypeSound; } else if ([soundArg boolValue]) } else if ([soundArg boolValue]) { notificationTypes |= UIRemoteNotificationTypeSound; UserNotificationTypes |= UIUserNotificationTypeSound; } if ([alertArg isKindOfClass:[NSString class]]) { if ([alertArg isEqualToString:@"true"]) if ([alertArg isEqualToString:@"true"]) { notificationTypes |= UIRemoteNotificationTypeAlert; UserNotificationTypes |= UIUserNotificationTypeAlert; } else if ([alertArg boolValue]) } else if ([alertArg boolValue]) { notificationTypes |= UIRemoteNotificationTypeAlert; UserNotificationTypes |= UIUserNotificationTypeAlert; } notificationTypes |= UIRemoteNotificationTypeNewsstandContentAvailability; UserNotificationTypes |= UIUserNotificationActivationModeBackground; self.callback = [options objectForKey:@"ecb"]; Loading @@ -85,7 +102,13 @@ isInline = NO; if ([[UIApplication sharedApplication]respondsToSelector:@selector(registerUserNotificationSettings:)]) { UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UserNotificationTypes categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; [[UIApplication sharedApplication] registerForRemoteNotifications]; } else { [[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes]; } if (notificationMessage) // if there is a pending startup notification [self notificationReceived]; // go ahead and process it Loading Loading
src/ios/PushPlugin.m +29 −6 Changes for src/ios/PushPlugin.m: 29 added lines, 6 removed lines. Original line number Diff line number Diff line Loading @@ -49,34 +49,51 @@ NSMutableDictionary* options = [command.arguments objectAtIndex:0]; UIUserNotificationType UserNotificationTypes = UIUserNotificationTypeNone; UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeNone; id badgeArg = [options objectForKey:@"badge"]; id soundArg = [options objectForKey:@"sound"]; id alertArg = [options objectForKey:@"alert"]; if ([badgeArg isKindOfClass:[NSString class]]) { if ([badgeArg isEqualToString:@"true"]) if ([badgeArg isEqualToString:@"true"]) { notificationTypes |= UIRemoteNotificationTypeBadge; UserNotificationTypes |= UIUserNotificationTypeBadge; } } else if ([badgeArg boolValue]) else if ([badgeArg boolValue]) { notificationTypes |= UIRemoteNotificationTypeBadge; UserNotificationTypes |= UIUserNotificationTypeBadge; } if ([soundArg isKindOfClass:[NSString class]]) { if ([soundArg isEqualToString:@"true"]) if ([soundArg isEqualToString:@"true"]) { notificationTypes |= UIRemoteNotificationTypeSound; UserNotificationTypes |= UIUserNotificationTypeSound; } else if ([soundArg boolValue]) } else if ([soundArg boolValue]) { notificationTypes |= UIRemoteNotificationTypeSound; UserNotificationTypes |= UIUserNotificationTypeSound; } if ([alertArg isKindOfClass:[NSString class]]) { if ([alertArg isEqualToString:@"true"]) if ([alertArg isEqualToString:@"true"]) { notificationTypes |= UIRemoteNotificationTypeAlert; UserNotificationTypes |= UIUserNotificationTypeAlert; } else if ([alertArg boolValue]) } else if ([alertArg boolValue]) { notificationTypes |= UIRemoteNotificationTypeAlert; UserNotificationTypes |= UIUserNotificationTypeAlert; } notificationTypes |= UIRemoteNotificationTypeNewsstandContentAvailability; UserNotificationTypes |= UIUserNotificationActivationModeBackground; self.callback = [options objectForKey:@"ecb"]; Loading @@ -85,7 +102,13 @@ isInline = NO; if ([[UIApplication sharedApplication]respondsToSelector:@selector(registerUserNotificationSettings:)]) { UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UserNotificationTypes categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; [[UIApplication sharedApplication] registerForRemoteNotifications]; } else { [[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes]; } if (notificationMessage) // if there is a pending startup notification [self notificationReceived]; // go ahead and process it Loading