Fix iOS having notification token revoked

This commit is contained in:
Nicolas Mowen 2026-03-23 17:46:23 -06:00
parent 573a5ede62
commit fb4b37c337

View File

@ -19,6 +19,9 @@ self.addEventListener("push", function (event) {
break; break;
} }
// event.waitUntil is required on iOS Safari — without it, the browser
// may consider this a "silent push" and revoke the subscription after 3 occurrences.
event.waitUntil(
// @ts-expect-error we know this exists // @ts-expect-error we know this exists
self.registration.showNotification(data.title, { self.registration.showNotification(data.title, {
body: data.message, body: data.message,
@ -28,7 +31,8 @@ self.addEventListener("push", function (event) {
tag: data.id, tag: data.id,
data: { id: data.id, link: data.direct_url }, data: { id: data.id, link: data.direct_url },
actions, actions,
}); }), // eslint-disable-line comma-dangle
);
} else { } else {
// pass // pass
// This push event has no data // This push event has no data