Skip to content

Commit 1ceef97

Browse files
authored
Merge pull request #1009 from OneSignal/fix/safari_revoke_from_rr
Disable confirmed delivery for Safari
2 parents 763f324 + 40f732b commit 1ceef97

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/service-worker/ServiceWorker.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,9 @@ export class ServiceWorker {
345345
if (!notification)
346346
return null;
347347

348+
if (!ServiceWorker.browserSupportsConfirmedDelivery())
349+
return null;
350+
348351
// Received receipts enabled?
349352
if (notification.rr !== "y")
350353
return null;
@@ -375,6 +378,19 @@ export class ServiceWorker {
375378
return await OneSignalApiBase.put(`notifications/${notification.id}/report_received`, postData);
376379
}
377380

381+
/**
382+
* Confirmed Delivery isn't supported on Safari since they are very strict about the amount
383+
* of time you have to finish the onpush event. Spending to much time in the onpush event
384+
* will cause the push endpoint to become revoked!, causing the device to stop receiving pushes!
385+
*
386+
* iPadOS 16.4 it was observed to be only about 10 secounds.
387+
* macOS 13.3 didn't seem to have this restriction when testing up to a 25 secound delay, however
388+
* to be safe we are disabling it for all Safari browsers.
389+
*/
390+
static browserSupportsConfirmedDelivery(): boolean {
391+
return !bowser.safari
392+
}
393+
378394
/**
379395
* Gets an array of active window clients along with whether each window client is the HTTP site's iFrame or an
380396
* HTTPS site page.

0 commit comments

Comments
 (0)