1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-03 17:13:47 +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

@@ -0,0 +1,26 @@
import { map } from "rxjs";
import {
DESKTOP_SETTINGS_DISK,
KeyDefinition,
StateProvider,
} from "@bitwarden/common/platform/state";
export const HARDWARE_ACCELERATION = new KeyDefinition<boolean>(
DESKTOP_SETTINGS_DISK,
"hardwareAcceleration",
{
deserializer: (v: boolean) => v,
},
);
export class DesktopSettingsService {
private hwState = this.stateProvider.getGlobal(HARDWARE_ACCELERATION);
hardwareAcceleration$ = this.hwState.state$.pipe(map((v) => v ?? true));
constructor(private stateProvider: StateProvider) {}
async setHardwareAcceleration(enabled: boolean) {
await this.hwState.update(() => enabled);
}
}