main ← DrChat:pushnotifs
closed 02:16AM - 11 Jun 26 UTC
https://meta.discourse.org/t/enabling-push-notifications-does-not-actually-subsc…ribe-if-consent-is-required/381043
Discourse currently supports two different types of notifications:
* Desktop (browser) notifications: these are used on desktop when the user has a Discourse tab open but idle.
* Push notifications: these are used both for desktop and mobile to notify a user about activity when they may not have any Discourse tabs open.
There is some amount of conflation of these two distinct types, and on iOS I've observed that users can enable the former notifications but not the latter (and the former is useless on mobile).
There should be a stronger distinction between the two types, and mobile devices should _never_ go down the former path since they will typically never have Discourse open in the background!
---
This pull request does the following:
* App startup is deferred until the service worker is installed (previously: this was done asynchronously). The registration is now available in a global.
* The notification consent banner is now displayed when the device supports notifications (previously: only in PWA). This change will be **widely visible to all users of Discourse**.
* The dismissal state for the notification consent banner has been reset for all users.
* If push notifications are preferred, we no longer implicitly fall back to desktop notifications and they are _implicitly disabled if already enabled_.
* Added a new getter to the notification consent banner that can be used to determine if a PWA is needed (`isPushPwaNeeded()`)