diff --git a/packages/services/src/Domain/Component/ComponentManagerInterface.ts b/packages/services/src/Domain/Component/ComponentManagerInterface.ts index e27c765fe..e2161a195 100644 --- a/packages/services/src/Domain/Component/ComponentManagerInterface.ts +++ b/packages/services/src/Domain/Component/ComponentManagerInterface.ts @@ -36,7 +36,7 @@ export interface ComponentManagerInterface { getDefaultEditorIdentifier(currentTag?: SNTag): string isThemeActive(theme: UIFeature): boolean - toggleTheme(theme: UIFeature): Promise + toggleTheme(theme: UIFeature, skipEntitlementCheck?: boolean): Promise getActiveThemes(): UIFeature[] getActiveThemesIdentifiers(): { features: NativeFeatureIdentifier[]; uuids: Uuid[] } diff --git a/packages/snjs/lib/Services/ComponentManager/ComponentManager.ts b/packages/snjs/lib/Services/ComponentManager/ComponentManager.ts index 87f532d04..4773b2a77 100644 --- a/packages/snjs/lib/Services/ComponentManager/ComponentManager.ts +++ b/packages/snjs/lib/Services/ComponentManager/ComponentManager.ts @@ -390,7 +390,7 @@ export class ComponentManager return this.viewers.find((viewer) => viewer.sessionKey === key) } - public async toggleTheme(uiFeature: UIFeature): Promise { + public async toggleTheme(uiFeature: UIFeature, skipEntitlementCheck = false): Promise { this.logger.info('Toggling theme', uiFeature.uniqueIdentifier) if (this.isThemeActive(uiFeature)) { @@ -399,7 +399,7 @@ export class ComponentManager } const featureStatus = this.features.getFeatureStatus(uiFeature.uniqueIdentifier) - if (featureStatus !== FeatureStatus.Entitled) { + if (!skipEntitlementCheck && featureStatus !== FeatureStatus.Entitled) { return } diff --git a/packages/ui-services/src/Theme/ThemeManager.ts b/packages/ui-services/src/Theme/ThemeManager.ts index a36bd0bcc..72892f6be 100644 --- a/packages/ui-services/src/Theme/ThemeManager.ts +++ b/packages/ui-services/src/Theme/ThemeManager.ts @@ -247,7 +247,7 @@ export class ThemeManager extends AbstractUIService { } else { const theme = themes.find((theme) => theme.featureIdentifier === themeIdentifier) if (theme && !this.components.isThemeActive(theme)) { - this.components.toggleTheme(theme).catch(console.error) + this.components.toggleTheme(theme, true).catch(console.error) } } }