From 9fb987061ee2d69443e9157c09b4e59807043f88 Mon Sep 17 00:00:00 2001 From: Josh Kasten Date: Wed, 15 Nov 2023 19:47:15 +0000 Subject: [PATCH] improve comments Also removed Firefox ESR message as this build supports push now. --- src/page/utils/BrowserSupportsPush.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/page/utils/BrowserSupportsPush.ts b/src/page/utils/BrowserSupportsPush.ts index 418ae302c..f42a45104 100644 --- a/src/page/utils/BrowserSupportsPush.ts +++ b/src/page/utils/BrowserSupportsPush.ts @@ -1,3 +1,5 @@ +// Light weight JS to detect browsers push notification capabilities +// // This is used by the OneSignalSDK.page.js shim // DO NOT add other imports since it is an ES5 target and dead code imports can't be clean up. @@ -7,8 +9,9 @@ export function isPushNotificationsSupported() { return supportsVapidPush() || supportsSafariPush(); } +// Fallback detection for Safari on macOS in an iframe context +// - window.safari is undefined in this context export function isMacOSSafariInIframe(): boolean { - // Fallback detection for Safari on macOS in an iframe context return ( window.top !== window && // isContextIframe isSafariBrowser() && @@ -16,6 +19,7 @@ export function isMacOSSafariInIframe(): boolean { ); // isMacOS } +// Does the browser support legacy Safari push? (only available on macOS) export function supportsSafariPush(): boolean { return ( (window.safari && typeof window.safari.pushNotification !== 'undefined') || @@ -56,4 +60,3 @@ function isSafariBrowser(): boolean { // Firefox // Normal - typeof PushSubscriptionOptions == "function" // HTTP & HTTPS - typeof PushSubscriptionOptions == "function" -// ESR - typeof PushSubscriptionOptions == "undefined"