From 952ddac924013b85f622e6c4760f49997e62df8a Mon Sep 17 00:00:00 2001 From: Rodrigo Gomez Palacio Date: Tue, 14 Feb 2023 14:20:01 -0800 Subject: [PATCH] feat: refactor images location for static assets Point to our new static assets location media.onesignal.com/web-sdk to retrieve static assets like for example our bell. --- src/page/bell/Dialog.ts | 2 +- src/shared/managers/SdkEnvironment.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/page/bell/Dialog.ts b/src/page/bell/Dialog.ts index 3470a773c..2c76e5d89 100755 --- a/src/page/bell/Dialog.ts +++ b/src/page/bell/Dialog.ts @@ -91,7 +91,7 @@ export default class Dialog extends AnimatedElement { let instructionsHtml = ''; if (imageUrl) { - imageUrl = SdkEnvironment.getOneSignalApiUrl().origin + imageUrl; + imageUrl = SdkEnvironment.getOneSignalStaticResourcesUrl() + imageUrl; instructionsHtml = ``; } diff --git a/src/shared/managers/SdkEnvironment.ts b/src/shared/managers/SdkEnvironment.ts index f4d182227..16e4384f4 100644 --- a/src/shared/managers/SdkEnvironment.ts +++ b/src/shared/managers/SdkEnvironment.ts @@ -280,6 +280,13 @@ export default class SdkEnvironment { } } + /** + * Returns the URL object pointing to our static resources location + */ + public static getOneSignalStaticResourcesUrl(): URL { + return new URL('https://media.onesignal.com/web-sdk'); + } + public static getOneSignalResourceUrlPath(buildEnv: EnvironmentKind = SdkEnvironment.getBuildEnv()): URL { const buildOrigin = (typeof __BUILD_ORIGIN__ !== "undefined") ? __BUILD_ORIGIN__ || "localhost" : "localhost"; const isHttps = (typeof __IS_HTTPS__ !== "undefined") ? __IS_HTTPS__ : true;