Loading src/ios/PushPlugin.m +38 −14 Changes for src/ios/PushPlugin.m: 38 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ NSMutableDictionary* options = [command.arguments objectAtIndex:0]; UIUserNotificationType UserNotificationTypes = UIUserNotificationTypeNone; UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeNone; id badgeArg = [options objectForKey:@"badge"]; Loading @@ -60,41 +59,74 @@ { if ([badgeArg isEqualToString:@"true"]) { notificationTypes |= UIRemoteNotificationTypeBadge; UserNotificationTypes |= UIUserNotificationTypeBadge; } } else if ([badgeArg boolValue]) { notificationTypes |= UIRemoteNotificationTypeBadge; UserNotificationTypes |= UIUserNotificationTypeBadge; } if ([soundArg isKindOfClass:[NSString class]]) { if ([soundArg isEqualToString:@"true"]) { notificationTypes |= UIRemoteNotificationTypeSound; UserNotificationTypes |= UIUserNotificationTypeSound; } } else if ([soundArg boolValue]) { notificationTypes |= UIRemoteNotificationTypeSound; UserNotificationTypes |= UIUserNotificationTypeSound; } if ([alertArg isKindOfClass:[NSString class]]) { if ([alertArg isEqualToString:@"true"]) { notificationTypes |= UIRemoteNotificationTypeAlert; UserNotificationTypes |= UIUserNotificationTypeAlert; } } else if ([alertArg boolValue]) { notificationTypes |= UIRemoteNotificationTypeAlert; } #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 UIUserNotificationType UserNotificationTypes = UIUserNotificationTypeNone; if ([badgeArg isKindOfClass:[NSString class]]) { if ([badgeArg isEqualToString:@"true"]) { UserNotificationTypes |= UIUserNotificationTypeBadge; } } else if ([badgeArg boolValue]) { UserNotificationTypes |= UIUserNotificationTypeBadge; } if ([soundArg isKindOfClass:[NSString class]]) { if ([soundArg isEqualToString:@"true"]) { UserNotificationTypes |= UIUserNotificationTypeSound; } } else if ([soundArg boolValue]) { UserNotificationTypes |= UIUserNotificationTypeSound; } if ([alertArg isKindOfClass:[NSString class]]) { if ([alertArg isEqualToString:@"true"]) { UserNotificationTypes |= UIUserNotificationTypeAlert; } } else if ([alertArg boolValue]) { UserNotificationTypes |= UIUserNotificationTypeAlert; } notificationTypes |= UIRemoteNotificationTypeNewsstandContentAvailability; UserNotificationTypes |= UIUserNotificationActivationModeBackground; UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UserNotificationTypes categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; [[UIApplication sharedApplication] registerForRemoteNotifications]; #endif self.callback = [options objectForKey:@"ecb"]; if (notificationTypes == UIRemoteNotificationTypeNone) Loading @@ -102,14 +134,6 @@ 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 +38 −14 Changes for src/ios/PushPlugin.m: 38 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ NSMutableDictionary* options = [command.arguments objectAtIndex:0]; UIUserNotificationType UserNotificationTypes = UIUserNotificationTypeNone; UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeNone; id badgeArg = [options objectForKey:@"badge"]; Loading @@ -60,41 +59,74 @@ { if ([badgeArg isEqualToString:@"true"]) { notificationTypes |= UIRemoteNotificationTypeBadge; UserNotificationTypes |= UIUserNotificationTypeBadge; } } else if ([badgeArg boolValue]) { notificationTypes |= UIRemoteNotificationTypeBadge; UserNotificationTypes |= UIUserNotificationTypeBadge; } if ([soundArg isKindOfClass:[NSString class]]) { if ([soundArg isEqualToString:@"true"]) { notificationTypes |= UIRemoteNotificationTypeSound; UserNotificationTypes |= UIUserNotificationTypeSound; } } else if ([soundArg boolValue]) { notificationTypes |= UIRemoteNotificationTypeSound; UserNotificationTypes |= UIUserNotificationTypeSound; } if ([alertArg isKindOfClass:[NSString class]]) { if ([alertArg isEqualToString:@"true"]) { notificationTypes |= UIRemoteNotificationTypeAlert; UserNotificationTypes |= UIUserNotificationTypeAlert; } } else if ([alertArg boolValue]) { notificationTypes |= UIRemoteNotificationTypeAlert; } #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 UIUserNotificationType UserNotificationTypes = UIUserNotificationTypeNone; if ([badgeArg isKindOfClass:[NSString class]]) { if ([badgeArg isEqualToString:@"true"]) { UserNotificationTypes |= UIUserNotificationTypeBadge; } } else if ([badgeArg boolValue]) { UserNotificationTypes |= UIUserNotificationTypeBadge; } if ([soundArg isKindOfClass:[NSString class]]) { if ([soundArg isEqualToString:@"true"]) { UserNotificationTypes |= UIUserNotificationTypeSound; } } else if ([soundArg boolValue]) { UserNotificationTypes |= UIUserNotificationTypeSound; } if ([alertArg isKindOfClass:[NSString class]]) { if ([alertArg isEqualToString:@"true"]) { UserNotificationTypes |= UIUserNotificationTypeAlert; } } else if ([alertArg boolValue]) { UserNotificationTypes |= UIUserNotificationTypeAlert; } notificationTypes |= UIRemoteNotificationTypeNewsstandContentAvailability; UserNotificationTypes |= UIUserNotificationActivationModeBackground; UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UserNotificationTypes categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; [[UIApplication sharedApplication] registerForRemoteNotifications]; #endif self.callback = [options objectForKey:@"ecb"]; if (notificationTypes == UIRemoteNotificationTypeNone) Loading @@ -102,14 +134,6 @@ 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