So a little more digging today on the lost push notifications. It does appear that push subscriptions are lost for Safari (desktop version as well as PWA) due the above (more specifically, Safari requires a user gesture to re-enable push notifications even if
Notification.permission = "granted"
already). Chrome (probably other browsers too, but I'm only testing with Chrome and Safari right now)
does not require a user gesture to re-enable push notifications.
So in the case where a two-step auth (maybe other places as well) unsubscribes from notifications, only to resubscribe later, that mechanism works in Chrome, but not Safari.
You can test this by going to browser console and running:
JavaScript:
XF.PWA.getRegistration()
.then(function(registration)
{
return registration.pushManager.getSubscription();
})
.then(function(subscription)
{
subscription.unsubscribe();
});
Reload the page and then run this in the browser console:
JavaScript:
XF.Push.handleSubscribeAction(true);
...in Chrome the push subscription was re-enabled and you can see the request being made to
misc/update-push-subscription
on the Network tab.
Do the exact same thing in Safari (desktop or PWA) and you are met with an error:
Code:
Notification prompting can only be done from a user gesture.
Permission was not granted
TL;DR: Safari/PWA requires a user gesture to subscribe to a push notification, even if permission was already granted.