OneSignal / react-onesignal

React OneSignal Module: Make it easy to integrate OneSignal with your React App!
Other
74 stars 23 forks source link

[Bug]: Notification permission status evaluates to incorrect value after setting and immediately closing app #138

Open iAmWillShepherd opened 3 months ago

iAmWillShepherd commented 3 months ago

What happened?

When using react-onesignal@3.0.1 in a Safari Mobile PWA, the permission status does not correctly reflect "denied" after a user initially denies notification permissions.

What browsers are you seeing the problem on?

Safari

What operating system are you running?

iOS 16+

Steps to reproduce?

1. Initially, `OneSignal.Notifications.permissionNative` correctly evaluates to  "default".
2. The user denies the notification permission when prompted and closes the app.
3. Upon reopening the app, the permission status is still evaluated to "default" instead of "denied."
4. The permission is correctly evaluated as "denied" only after re-requesting permission.
5. The app must know the actual permission value on the initial load after the user has denied permission.
6. Attempted to get the correct status using `OneSignalDeferred` and `OneSignal.Notifications.permissionNative`.

What did you expect to happen?

For OneSignal.Notifications.permissionNative to evaluate to "denied" right after the app is reopened following an initial permission denial.

Relevant log output

No response