diff --git a/apps/desktop/src/app/accounts/settings.component.html b/apps/desktop/src/app/accounts/settings.component.html index c86e141b463..28699378d94 100644 --- a/apps/desktop/src/app/accounts/settings.component.html +++ b/apps/desktop/src/app/accounts/settings.component.html @@ -444,7 +444,7 @@

type="checkbox" aria-describedby="allowScreenshotsHelp" formControlName="allowScreenshots" - (change)="saveAllowScreenshots()" + (change)="savePreventScreenshots()" /> {{ "allowScreenshots" | i18n }} diff --git a/apps/desktop/src/app/accounts/settings.component.ts b/apps/desktop/src/app/accounts/settings.component.ts index ef954767c64..3e24b1f403b 100644 --- a/apps/desktop/src/app/accounts/settings.component.ts +++ b/apps/desktop/src/app/accounts/settings.component.ts @@ -113,7 +113,7 @@ export class SettingsComponent implements OnInit, OnDestroy { }), enableHardwareAcceleration: true, enableSshAgent: false, - allowScreenshots: true, + allowScreenshots: false, enableDuckDuckGoBrowserIntegration: false, theme: [null as ThemeType | null], locale: [null as string | null], @@ -283,7 +283,7 @@ export class SettingsComponent implements OnInit, OnDestroy { this.desktopSettingsService.hardwareAcceleration$, ), enableSshAgent: await firstValueFrom(this.desktopSettingsService.sshAgentEnabled$), - allowScreenshots: await firstValueFrom(this.desktopSettingsService.allowScreenshots$), + allowScreenshots: !(await firstValueFrom(this.desktopSettingsService.preventScreenshots$)), theme: await firstValueFrom(this.themeStateService.selectedTheme$), locale: await firstValueFrom(this.i18nService.userSetLocale$), }; @@ -748,14 +748,8 @@ export class SettingsComponent implements OnInit, OnDestroy { await this.desktopSettingsService.setSshAgentEnabled(this.form.value.enableSshAgent); } - async saveEnableScreenshotProtection() { - await this.desktopSettingsService.setScreenshotProtection( - this.form.value.enableScreenshotProtection, - ); - } - - async saveAllowScreenshots() { - await this.desktopSettingsService.setAllowScreenshots(this.form.value.allowScreenshots); + async savePreventScreenshots() { + await this.desktopSettingsService.setPreventScreenshots(!this.form.value.allowScreenshots); } private async generateVaultTimeoutOptions(): Promise { diff --git a/apps/desktop/src/main/window.main.ts b/apps/desktop/src/main/window.main.ts index aa47f0ec0b7..e05ce100675 100644 --- a/apps/desktop/src/main/window.main.ts +++ b/apps/desktop/src/main/window.main.ts @@ -76,11 +76,11 @@ export class WindowMain { } }); - this.desktopSettingsService.allowScreenshots$.subscribe((allowed) => { + this.desktopSettingsService.preventScreenshots$.subscribe((prevent) => { if (this.win == null) { return; } - this.win.setContentProtection(!allowed); + this.win.setContentProtection(prevent); }); return new Promise((resolve, reject) => { @@ -284,9 +284,9 @@ export class WindowMain { }); }); - firstValueFrom(this.desktopSettingsService.allowScreenshots$) - .then((allowScreenshots) => { - this.win.setContentProtection(!allowScreenshots); + firstValueFrom(this.desktopSettingsService.preventScreenshots$) + .then((preventScreenshots) => { + this.win.setContentProtection(preventScreenshots); }) .catch((e) => { this.logService.error(e); diff --git a/apps/desktop/src/platform/services/desktop-settings.service.ts b/apps/desktop/src/platform/services/desktop-settings.service.ts index 8d20de0b4aa..c51845aba91 100644 --- a/apps/desktop/src/platform/services/desktop-settings.service.ts +++ b/apps/desktop/src/platform/services/desktop-settings.service.ts @@ -75,7 +75,7 @@ const MINIMIZE_ON_COPY = new UserKeyDefinition(DESKTOP_SETTINGS_DISK, " clearOn: [], // User setting, no need to clear }); -const ALLOW_SCREENSHOTS = new KeyDefinition(DESKTOP_SETTINGS_DISK, "allowAppScreenshots", { +const PEVENT_SCREENSHOTS = new KeyDefinition(DESKTOP_SETTINGS_DISK, "preventScreenshots", { deserializer: (b) => b, }); @@ -151,12 +151,12 @@ export class DesktopSettingsService { sshAgentEnabled$ = this.sshAgentEnabledState.state$.pipe(map(Boolean)); - private readonly allowScreenshotState = this.stateProvider.getGlobal(ALLOW_SCREENSHOTS); + private readonly preventScreenshotState = this.stateProvider.getGlobal(PEVENT_SCREENSHOTS); /** * The application setting for whether or not to allow screenshots of the app. */ - allowScreenshots$ = this.allowScreenshotState.state$.pipe(map(Boolean)); + preventScreenshots$ = this.preventScreenshotState.state$.pipe(map(Boolean)); private readonly minimizeOnCopyState = this.stateProvider.getActive(MINIMIZE_ON_COPY); @@ -286,7 +286,7 @@ export class DesktopSettingsService { * 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); + async setPreventScreenshots(value: boolean) { + await this.preventScreenshotState.update(() => value); } }