mirror of
https://github.com/bitwarden/browser
synced 2026-02-15 16:05:03 +00:00
Pairing with @neuronull, screen privacy poc
This commit is contained in:
@@ -400,6 +400,21 @@
|
||||
</a></small
|
||||
>
|
||||
</div>
|
||||
<div class="form-group" *ngIf="showScreenPrivacy">
|
||||
<div class="checkbox">
|
||||
<label for="screenPrivacy">
|
||||
<input
|
||||
id="screenPrivacy"
|
||||
type="checkbox"
|
||||
formControlName="screenPrivacy"
|
||||
(change)="saveScreenPrivacy()"
|
||||
/>
|
||||
<div class="tw-flex tw-items-center tw-gap-2">
|
||||
{{ "enableScreenPrivacy" | i18n }}
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label for="enableHardwareAcceleration">
|
||||
|
||||
@@ -183,6 +183,7 @@ describe("SettingsComponent", () => {
|
||||
desktopSettingsService.preventScreenshots$ = of(false);
|
||||
domainSettingsService.showFavicons$ = of(false);
|
||||
desktopAutofillSettingsService.enableDuckDuckGoBrowserIntegration$ = of(false);
|
||||
desktopAutofillSettingsService.screenPrivacy$ = of(false);
|
||||
themeStateService.selectedTheme$ = of(ThemeType.System);
|
||||
i18nService.userSetLocale$ = of("en");
|
||||
pinServiceAbstraction.isPinSet.mockResolvedValue(false);
|
||||
|
||||
@@ -118,6 +118,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
requireEnableTray = false;
|
||||
showDuckDuckGoIntegrationOption = false;
|
||||
showEnableAutotype = false;
|
||||
showScreenPrivacy = false;
|
||||
autotypeShortcut: string;
|
||||
showOpenAtLoginOption = false;
|
||||
isWindows: boolean;
|
||||
@@ -184,6 +185,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
value: false,
|
||||
disabled: true,
|
||||
}),
|
||||
screenPrivacy: false,
|
||||
autotypeShortcut: [null as string | null],
|
||||
theme: [null as Theme | null],
|
||||
locale: [null as string | null],
|
||||
@@ -309,6 +311,20 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
// Screen Privacy is for Windows initially
|
||||
// TODO: windows only for now, update when done testing
|
||||
if (true) {
|
||||
this.showScreenPrivacy = true;
|
||||
/*
|
||||
this.configService
|
||||
.getFeatureFlag$(FeatureFlag.ScreenPrivacy)
|
||||
.pipe(takeUntil(this.destroy$))
|
||||
.subscribe((enabled) => {
|
||||
this.showScreenPrivacy = enabled;
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
this.userHasMasterPassword = await this.userVerificationService.hasMasterPassword();
|
||||
|
||||
this.currentUserEmail = activeAccount.email;
|
||||
@@ -417,6 +433,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
),
|
||||
allowScreenshots: !(await firstValueFrom(this.desktopSettingsService.preventScreenshots$)),
|
||||
enableAutotype: await firstValueFrom(this.desktopAutotypeService.autotypeEnabledUserSetting$),
|
||||
screenPrivacy: await firstValueFrom(this.desktopAutofillSettingsService.screenPrivacy$),
|
||||
autotypeShortcut: this.getFormattedAutotypeShortcutText(
|
||||
(await firstValueFrom(this.desktopAutotypeService.autotypeKeyboardShortcut$)) ?? [],
|
||||
),
|
||||
@@ -969,6 +986,11 @@ export class SettingsComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
async saveScreenPrivacy() {
|
||||
await this.desktopAutofillSettingsService.setScreenPrivacy(this.form.value.screenPrivacy);
|
||||
console.log("screen privacy updated to: " + this.form.value.screenPrivacy);
|
||||
}
|
||||
|
||||
async saveAutotypeShortcut() {
|
||||
// disable the shortcut so that the user can't re-enter the existing
|
||||
// shortcut and trigger the feature during the settings menu.
|
||||
|
||||
@@ -14,7 +14,12 @@ const ENABLE_DUCK_DUCK_GO_BROWSER_INTEGRATION = new KeyDefinition(
|
||||
},
|
||||
);
|
||||
|
||||
const SCREEN_PRIVACY = new KeyDefinition(AUTOFILL_SETTINGS_DISK, "screenPrivacy", {
|
||||
deserializer: (v: boolean) => v,
|
||||
});
|
||||
|
||||
export class DesktopAutofillSettingsService {
|
||||
// DDG Integration
|
||||
private enableDuckDuckGoBrowserIntegrationState = this.stateProvider.getGlobal(
|
||||
ENABLE_DUCK_DUCK_GO_BROWSER_INTEGRATION,
|
||||
);
|
||||
@@ -22,9 +27,17 @@ export class DesktopAutofillSettingsService {
|
||||
map((x) => x ?? false),
|
||||
);
|
||||
|
||||
// Screen Privacy
|
||||
private screenPrivacyState = this.stateProvider.getGlobal(SCREEN_PRIVACY);
|
||||
screenPrivacy$ = this.screenPrivacyState.state$.pipe(map((x) => x ?? false));
|
||||
|
||||
constructor(private stateProvider: StateProvider) {}
|
||||
|
||||
async setEnableDuckDuckGoBrowserIntegration(newValue: boolean): Promise<void> {
|
||||
await this.enableDuckDuckGoBrowserIntegrationState.update(() => newValue);
|
||||
}
|
||||
|
||||
async setScreenPrivacy(newValue: boolean): Promise<void> {
|
||||
await this.screenPrivacyState.update(() => newValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4587,5 +4587,8 @@
|
||||
},
|
||||
"whyAmISeeingThis": {
|
||||
"message": "Why am I seeing this?"
|
||||
},
|
||||
"enableScreenPrivacy": {
|
||||
"message": "Enable Screen Privacy"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ export enum FeatureFlag {
|
||||
WindowsDesktopAutotype = "windows-desktop-autotype",
|
||||
WindowsDesktopAutotypeGA = "windows-desktop-autotype-ga",
|
||||
SSHAgentV2 = "ssh-agent-v2",
|
||||
ScreenPrivacy = "screen-privacy",
|
||||
|
||||
/* Billing */
|
||||
TrialPaymentOptional = "PM-8163-trial-payment",
|
||||
@@ -111,6 +112,7 @@ export const DefaultFeatureFlagValue = {
|
||||
[FeatureFlag.WindowsDesktopAutotype]: FALSE,
|
||||
[FeatureFlag.WindowsDesktopAutotypeGA]: FALSE,
|
||||
[FeatureFlag.SSHAgentV2]: FALSE,
|
||||
[FeatureFlag.ScreenPrivacy]: FALSE,
|
||||
|
||||
/* Tools */
|
||||
[FeatureFlag.UseSdkPasswordGenerators]: FALSE,
|
||||
|
||||
@@ -95,7 +95,6 @@ export const AUTOFILL_SETTINGS_DISK = new StateDefinition("autofillSettings", "d
|
||||
export const AUTOFILL_SETTINGS_DISK_LOCAL = new StateDefinition("autofillSettingsLocal", "disk", {
|
||||
web: "disk-local",
|
||||
});
|
||||
|
||||
export const AUTOTYPE_SETTINGS_DISK = new StateDefinition("autotypeSettings", "disk");
|
||||
|
||||
// Components
|
||||
|
||||
Reference in New Issue
Block a user