1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-10 21:50:15 +00:00

feat: reset setting on app start

This commit is contained in:
Andreas Coroiu
2024-12-20 13:53:27 +01:00
parent 86a5c7b1dc
commit 8b30e71525
2 changed files with 11 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ import { UserId } from "@bitwarden/common/types/guid";
import { KeyService as KeyServiceAbstraction } from "@bitwarden/key-management";
import { DesktopAutofillService } from "../../autofill/services/desktop-autofill.service";
import { DesktopSettingsService } from "../../platform/services/desktop-settings.service";
import { I18nRendererService } from "../../platform/services/i18n.renderer.service";
import { SshAgentService } from "../../platform/services/ssh-agent.service";
import { VersionService } from "../../platform/services/version.service";
@@ -47,6 +48,7 @@ export class InitService {
private versionService: VersionService,
private sshAgentService: SshAgentService,
private autofillService: DesktopAutofillService,
private desktopSettingsService: DesktopSettingsService,
@Inject(DOCUMENT) private document: Document,
) {}
@@ -79,6 +81,7 @@ export class InitService {
const htmlEl = this.win.document.documentElement;
htmlEl.classList.add("os_" + this.platformUtilsService.getDeviceString());
this.themingService.applyThemeChangesTo(this.document);
await this.desktopSettingsService.resetInModalMode();
this.versionService.init();

View File

@@ -171,6 +171,14 @@ export class DesktopSettingsService {
);
}
/**
* This is used to clear the setting on application start to make sure we don't end up
* stuck in modal mode if the application is force-closed in modal mode.
*/
async resetInModalMode() {
await this.inModalModeState.update(() => false);
}
async setHardwareAcceleration(enabled: boolean) {
await this.hwState.update(() => enabled);
}