Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ - (void)isEnabled:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)op
}
*/

#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)

- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

NSMutableDictionary *results = [NSMutableDictionary dictionary];
Expand All @@ -156,7 +158,13 @@ - (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[results setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] forKey:@"appVersion"];

// Check what Notifications the user has turned on. We registered for all three, but they may have manually disabled some or all of them.
NSUInteger rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
//NSUInteger rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
NSUInteger rntypes;
if (!SYSTEM_VERSION_LESS_THAN(@"8.0")) {
rntypes = [[[UIApplication sharedApplication] currentUserNotificationSettings] types];
}else{
rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
}

// Set the defaults to disabled unless we find otherwise...
NSString *pushBadge = @"disabled";
Expand Down