fix: activate cached themes without entitlement check

This commit is contained in:
Mo
2022-02-18 07:53:39 -06:00
parent a47556b840
commit b8e242cbee

View File

@@ -160,7 +160,7 @@ export class ThemeManager extends ApplicationService {
private async activateCachedThemes() { private async activateCachedThemes() {
const cachedThemes = await this.getCachedThemes(); const cachedThemes = await this.getCachedThemes();
for (const theme of cachedThemes) { for (const theme of cachedThemes) {
this.activateTheme(theme); this.activateTheme(theme, true);
} }
} }
@@ -202,22 +202,26 @@ export class ThemeManager extends ApplicationService {
} }
} }
private activateTheme(theme: SNTheme) { private activateTheme(theme: SNTheme, skipEntitlementCheck = false) {
if (this.activeThemes.find((uuid) => uuid === theme.uuid)) { if (this.activeThemes.find((uuid) => uuid === theme.uuid)) {
return; return;
} }
if ( if (
!skipEntitlementCheck &&
this.application.getFeatureStatus(theme.identifier) !== this.application.getFeatureStatus(theme.identifier) !==
FeatureStatus.Entitled FeatureStatus.Entitled
) { ) {
return; return;
} }
this.activeThemes.push(theme.uuid);
const url = this.application.componentManager.urlForComponent(theme); const url = this.application.componentManager.urlForComponent(theme);
if (!url) { if (!url) {
return; return;
} }
this.activeThemes.push(theme.uuid);
const link = document.createElement('link'); const link = document.createElement('link');
link.href = url; link.href = url;
link.type = 'text/css'; link.type = 'text/css';