Skip to content

Commit

Permalink
improve comments
Browse files Browse the repository at this point in the history
Also removed Firefox ESR message as this build supports push now.
  • Loading branch information
jkasten2 committed Nov 15, 2023
1 parent 2260364 commit 9fb9870
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/page/utils/BrowserSupportsPush.ts
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -7,15 +9,17 @@ 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() &&
navigator.platform === 'MacIntel'
); // isMacOS
}

// Does the browser support legacy Safari push? (only available on macOS)
export function supportsSafariPush(): boolean {
return (
(window.safari && typeof window.safari.pushNotification !== 'undefined') ||
Expand Down Expand Up @@ -56,4 +60,3 @@ function isSafariBrowser(): boolean {
// Firefox
// Normal - typeof PushSubscriptionOptions == "function"
// HTTP & HTTPS - typeof PushSubscriptionOptions == "function"
// ESR - typeof PushSubscriptionOptions == "undefined"

0 comments on commit 9fb9870

Please sign in to comment.