mirror of
https://github.com/bitwarden/browser
synced 2026-01-06 10:33:57 +00:00
[PM-11312] Add "prevent screenshot" setting to windows and mac (#10707)
* Add screenshot protection to windows and mac * Update messaging of screencapture prevention feature * Set default state to false
This commit is contained in:
@@ -71,6 +71,10 @@ const MINIMIZE_ON_COPY = new UserKeyDefinition<boolean>(DESKTOP_SETTINGS_DISK, "
|
||||
clearOn: [], // User setting, no need to clear
|
||||
});
|
||||
|
||||
const ALLOW_SCREENSHOTS = new KeyDefinition<boolean>(DESKTOP_SETTINGS_DISK, "allowScreenshots", {
|
||||
deserializer: (b) => b,
|
||||
});
|
||||
|
||||
/**
|
||||
* Various settings for controlling application behavior specific to the desktop client.
|
||||
*/
|
||||
@@ -139,6 +143,13 @@ export class DesktopSettingsService {
|
||||
browserIntegrationFingerprintEnabled$ =
|
||||
this.browserIntegrationFingerprintEnabledState.state$.pipe(map(Boolean));
|
||||
|
||||
private readonly allowScreenshotState = this.stateProvider.getGlobal(ALLOW_SCREENSHOTS);
|
||||
|
||||
/**
|
||||
* The application setting for whether or not to allow screenshots of the app.
|
||||
*/
|
||||
allowScreenshots$ = this.allowScreenshotState.state$.pipe(map(Boolean));
|
||||
|
||||
private readonly minimizeOnCopyState = this.stateProvider.getActive(MINIMIZE_ON_COPY);
|
||||
|
||||
/**
|
||||
@@ -255,4 +266,12 @@ export class DesktopSettingsService {
|
||||
async setMinimizeOnCopy(value: boolean, userId: UserId) {
|
||||
await this.stateProvider.getUser(userId, MINIMIZE_ON_COPY).update(() => value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the setting for whether or not the screenshot protection is enabled.
|
||||
* @param value `true` if the screenshot protection is enabled, `false` if it is not.
|
||||
*/
|
||||
async setAllowScreenshots(value: boolean) {
|
||||
await this.allowScreenshotState.update(() => value);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user