wix / react-native-notifications

React Native Notifications
MIT License
3.25k stars 764 forks source link

Exposes new event: remoteNotificationsRegistrationDenied #844

Closed artdevgame closed 2 years ago

artdevgame commented 2 years ago

On iOS, calling requestPermissions causes a permission dialog to appear.

image

Pressing OK in this dialog will eventually emit a registerRemoteNotificationsRegistered or registerRemoteNotificationsFailed event.

However, there's no event emitted if the user chooses "Don't Allow", so if the implementor is attempting to do something in their app depending on which action has been taken, they are unable to do so.

This work exposes a new event called: remoteNotificationsRegistrationDenied that is emitted when requestAuthorizationWithOptions has been executed without error but with granted set to 'NO'.

Related:

artdevgame commented 2 years ago

@DanielEliraz I don't normally work with Objective-C, so there's probably improvements that need to be made. Could you help me work through any please?

artdevgame commented 2 years ago

Recreated PR because GitHub had an issue whilst creating this one: https://github.com/wix/react-native-notifications/pull/845