fix: Fixed issue with system color scheme not being applied correctly on start

This commit is contained in:
Aman Harwara
2024-03-23 00:01:54 +05:30
parent f868989bb5
commit 7967ddead7
3 changed files with 4 additions and 4 deletions

View File

@@ -36,7 +36,7 @@ export interface ComponentManagerInterface {
getDefaultEditorIdentifier(currentTag?: SNTag): string getDefaultEditorIdentifier(currentTag?: SNTag): string
isThemeActive(theme: UIFeature<ThemeFeatureDescription>): boolean isThemeActive(theme: UIFeature<ThemeFeatureDescription>): boolean
toggleTheme(theme: UIFeature<ThemeFeatureDescription>): Promise<void> toggleTheme(theme: UIFeature<ThemeFeatureDescription>, skipEntitlementCheck?: boolean): Promise<void>
getActiveThemes(): UIFeature<ThemeFeatureDescription>[] getActiveThemes(): UIFeature<ThemeFeatureDescription>[]
getActiveThemesIdentifiers(): { features: NativeFeatureIdentifier[]; uuids: Uuid[] } getActiveThemesIdentifiers(): { features: NativeFeatureIdentifier[]; uuids: Uuid[] }

View File

@@ -390,7 +390,7 @@ export class ComponentManager
return this.viewers.find((viewer) => viewer.sessionKey === key) return this.viewers.find((viewer) => viewer.sessionKey === key)
} }
public async toggleTheme(uiFeature: UIFeature<ThemeFeatureDescription>): Promise<void> { public async toggleTheme(uiFeature: UIFeature<ThemeFeatureDescription>, skipEntitlementCheck = false): Promise<void> {
this.logger.info('Toggling theme', uiFeature.uniqueIdentifier) this.logger.info('Toggling theme', uiFeature.uniqueIdentifier)
if (this.isThemeActive(uiFeature)) { if (this.isThemeActive(uiFeature)) {
@@ -399,7 +399,7 @@ export class ComponentManager
} }
const featureStatus = this.features.getFeatureStatus(uiFeature.uniqueIdentifier) const featureStatus = this.features.getFeatureStatus(uiFeature.uniqueIdentifier)
if (featureStatus !== FeatureStatus.Entitled) { if (!skipEntitlementCheck && featureStatus !== FeatureStatus.Entitled) {
return return
} }

View File

@@ -247,7 +247,7 @@ export class ThemeManager extends AbstractUIService {
} else { } else {
const theme = themes.find((theme) => theme.featureIdentifier === themeIdentifier) const theme = themes.find((theme) => theme.featureIdentifier === themeIdentifier)
if (theme && !this.components.isThemeActive(theme)) { if (theme && !this.components.isThemeActive(theme)) {
this.components.toggleTheme(theme).catch(console.error) this.components.toggleTheme(theme, true).catch(console.error)
} }
} }
} }