mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 23:33:31 +00:00
[deps] Autofill: Update prettier to v3 (#7014)
* [deps] Autofill: Update prettier to v3 * prettier formatting updates --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
This commit is contained in:
@@ -31,15 +31,15 @@ describe("canAccessFeature", () => {
|
||||
// Mock the correct getter based on the type of flagValue; also mock default values if one is not provided
|
||||
if (typeof flagValue === "boolean") {
|
||||
mockConfigService.getFeatureFlag.mockImplementation((flag, defaultValue = false) =>
|
||||
flag == testFlag ? Promise.resolve(flagValue) : Promise.resolve(defaultValue)
|
||||
flag == testFlag ? Promise.resolve(flagValue) : Promise.resolve(defaultValue),
|
||||
);
|
||||
} else if (typeof flagValue === "string") {
|
||||
mockConfigService.getFeatureFlag.mockImplementation((flag, defaultValue = "") =>
|
||||
flag == testFlag ? Promise.resolve(flagValue) : Promise.resolve(defaultValue)
|
||||
flag == testFlag ? Promise.resolve(flagValue) : Promise.resolve(defaultValue),
|
||||
);
|
||||
} else if (typeof flagValue === "number") {
|
||||
mockConfigService.getFeatureFlag.mockImplementation((flag, defaultValue = 0) =>
|
||||
flag == testFlag ? Promise.resolve(flagValue) : Promise.resolve(defaultValue)
|
||||
flag == testFlag ? Promise.resolve(flagValue) : Promise.resolve(defaultValue),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ describe("canAccessFeature", () => {
|
||||
expect(mockPlatformUtilsService.showToast).toHaveBeenCalledWith(
|
||||
"error",
|
||||
null,
|
||||
"Access Denied!"
|
||||
"Access Denied!",
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ type FlagValue = boolean | number | string;
|
||||
export const canAccessFeature = (
|
||||
featureFlag: FeatureFlag,
|
||||
requiredFlagValue: FlagValue = true,
|
||||
redirectUrlOnDisabled?: string
|
||||
redirectUrlOnDisabled?: string,
|
||||
): CanActivateFn => {
|
||||
return async () => {
|
||||
const configService = inject(ConfigServiceAbstraction);
|
||||
|
||||
@@ -7,7 +7,10 @@ export class ThemeBuilder implements Theme {
|
||||
return this.configuredTheme != ThemeType.System ? this.configuredTheme : this.systemTheme;
|
||||
}
|
||||
|
||||
constructor(readonly configuredTheme: ThemeType, readonly systemTheme: ThemeType) {}
|
||||
constructor(
|
||||
readonly configuredTheme: ThemeType,
|
||||
readonly systemTheme: ThemeType,
|
||||
) {}
|
||||
|
||||
updateSystemTheme(systemTheme: ThemeType): ThemeBuilder {
|
||||
return new ThemeBuilder(this.configuredTheme, systemTheme);
|
||||
|
||||
@@ -19,14 +19,14 @@ export class ThemingService implements AbstractThemingService {
|
||||
constructor(
|
||||
private stateService: StateService,
|
||||
@Inject(WINDOW) private window: Window,
|
||||
@Inject(DOCUMENT) private document: Document
|
||||
@Inject(DOCUMENT) private document: Document,
|
||||
) {
|
||||
this.monitorThemeChanges();
|
||||
}
|
||||
|
||||
async monitorThemeChanges(): Promise<void> {
|
||||
this._theme.next(
|
||||
new ThemeBuilder(await this.stateService.getTheme(), await this.getSystemTheme())
|
||||
new ThemeBuilder(await this.stateService.getTheme(), await this.getSystemTheme()),
|
||||
);
|
||||
this.monitorConfiguredThemeChanges();
|
||||
this.monitorSystemThemeChanges();
|
||||
@@ -47,7 +47,7 @@ export class ThemingService implements AbstractThemingService {
|
||||
"theme_" + ThemeType.Light,
|
||||
"theme_" + ThemeType.Dark,
|
||||
"theme_" + ThemeType.Nord,
|
||||
"theme_" + ThemeType.SolarizedDark
|
||||
"theme_" + ThemeType.SolarizedDark,
|
||||
);
|
||||
this.document.documentElement.classList.add("theme_" + theme.effectiveTheme);
|
||||
});
|
||||
@@ -64,7 +64,7 @@ export class ThemingService implements AbstractThemingService {
|
||||
protected monitorSystemThemeChanges(): void {
|
||||
fromEvent<MediaQueryListEvent>(
|
||||
window.matchMedia("(prefers-color-scheme: dark)"),
|
||||
"change"
|
||||
"change",
|
||||
).subscribe((event) => {
|
||||
this.updateSystemTheme(event.matches ? ThemeType.Dark : ThemeType.Light);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user