Skip to content
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

[Bug]: OneSignal.Notifications.permission only updated after event permissionChange is fired (160001) #1091

Open
lmeurs opened this issue Aug 18, 2023 · 2 comments

Comments

@lmeurs
Copy link

lmeurs commented Aug 18, 2023

What happened?

OneSignal.Notifications.permission and OneSignal.Notifications.permissionNative are only updated after event permissionChange is fired, so the following example outputs two different permissions:

OneSignal.Notifications.addEventListener('permissionChange', function(permission) {
  console.log(permission);
  console.log(OneSignal.Notifications.permission);
});

I can imagine this is intended behaviour, but then a custom event handler cannot update the DOM relying on OneSignal.Notifications.permission and OneSignal.Notifications.permissionNative. A workaround is adding a minor timeout (ugh!) inside the event handler.

What browsers are you seeing the problem on?

Chrome (Chromium)

What operating system are you running?

W11

Steps to reproduce?

See issue description

What did you expect to happen?

See issue description

Relevant log output

No response

@lmeurs lmeurs changed the title [Bug]: OneSignal.Notifications.permission only updated after event permissionChange is fired [Bug]: OneSignal.Notifications.permission only updated after event permissionChange is fired (160001) Aug 18, 2023
@jkasten2
Copy link
Member

@lmeurs Thanks for reporting!

I get your use-case here, those states should definitely match up! We will look into addressing this bug.

@lmeurs
Copy link
Author

lmeurs commented Aug 29, 2023

Hi @jkasten2, thank you for your comment! Do you have an update for us? Can you give an estimate when this will be picked up / fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants