diff --git a/src/shared/utils/OneSignalUtils.ts b/src/shared/utils/OneSignalUtils.ts index ad2316c17..8d20c6552 100644 --- a/src/shared/utils/OneSignalUtils.ts +++ b/src/shared/utils/OneSignalUtils.ts @@ -72,11 +72,26 @@ export class OneSignalUtils { } const windowEnv = SdkEnvironment.getWindowEnv(); - return ( + + const isHttp = location.protocol === 'http:'; + const useSubdomain = (windowEnv === WindowEnvironmentKind.Host || windowEnv === WindowEnvironmentKind.CustomIframe) && - (!!subdomain || location.protocol === 'http:') - ); + (!!subdomain || isHttp); + + if (useSubdomain) { + if (isHttp) { + throw new Error( + "OneSignalSDK: HTTP sites are no longer supported starting with version 16 (User Model), your public site must start with https://. Please visit the OneSignal dashboard's Settings > Web Configuration to find this option.", + ); + } else { + throw new Error( + 'OneSignalSDK: The "My site is not fully HTTPS" option is no longer supported starting with version 16 (User Model) of the OneSignal SDK. Please visit the OneSignal dashboard\'s Settings > Web Configuration to find this option.', + ); + } + } + + return false; } public static redetectBrowserUserAgent(): IBowser {