diff --git a/playground/index.ts b/playground/index.ts index 51d91aa5..aa0ce36d 100644 --- a/playground/index.ts +++ b/playground/index.ts @@ -6,6 +6,7 @@ import { getMozAppearanceSupport, isAndroid, isDesktopWebKit, + isIPad, } from '../src/utils/browser' import './style.css' @@ -44,6 +45,7 @@ const runDetection = async (): Promise => { mozAppearanceSupport: getMozAppearanceSupport(), isAndroid: isAndroid(), isDesktopWebKit: isDesktopWebKit(), + isIPad: isIPad(), } return { diff --git a/src/sources/notification_permissions.ts b/src/sources/notification_permissions.ts index cb8386ba..3c7f7d3b 100644 --- a/src/sources/notification_permissions.ts +++ b/src/sources/notification_permissions.ts @@ -1,7 +1,12 @@ -import { BotdError, State } from '../types' +import { BotdError, BrowserEngineKind, State } from '../types' +import { getBrowserEngineKind, isDesktopWebKit } from '../utils/browser' export default async function getNotificationPermissions(): Promise { if (window.Notification === undefined) { + // if on mobile ios, ignore + if (getBrowserEngineKind() === BrowserEngineKind.Webkit && !isDesktopWebKit()) { + return false + } throw new BotdError(State.Undefined, 'window.Notification is undefined') } if (navigator.permissions === undefined) {