pusher / push-notifications-web

Beams Browser notifications
MIT License
39 stars 20 forks source link

Fix SDK state bug #60

Closed TomKemp closed 4 years ago

TomKemp commented 4 years ago

If the browser notification permissions are changed while the page is open then the state returned by the getRegistrationState method will be incorrect. The SDK will still be in the "registered with Beams" state despite not having the browser permission, which is not one of the possible states returned by getRegistrationState.

This PR fixes that by reconciling the SDK state before any access of the SDK. In the future, we may add listeners to allow users to detect changes in state.