Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Improve error for sites using os.tc subdomain #1139

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/shared/utils/OneSignalUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading