1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-04 17:43:39 +00:00

[PM-3316] Feature addition - Toggle Hardware Acceleration [Desktop] (#5968)

Added a toggle for disabling/enabling hardware acceleration on Desktop client.

Resolves #2615

---------

Co-authored-by: Hinton <hinton@users.noreply.github.com>
This commit is contained in:
Prithvi Reddy
2024-03-21 19:13:29 +05:30
committed by GitHub
parent e80ee2ec55
commit cd5dc09d25
7 changed files with 84 additions and 0 deletions

View File

@@ -412,6 +412,23 @@
"enableBrowserIntegrationFingerprintDesc" | i18n
}}</small>
</div>
<div class="form-group">
<div class="checkbox">
<label for="enableHardwareAcceleration">
<input
id="enableHardwareAcceleration"
type="checkbox"
aria-describedby="enableHardwareAccelerationHelp"
formControlName="enableHardwareAcceleration"
(change)="saveHardwareAcceleration()"
/>
{{ "enableHardwareAcceleration" | i18n }}
</label>
</div>
<small id="enableHardwareAccelerationHelp" class="help-block">{{
"enableHardwareAccelerationDesc" | i18n
}}</small>
</div>
<div class="form-group" *ngIf="showDuckDuckGoIntegrationOption">
<div class="checkbox">
<label for="enableDuckDuckGoBrowserIntegration">

View File

@@ -24,6 +24,7 @@ import { DialogService } from "@bitwarden/components";
import { SetPinComponent } from "../../auth/components/set-pin.component";
import { flagEnabled } from "../../platform/flags";
import { DesktopSettingsService } from "../../platform/services/desktop-settings.service";
@Component({
selector: "app-settings",
@@ -96,6 +97,7 @@ export class SettingsComponent implements OnInit {
value: false,
disabled: true,
}),
enableHardwareAcceleration: true,
enableDuckDuckGoBrowserIntegration: false,
theme: [null as ThemeType | null],
locale: [null as string | null],
@@ -119,6 +121,7 @@ export class SettingsComponent implements OnInit {
private dialogService: DialogService,
private userVerificationService: UserVerificationServiceAbstraction,
private biometricStateService: BiometricStateService,
private desktopSettingsService: DesktopSettingsService,
) {
const isMac = this.platformUtilsService.getDevice() === DeviceType.MacOsDesktop;
@@ -259,6 +262,9 @@ export class SettingsComponent implements OnInit {
enableBrowserIntegration: await this.stateService.getEnableBrowserIntegration(),
enableBrowserIntegrationFingerprint:
await this.stateService.getEnableBrowserIntegrationFingerprint(),
enableHardwareAcceleration: await firstValueFrom(
this.desktopSettingsService.hardwareAcceleration$,
),
enableDuckDuckGoBrowserIntegration:
await this.stateService.getEnableDuckDuckGoBrowserIntegration(),
theme: await firstValueFrom(this.themeStateService.selectedTheme$),
@@ -655,6 +661,12 @@ export class SettingsComponent implements OnInit {
);
}
async saveHardwareAcceleration() {
await this.desktopSettingsService.setHardwareAcceleration(
this.form.value.enableHardwareAcceleration,
);
}
async updateApproveLoginRequests() {
await this.stateService.setApproveLoginRequests(this.form.value.approveLoginRequests);
}

View File

@@ -54,6 +54,7 @@ import { DialogService } from "@bitwarden/components";
import { LoginGuard } from "../../auth/guards/login.guard";
import { Account } from "../../models/account";
import { DesktopSettingsService } from "../../platform/services/desktop-settings.service";
import { ElectronCryptoService } from "../../platform/services/electron-crypto.service";
import { ElectronLogRendererService } from "../../platform/services/electron-log.renderer.service";
import {
@@ -212,6 +213,11 @@ const RELOAD_CALLBACK = new InjectionToken<() => any>("RELOAD_CALLBACK");
BiometricStateService,
],
},
{
provide: DesktopSettingsService,
useClass: DesktopSettingsService,
deps: [StateProvider],
},
],
})
export class ServicesModule {}