-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
registerForPushNotifications should return a promise #53
Comments
More than happy to accept PR for this. |
@jkasten2 can you help on this? |
OneSignal SDK does not allow me to do that. Also, For my best understanding, there is no way to actually know if the user accepted the push notifications dialog or not. But, it's possible to check if the notifications are enabled at a later time. + (BOOL)isPushNotificationsEnabled {
BOOL isEnabled = NO;
if ([[UIApplication sharedApplication] respondsToSelector:@selector(currentUserNotificationSettings)]){
UIUserNotificationSettings *notificationSettings = [[UIApplication sharedApplication] currentUserNotificationSettings];
if (!notificationSettings || (notificationSettings.types == UIUserNotificationTypeNone)) {
isEnabled = NO;
} else {
isEnabled = YES;
}
} else {
UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
if (types & UIRemoteNotificationTypeAlert) {
isEnabled = YES;
} else{
isEnabled = NO;
}
}
return isEnabled;
} When you'll ask for |
Well, I took some inspiration from |
Thanks! |
@avishayil so there is no way to know when the user has chosen I know we can check the current permissions with Aren't you guys just using the native code that PushNotificationIOS is doing? Can't you use what they are? Should I just call Also, it would be helpful to update export function checkPermissions() {
return new Promise(resolve => {
OneSignal.checkPermissions(resolve);
});
} |
@dwilt you can use AppState and call |
Would really like to see Promise functionality for |
Please enhance
registerForPushNotifications
so that it will return a promise mimicking: requestPermissionsFrom the doc it says:
I'm searching a way to know whether the user has accepted the notification permission or not.
The text was updated successfully, but these errors were encountered: