"Lost" push subscriptions for iOS PWA

Ah ha this explains some of the questions I'm getting re notifications.
You should just be able to enable push notifications again in your preferences.
Ah ha! This explains some of the questions I'm getting re notifications.

When this occurs do push notifications show in preferences as enabled or disabled?
In Preferences do you have to disable then enable and then save to reset?
 
I was able to pinpoint another place that push notifications are being forcibly unsubscribed when they shouldn't be... When a user needs to redo their two-step authentication, the two-step page has no XF.config.userId set, so the browser (and PWA) is told to unsubscribe from push notifications.

JavaScript:
if (XF.config.userId && isExpectedServerKey(subscription))
{
    XF.Push.updateUserSubscription(subscription, 'update');
}
else
{
    subscription.unsubscribe();
    XF.Push.updateUserSubscription(subscription, 'unsubscribe');
}

The browser/PWA is left in a state where Notification.permission = "granted" but XF.Push.isSubscribed = false. And you can't programmatically resubscribe because the browser only allows a push subscription to "start" (since it was killed on the two-step page) with a user gesture.

Code:
XF.Push.handleSubscribeAction(true);

>> Notification prompting can only be done from a user gesture.

TL;DR: Push notification permissions are completely wiped out when the user needs to do a two-step auth (after 30 days by default).
 
Top Bottom