1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-09 09:51:02 +01:00

[bug] Move enableBrowserIntegration to global state (#630)

This commit is contained in:
Addison Beck 2022-01-24 10:47:41 -05:00 committed by GitHub
parent 4436e5fb60
commit e5cc3de46d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 22 deletions

View File

@ -122,8 +122,6 @@ export class AccountSettings {
enableAlwaysOnTop?: boolean; enableAlwaysOnTop?: boolean;
enableAutoFillOnPageLoad?: boolean; enableAutoFillOnPageLoad?: boolean;
enableBiometric?: boolean; enableBiometric?: boolean;
enableBrowserIntegration?: boolean;
enableBrowserIntegrationFingerprint?: boolean;
enableFullWidth?: boolean; enableFullWidth?: boolean;
enableGravitars?: boolean; enableGravitars?: boolean;
environmentUrls: EnvironmentUrls = new EnvironmentUrls(); environmentUrls: EnvironmentUrls = new EnvironmentUrls();

View File

@ -32,4 +32,6 @@ export class GlobalState {
enableStartToTray?: boolean; enableStartToTray?: boolean;
openAtLogin?: boolean; openAtLogin?: boolean;
alwaysShowDock?: boolean; alwaysShowDock?: boolean;
enableBrowserIntegration?: boolean;
enableBrowserIntegrationFingerprint?: boolean;
} }

View File

@ -988,26 +988,26 @@ export class StateService<TAccount extends Account = Account>
async getEnableBrowserIntegration(options?: StorageOptions): Promise<boolean> { async getEnableBrowserIntegration(options?: StorageOptions): Promise<boolean> {
return ( return (
(await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) (await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions())))
?.settings?.enableBrowserIntegration ?? false ?.enableBrowserIntegration ?? false
); );
} }
async setEnableBrowserIntegration(value: boolean, options?: StorageOptions): Promise<void> { async setEnableBrowserIntegration(value: boolean, options?: StorageOptions): Promise<void> {
const account = await this.getAccount( const globals = await this.getGlobals(
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskOptions())
); );
account.settings.enableBrowserIntegration = value; globals.enableBrowserIntegration = value;
await this.saveAccount( await this.saveGlobals(
account, globals,
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskOptions())
); );
} }
async getEnableBrowserIntegrationFingerprint(options?: StorageOptions): Promise<boolean> { async getEnableBrowserIntegrationFingerprint(options?: StorageOptions): Promise<boolean> {
return ( return (
(await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) (await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions())))
?.settings?.enableBrowserIntegrationFingerprint ?? false ?.enableBrowserIntegrationFingerprint ?? false
); );
} }
@ -1015,12 +1015,12 @@ export class StateService<TAccount extends Account = Account>
value: boolean, value: boolean,
options?: StorageOptions options?: StorageOptions
): Promise<void> { ): Promise<void> {
const account = await this.getAccount( const globals = await this.getGlobals(
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskOptions())
); );
account.settings.enableBrowserIntegrationFingerprint = value; globals.enableBrowserIntegrationFingerprint = value;
await this.saveAccount( await this.saveGlobals(
account, globals,
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskOptions())
); );
} }

View File

@ -206,6 +206,12 @@ export class StateMigrationService {
globals.openAtLogin = (await this.get<boolean>(v1Keys.openAtLogin)) ?? globals.openAtLogin; globals.openAtLogin = (await this.get<boolean>(v1Keys.openAtLogin)) ?? globals.openAtLogin;
globals.alwaysShowDock = globals.alwaysShowDock =
(await this.get<boolean>(v1Keys.alwaysShowDock)) ?? globals.alwaysShowDock; (await this.get<boolean>(v1Keys.alwaysShowDock)) ?? globals.alwaysShowDock;
globals.enableBrowserIntegration =
(await this.get<boolean>(v1Keys.enableBrowserIntegration)) ??
globals.enableBrowserIntegration;
globals.enableBrowserIntegrationFingerprint =
(await this.get<boolean>(v1Keys.enableBrowserIntegrationFingerprint)) ??
globals.enableBrowserIntegrationFingerprint;
const userId = const userId =
(await this.get<string>(v1Keys.userId)) ?? (await this.get<string>(v1Keys.entityId)); (await this.get<string>(v1Keys.userId)) ?? (await this.get<string>(v1Keys.entityId));
@ -234,10 +240,6 @@ export class StateMigrationService {
enableAlwaysOnTop: await this.get<boolean>(v1Keys.enableAlwaysOnTop), enableAlwaysOnTop: await this.get<boolean>(v1Keys.enableAlwaysOnTop),
enableAutoFillOnPageLoad: await this.get<boolean>(v1Keys.enableAutoFillOnPageLoad), enableAutoFillOnPageLoad: await this.get<boolean>(v1Keys.enableAutoFillOnPageLoad),
enableBiometric: await this.get<boolean>(v1Keys.enableBiometric), enableBiometric: await this.get<boolean>(v1Keys.enableBiometric),
enableBrowserIntegration: await this.get<boolean>(v1Keys.enableBrowserIntegration),
enableBrowserIntegrationFingerprint: await this.get<boolean>(
v1Keys.enableBrowserIntegrationFingerprint
),
enableFullWidth: await this.get<boolean>(v1Keys.enableFullWidth), enableFullWidth: await this.get<boolean>(v1Keys.enableFullWidth),
enableGravitars: await this.get<boolean>(v1Keys.enableGravatars), enableGravitars: await this.get<boolean>(v1Keys.enableGravatars),
environmentUrls: globals.environmentUrls, environmentUrls: globals.environmentUrls,
@ -365,10 +367,6 @@ export class StateMigrationService {
enableAlwaysOnTop: await this.get<boolean>(v1Keys.enableAlwaysOnTop), enableAlwaysOnTop: await this.get<boolean>(v1Keys.enableAlwaysOnTop),
enableAutoFillOnPageLoad: await this.get<boolean>(v1Keys.enableAutoFillOnPageLoad), enableAutoFillOnPageLoad: await this.get<boolean>(v1Keys.enableAutoFillOnPageLoad),
enableBiometric: await this.get<boolean>(v1Keys.enableBiometric), enableBiometric: await this.get<boolean>(v1Keys.enableBiometric),
enableBrowserIntegration: await this.get<boolean>(v1Keys.enableBrowserIntegration),
enableBrowserIntegrationFingerprint: await this.get<boolean>(
v1Keys.enableBrowserIntegrationFingerprint
),
enableFullWidth: await this.get<boolean>(v1Keys.enableFullWidth), enableFullWidth: await this.get<boolean>(v1Keys.enableFullWidth),
enableGravitars: await this.get<boolean>(v1Keys.enableGravatars), enableGravitars: await this.get<boolean>(v1Keys.enableGravatars),
environmentUrls: globals.environmentUrls, environmentUrls: globals.environmentUrls,