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: 10 additions & 0 deletions src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ - (void)register:(CDVInvokedUrlCommand*)command;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
UIUserNotificationType UserNotificationTypes = UIUserNotificationTypeNone;
#endif

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
// Check if notification is disabled by user, and call error handler if no notification is enabled
UIUserNotificationSettings *currentUserNotificationSettings = [[UIApplication sharedApplication] currentUserNotificationSettings];

if (!currentUserNotificationSettings || (currentUserNotificationSettings.types == UIUserNotificationTypeNone)) {
[self failWithMessage:@"User disabled all notifications." withError:nil];
}
#endif

UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeNone;

id badgeArg = [options objectForKey:@"badge"];
Expand Down