Commit fa87fdc5 by Sebastián Katzer

Merge pull request #280 from timothyjasonwilliams/0.7

correctly check ios version
parents f82b9d32 24354dce
...@@ -238,18 +238,18 @@ ...@@ -238,18 +238,18 @@
*/ */
- (void) promptForPermission:(CDVInvokedUrlCommand *)command - (void) promptForPermission:(CDVInvokedUrlCommand *)command
{ {
#ifdef __IPHONE_8_0 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
UIUserNotificationType types = UIUserNotificationType types =
UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound; UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:types
categories:nil]; categories:nil];
[self.commandDelegate runInBackground:^{ [self.commandDelegate runInBackground:^{
[[UIApplication sharedApplication] [[UIApplication sharedApplication]
registerUserNotificationSettings:settings]; registerUserNotificationSettings:settings];
}]; }];
#endif }
} }
/** /**
...@@ -257,17 +257,17 @@ ...@@ -257,17 +257,17 @@
*/ */
- (BOOL) hasPermissionToSheduleNotifications - (BOOL) hasPermissionToSheduleNotifications
{ {
#ifdef __IPHONE_8_0 if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {
UIUserNotificationSettings *settings = [[UIApplication sharedApplication] UIUserNotificationSettings *settings = [[UIApplication sharedApplication]
currentUserNotificationSettings]; currentUserNotificationSettings];
UIUserNotificationType requiredTypes = UIUserNotificationType requiredTypes =
UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound; UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound;
return (settings.types & requiredTypes); return (settings.types & requiredTypes);
#else } else {
return YES; return YES;
#endif }
} }
/** /**
......
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