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() {
const cachedThemes = await this.getCachedThemes();
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)) {
return;
}
if (
!skipEntitlementCheck &&
this.application.getFeatureStatus(theme.identifier) !==
FeatureStatus.Entitled
FeatureStatus.Entitled
) {
return;
}
this.activeThemes.push(theme.uuid);
const url = this.application.componentManager.urlForComponent(theme);
if (!url) {
return;
}
this.activeThemes.push(theme.uuid);
const link = document.createElement('link');
link.href = url;
link.type = 'text/css';