mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[PM-15892] [PM-12250]Remove nord and remnants from solarizedark (#13449)
* Remove nord and remnants from solarizedark * Update window reload color * Remove extension-refresh feature flag from clients (#13450) Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com> * Remove usage of nord and solarized themes within DarkImageDirective --------- Co-authored-by: Daniel James Smith <2670567+djsmith85@users.noreply.github.com> Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
@@ -27,7 +27,6 @@ export enum FeatureFlag {
|
||||
CriticalApps = "pm-14466-risk-insights-critical-application",
|
||||
EnableRiskInsightsNotifications = "enable-risk-insights-notifications",
|
||||
|
||||
ExtensionRefresh = "extension-refresh",
|
||||
PM4154_BulkEncryptionService = "PM-4154-bulk-encryption-service",
|
||||
VaultBulkManagementAction = "vault-bulk-management-action",
|
||||
UnauthenticatedExtensionUIRefresh = "unauth-ui-refresh",
|
||||
@@ -83,7 +82,6 @@ export const DefaultFeatureFlagValue = {
|
||||
[FeatureFlag.CriticalApps]: FALSE,
|
||||
[FeatureFlag.EnableRiskInsightsNotifications]: FALSE,
|
||||
|
||||
[FeatureFlag.ExtensionRefresh]: FALSE,
|
||||
[FeatureFlag.PM4154_BulkEncryptionService]: FALSE,
|
||||
[FeatureFlag.VaultBulkManagementAction]: FALSE,
|
||||
[FeatureFlag.UnauthenticatedExtensionUIRefresh]: FALSE,
|
||||
|
||||
@@ -5,16 +5,12 @@ export enum ThemeType {
|
||||
System = "system",
|
||||
Light = "light",
|
||||
Dark = "dark",
|
||||
Nord = "nord",
|
||||
SolarizedDark = "solarizedDark",
|
||||
}
|
||||
|
||||
export const ThemeTypes = {
|
||||
System: "system",
|
||||
Light: "light",
|
||||
Dark: "dark",
|
||||
Nord: "nord",
|
||||
SolarizedDark: "solarizedDark",
|
||||
} as const;
|
||||
|
||||
export type Theme = (typeof ThemeTypes)[keyof typeof ThemeTypes];
|
||||
|
||||
@@ -1,43 +1,33 @@
|
||||
import { Observable, combineLatest, map } from "rxjs";
|
||||
import { Observable, map } from "rxjs";
|
||||
|
||||
import { FeatureFlag } from "../../enums/feature-flag.enum";
|
||||
import { ConfigService } from "../abstractions/config/config.service";
|
||||
import { ThemeType } from "../enums";
|
||||
import { Theme, ThemeTypes } from "../enums";
|
||||
import { GlobalStateProvider, KeyDefinition, THEMING_DISK } from "../state";
|
||||
|
||||
export abstract class ThemeStateService {
|
||||
/**
|
||||
* The users selected theme.
|
||||
*/
|
||||
abstract selectedTheme$: Observable<ThemeType>;
|
||||
abstract selectedTheme$: Observable<Theme>;
|
||||
|
||||
/**
|
||||
* A method for updating the current users configured theme.
|
||||
* @param theme The chosen user theme.
|
||||
*/
|
||||
abstract setSelectedTheme(theme: ThemeType): Promise<void>;
|
||||
abstract setSelectedTheme(theme: Theme): Promise<void>;
|
||||
}
|
||||
|
||||
export const THEME_SELECTION = new KeyDefinition<ThemeType>(THEMING_DISK, "selection", {
|
||||
export const THEME_SELECTION = new KeyDefinition<Theme>(THEMING_DISK, "selection", {
|
||||
deserializer: (s) => s,
|
||||
});
|
||||
|
||||
export class DefaultThemeStateService implements ThemeStateService {
|
||||
private readonly selectedThemeState = this.globalStateProvider.get(THEME_SELECTION);
|
||||
|
||||
selectedTheme$ = combineLatest([
|
||||
this.selectedThemeState.state$,
|
||||
this.configService.getFeatureFlag$(FeatureFlag.ExtensionRefresh),
|
||||
]).pipe(
|
||||
map(([theme, isExtensionRefresh]) => {
|
||||
// The extension refresh should not allow for Nord or SolarizedDark
|
||||
// Default the user to their system theme
|
||||
if (
|
||||
isExtensionRefresh &&
|
||||
theme != null &&
|
||||
[ThemeType.Nord, ThemeType.SolarizedDark].includes(theme)
|
||||
) {
|
||||
return ThemeType.System;
|
||||
selectedTheme$ = this.selectedThemeState.state$.pipe(
|
||||
map((theme) => {
|
||||
// We used to support additional themes. Since these are no longer supported we return null to default to the system theme.
|
||||
if (theme != null && !Object.values(ThemeTypes).includes(theme)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return theme;
|
||||
@@ -47,11 +37,10 @@ export class DefaultThemeStateService implements ThemeStateService {
|
||||
|
||||
constructor(
|
||||
private globalStateProvider: GlobalStateProvider,
|
||||
private configService: ConfigService,
|
||||
private defaultTheme: ThemeType = ThemeType.System,
|
||||
private defaultTheme: Theme = ThemeTypes.System,
|
||||
) {}
|
||||
|
||||
async setSelectedTheme(theme: ThemeType): Promise<void> {
|
||||
async setSelectedTheme(theme: Theme): Promise<void> {
|
||||
await this.selectedThemeState.update(() => theme, {
|
||||
shouldUpdate: (currentTheme) => currentTheme !== theme,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user