fix: theme entitlement logic
This commit is contained in:
@@ -100,20 +100,6 @@ export class ThemeManager extends ApplicationService {
|
|||||||
this.setThemeAsPerColorScheme(prefersDarkColorScheme.matches);
|
this.setThemeAsPerColorScheme(prefersDarkColorScheme.matches);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ApplicationEvent.LocalDataLoaded: {
|
|
||||||
const themes = this.application.getDisplayableItems(
|
|
||||||
ContentType.Theme
|
|
||||||
) as SNTheme[];
|
|
||||||
themes.forEach((theme) => {
|
|
||||||
if (
|
|
||||||
theme.active &&
|
|
||||||
this.application.getFeatureStatus(theme.identifier) !==
|
|
||||||
FeatureStatus.Entitled
|
|
||||||
) {
|
|
||||||
this.application.toggleTheme(theme);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,13 +123,19 @@ export class ThemeManager extends ApplicationService {
|
|||||||
let hasChange = false;
|
let hasChange = false;
|
||||||
for (const themeUuid of this.activeThemes) {
|
for (const themeUuid of this.activeThemes) {
|
||||||
const theme = this.application.findItem(themeUuid) as SNTheme;
|
const theme = this.application.findItem(themeUuid) as SNTheme;
|
||||||
if (
|
if (!theme) {
|
||||||
!theme ||
|
|
||||||
this.application.getFeatureStatus(theme.identifier) !==
|
|
||||||
FeatureStatus.Entitled
|
|
||||||
) {
|
|
||||||
this.deactivateTheme(themeUuid);
|
this.deactivateTheme(themeUuid);
|
||||||
hasChange = true;
|
hasChange = true;
|
||||||
|
} else {
|
||||||
|
const status = this.application.getFeatureStatus(theme.identifier);
|
||||||
|
if (status !== FeatureStatus.Entitled) {
|
||||||
|
if (theme.active) {
|
||||||
|
this.application.toggleTheme(theme);
|
||||||
|
} else {
|
||||||
|
this.deactivateTheme(theme.uuid);
|
||||||
|
}
|
||||||
|
hasChange = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user