[bug] Correct scope for several data points (#618)

The following data points are currently scoped to an account but are made global with this commit:
* Enable Menu Bar Icon
* Minimize To Menu Bar
* Close To Menu Bar
* Start To Menu Bar

Note: these are all electron specific fields
This commit is contained in:
Addison Beck 2022-01-20 09:03:31 -05:00 committed by GitHub
parent 57351d29a2
commit 54c6a4b3c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 50 deletions

View File

@ -104,7 +104,6 @@ export class AccountProfile {
} }
export class AccountSettings { export class AccountSettings {
alwaysShowDock?: boolean;
autoConfirmFingerPrints?: boolean; autoConfirmFingerPrints?: boolean;
autoFillOnPageLoadDefault?: boolean; autoFillOnPageLoadDefault?: boolean;
biometricLocked?: boolean; biometricLocked?: boolean;
@ -125,17 +124,12 @@ export class AccountSettings {
enableBiometric?: boolean; enableBiometric?: boolean;
enableBrowserIntegration?: boolean; enableBrowserIntegration?: boolean;
enableBrowserIntegrationFingerprint?: boolean; enableBrowserIntegrationFingerprint?: boolean;
enableCloseToTray?: boolean;
enableFullWidth?: boolean; enableFullWidth?: boolean;
enableGravitars?: boolean; enableGravitars?: boolean;
enableMinimizeToTray?: boolean;
enableStartToTray?: boolean;
enableTray?: boolean;
environmentUrls: EnvironmentUrls = new EnvironmentUrls(); environmentUrls: EnvironmentUrls = new EnvironmentUrls();
equivalentDomains?: any; equivalentDomains?: any;
minimizeOnCopyToClipboard?: boolean; minimizeOnCopyToClipboard?: boolean;
neverDomains?: { [id: string]: any }; neverDomains?: { [id: string]: any };
openAtLogin?: boolean;
passwordGenerationOptions?: any; passwordGenerationOptions?: any;
pinProtected?: EncryptionPair<string, EncString> = new EncryptionPair<string, EncString>(); pinProtected?: EncryptionPair<string, EncString> = new EncryptionPair<string, EncString>();
protectedPin?: string; protectedPin?: string;

View File

@ -5,7 +5,6 @@ export class GlobalState {
enableAlwaysOnTop?: boolean; enableAlwaysOnTop?: boolean;
installedVersion?: string; installedVersion?: string;
locale?: string = "en"; locale?: string = "en";
openAtLogin?: boolean;
organizationInvitation?: any; organizationInvitation?: any;
ssoCodeVerifier?: string; ssoCodeVerifier?: string;
ssoOrganizationIdentifier?: string; ssoOrganizationIdentifier?: string;
@ -27,4 +26,10 @@ export class GlobalState {
noAutoPromptBiometricsText?: string; noAutoPromptBiometricsText?: string;
stateVersion: StateVersion = StateVersion.One; stateVersion: StateVersion = StateVersion.One;
environmentUrls: EnvironmentUrls = new EnvironmentUrls(); environmentUrls: EnvironmentUrls = new EnvironmentUrls();
enableTray?: boolean;
enableMinimizeToTray?: boolean;
enableCloseToTray?: boolean;
enableStartToTray?: boolean;
openAtLogin?: boolean;
alwaysShowDock?: boolean;
} }

View File

@ -161,18 +161,18 @@ export class StateService<TAccount extends Account = Account>
async getAlwaysShowDock(options?: StorageOptions): Promise<boolean> { async getAlwaysShowDock(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?.alwaysShowDock ?? false ?.alwaysShowDock ?? false
); );
} }
async setAlwaysShowDock(value: boolean, options?: StorageOptions): Promise<void> { async setAlwaysShowDock(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.alwaysShowDock = value; globals.alwaysShowDock = value;
await this.saveAccount( await this.saveGlobals(
account, globals,
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskOptions())
); );
} }
@ -1027,18 +1027,18 @@ export class StateService<TAccount extends Account = Account>
async getEnableCloseToTray(options?: StorageOptions): Promise<boolean> { async getEnableCloseToTray(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?.enableCloseToTray ?? false ?.enableCloseToTray ?? false
); );
} }
async setEnableCloseToTray(value: boolean, options?: StorageOptions): Promise<void> { async setEnableCloseToTray(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.enableCloseToTray = value; globals.enableCloseToTray = value;
await this.saveAccount( await this.saveGlobals(
account, globals,
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskOptions())
); );
} }
@ -1087,54 +1087,54 @@ export class StateService<TAccount extends Account = Account>
async getEnableMinimizeToTray(options?: StorageOptions): Promise<boolean> { async getEnableMinimizeToTray(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?.enableMinimizeToTray ?? false ?.enableMinimizeToTray ?? false
); );
} }
async setEnableMinimizeToTray(value: boolean, options?: StorageOptions): Promise<void> { async setEnableMinimizeToTray(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.enableMinimizeToTray = value; globals.enableMinimizeToTray = value;
await this.saveAccount( await this.saveGlobals(
account, globals,
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskOptions())
); );
} }
async getEnableStartToTray(options?: StorageOptions): Promise<boolean> { async getEnableStartToTray(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.enableStartToTray ?? false ?.enableStartToTray ?? false
); );
} }
async setEnableStartToTray(value: boolean, options?: StorageOptions): Promise<void> { async setEnableStartToTray(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.enableStartToTray = value; globals.enableStartToTray = value;
await this.saveAccount( await this.saveGlobals(
account, globals,
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskOptions())
); );
} }
async getEnableTray(options?: StorageOptions): Promise<boolean> { async getEnableTray(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?.enableTray ?? false ?.enableTray ?? false
); );
} }
async setEnableTray(value: boolean, options?: StorageOptions): Promise<void> { async setEnableTray(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.enableTray = value; globals.enableTray = value;
await this.saveAccount( await this.saveGlobals(
account, globals,
this.reconcileOptions(options, await this.defaultOnDiskOptions()) this.reconcileOptions(options, await this.defaultOnDiskOptions())
); );
} }

View File

@ -176,7 +176,6 @@ export class StateMigrationService {
mainWindowSize: null, mainWindowSize: null,
noAutoPromptBiometrics: await this.get<boolean>(v1Keys.disableAutoBiometricsPrompt), noAutoPromptBiometrics: await this.get<boolean>(v1Keys.disableAutoBiometricsPrompt),
noAutoPromptBiometricsText: await this.get<string>(v1Keys.noAutoPromptBiometricsText), noAutoPromptBiometricsText: await this.get<string>(v1Keys.noAutoPromptBiometricsText),
openAtLogin: await this.get<boolean>(v1Keys.openAtLogin),
organizationInvitation: null, organizationInvitation: null,
ssoCodeVerifier: await this.get<string>(v1Keys.ssoCodeVerifier), ssoCodeVerifier: await this.get<string>(v1Keys.ssoCodeVerifier),
ssoOrganizationIdentifier: await this.get<string>(v1Keys.ssoIdentifier), ssoOrganizationIdentifier: await this.get<string>(v1Keys.ssoIdentifier),
@ -186,6 +185,12 @@ export class StateMigrationService {
vaultTimeout: await this.get<number>(v1Keys.vaultTimeout), vaultTimeout: await this.get<number>(v1Keys.vaultTimeout),
vaultTimeoutAction: await this.get<string>(v1Keys.vaultTimeoutAction), vaultTimeoutAction: await this.get<string>(v1Keys.vaultTimeoutAction),
window: null, window: null,
enableTray: await this.get<boolean>(v1Keys.enableTray),
enableMinimizeToTray: await this.get<boolean>(v1Keys.enableMinimizeToTray),
enableCloseToTray: await this.get<boolean>(v1Keys.enableCloseToTray),
enableStartToTray: await this.get<boolean>(v1Keys.enableStartToTray),
openAtLogin: await this.get<boolean>(v1Keys.openAtLogin),
alwaysShowDock: await this.get<boolean>(v1Keys.alwaysShowDock),
}; };
const userId = await this.get<string>(v1Keys.userId); const userId = await this.get<string>(v1Keys.userId);
@ -194,7 +199,6 @@ export class StateMigrationService {
// (userId != null) = we have a currently authed user (so known userId) with encrypted data and other key settings we can move, no need to temporarily store account settings // (userId != null) = we have a currently authed user (so known userId) with encrypted data and other key settings we can move, no need to temporarily store account settings
if (userId == null) { if (userId == null) {
await this.set(keys.tempAccountSettings, { await this.set(keys.tempAccountSettings, {
alwaysShowDock: await this.get<boolean>(v1Keys.alwaysShowDock),
autoConfirmFingerPrints: await this.get<boolean>(v1Keys.autoConfirmFingerprints), autoConfirmFingerPrints: await this.get<boolean>(v1Keys.autoConfirmFingerprints),
autoFillOnPageLoadDefault: await this.get<boolean>(v1Keys.autoFillOnPageLoadDefault), autoFillOnPageLoadDefault: await this.get<boolean>(v1Keys.autoFillOnPageLoadDefault),
biometricLocked: null, biometricLocked: null,
@ -219,17 +223,12 @@ export class StateMigrationService {
enableBrowserIntegrationFingerprint: await this.get<boolean>( enableBrowserIntegrationFingerprint: await this.get<boolean>(
v1Keys.enableBrowserIntegrationFingerprint v1Keys.enableBrowserIntegrationFingerprint
), ),
enableCloseToTray: await this.get<boolean>(v1Keys.enableCloseToTray),
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),
enableMinimizeToTray: await this.get<boolean>(v1Keys.enableMinimizeToTray),
enableStartToTray: await this.get<boolean>(v1Keys.enableStartToTray),
enableTray: await this.get<boolean>(v1Keys.enableTray),
environmentUrls: globals.environmentUrls, environmentUrls: globals.environmentUrls,
equivalentDomains: await this.get<any>(v1Keys.equivalentDomains), equivalentDomains: await this.get<any>(v1Keys.equivalentDomains),
minimizeOnCopyToClipboard: await this.get<boolean>(v1Keys.minimizeOnCopyToClipboard), minimizeOnCopyToClipboard: await this.get<boolean>(v1Keys.minimizeOnCopyToClipboard),
neverDomains: await this.get<any>(v1Keys.neverDomains), neverDomains: await this.get<any>(v1Keys.neverDomains),
openAtLogin: await this.get<boolean>(v1Keys.openAtLogin),
passwordGenerationOptions: await this.get<any>(v1Keys.passwordGenerationOptions), passwordGenerationOptions: await this.get<any>(v1Keys.passwordGenerationOptions),
pinProtected: { pinProtected: {
decrypted: null, decrypted: null,
@ -331,7 +330,6 @@ export class StateMigrationService {
usesKeyConnector: null, usesKeyConnector: null,
}, },
settings: { settings: {
alwaysShowDock: await this.get<boolean>(v1Keys.alwaysShowDock),
autoConfirmFingerPrints: await this.get<boolean>(v1Keys.autoConfirmFingerprints), autoConfirmFingerPrints: await this.get<boolean>(v1Keys.autoConfirmFingerprints),
autoFillOnPageLoadDefault: await this.get<boolean>(v1Keys.autoFillOnPageLoadDefault), autoFillOnPageLoadDefault: await this.get<boolean>(v1Keys.autoFillOnPageLoadDefault),
biometricLocked: null, biometricLocked: null,
@ -356,17 +354,12 @@ export class StateMigrationService {
enableBrowserIntegrationFingerprint: await this.get<boolean>( enableBrowserIntegrationFingerprint: await this.get<boolean>(
v1Keys.enableBrowserIntegrationFingerprint v1Keys.enableBrowserIntegrationFingerprint
), ),
enableCloseToTray: await this.get<boolean>(v1Keys.enableCloseToTray),
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),
enableMinimizeToTray: await this.get<boolean>(v1Keys.enableMinimizeToTray),
enableStartToTray: await this.get<boolean>(v1Keys.enableStartToTray),
enableTray: await this.get<boolean>(v1Keys.enableTray),
environmentUrls: globals.environmentUrls, environmentUrls: globals.environmentUrls,
equivalentDomains: await this.get<any>(v1Keys.equivalentDomains), equivalentDomains: await this.get<any>(v1Keys.equivalentDomains),
minimizeOnCopyToClipboard: await this.get<boolean>(v1Keys.minimizeOnCopyToClipboard), minimizeOnCopyToClipboard: await this.get<boolean>(v1Keys.minimizeOnCopyToClipboard),
neverDomains: await this.get<any>(v1Keys.neverDomains), neverDomains: await this.get<any>(v1Keys.neverDomains),
openAtLogin: await this.get<boolean>(v1Keys.openAtLogin),
passwordGenerationOptions: await this.get<any>(v1Keys.passwordGenerationOptions), passwordGenerationOptions: await this.get<any>(v1Keys.passwordGenerationOptions),
pinProtected: { pinProtected: {
decrypted: null, decrypted: null,