From 22603648b2b287b077103be5957755797bfd3d65 Mon Sep 17 00:00:00 2001 From: Josh Kasten Date: Wed, 15 Nov 2023 19:46:16 +0000 Subject: [PATCH] improve DX by showing helpful iOS message --- src/page/utils/OneSignalShimLoader.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/page/utils/OneSignalShimLoader.ts b/src/page/utils/OneSignalShimLoader.ts index c4fa48730..39d8391e2 100644 --- a/src/page/utils/OneSignalShimLoader.ts +++ b/src/page/utils/OneSignalShimLoader.ts @@ -1,4 +1,7 @@ -import { isPushNotificationsSupported } from './BrowserSupportsPush'; +import { + isIosSafari, + isPushNotificationsSupported, +} from './BrowserSupportsPush'; // NOTE: Careful if adding imports, ES5 targets can't clean up functions never called. // See sdk.ts for what entry points this handles @@ -55,7 +58,16 @@ export class OneSignalShimLoader { if (isPushNotificationsSupported()) { OneSignalShimLoader.loadFullPageSDK(); } else { - console.log('OneSignal: SDK is not compatible with this browser.'); + this.printEnvironmentNotSupported(); } } + + private static printEnvironmentNotSupported() { + let logMessage = 'OneSignal: SDK is not compatible with this browser.'; + if (isIosSafari()) { + logMessage += + ' To support iOS please install as a Web App. See the OneSignal guide https://documentation.onesignal.com/docs/safari-web-push-for-ios'; + } + console.log(logMessage); + } }