Skip to content

Commit

Permalink
feat: refactor images location for static assets
Browse files Browse the repository at this point in the history
Point to our new static assets location media.onesignal.com/web-sdk to
retrieve static assets like for example our bell.
  • Loading branch information
rgomezp committed Feb 14, 2023
1 parent f8adabb commit 952ddac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/page/bell/Dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default class Dialog extends AnimatedElement {

let instructionsHtml = '';
if (imageUrl) {
imageUrl = SdkEnvironment.getOneSignalApiUrl().origin + imageUrl;
imageUrl = SdkEnvironment.getOneSignalStaticResourcesUrl() + imageUrl;
instructionsHtml = `<a href="${imageUrl}" target="_blank"><img src="${imageUrl}"></a></div>`;
}

Expand Down
7 changes: 7 additions & 0 deletions src/shared/managers/SdkEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 952ddac

Please sign in to comment.