diff --git a/common/src/models/domain/account.ts b/common/src/models/domain/account.ts index 9af9f0534f..bfad62ac43 100644 --- a/common/src/models/domain/account.ts +++ b/common/src/models/domain/account.ts @@ -104,7 +104,6 @@ export class AccountProfile { } export class AccountSettings { - alwaysShowDock?: boolean; autoConfirmFingerPrints?: boolean; autoFillOnPageLoadDefault?: boolean; biometricLocked?: boolean; @@ -125,17 +124,12 @@ export class AccountSettings { enableBiometric?: boolean; enableBrowserIntegration?: boolean; enableBrowserIntegrationFingerprint?: boolean; - enableCloseToTray?: boolean; enableFullWidth?: boolean; enableGravitars?: boolean; - enableMinimizeToTray?: boolean; - enableStartToTray?: boolean; - enableTray?: boolean; environmentUrls: EnvironmentUrls = new EnvironmentUrls(); equivalentDomains?: any; minimizeOnCopyToClipboard?: boolean; neverDomains?: { [id: string]: any }; - openAtLogin?: boolean; passwordGenerationOptions?: any; pinProtected?: EncryptionPair = new EncryptionPair(); protectedPin?: string; diff --git a/common/src/models/domain/globalState.ts b/common/src/models/domain/globalState.ts index 7a1895d1ff..e7036fa2a4 100644 --- a/common/src/models/domain/globalState.ts +++ b/common/src/models/domain/globalState.ts @@ -5,7 +5,6 @@ export class GlobalState { enableAlwaysOnTop?: boolean; installedVersion?: string; locale?: string = "en"; - openAtLogin?: boolean; organizationInvitation?: any; ssoCodeVerifier?: string; ssoOrganizationIdentifier?: string; @@ -27,4 +26,10 @@ export class GlobalState { noAutoPromptBiometricsText?: string; stateVersion: StateVersion = StateVersion.One; environmentUrls: EnvironmentUrls = new EnvironmentUrls(); + enableTray?: boolean; + enableMinimizeToTray?: boolean; + enableCloseToTray?: boolean; + enableStartToTray?: boolean; + openAtLogin?: boolean; + alwaysShowDock?: boolean; } diff --git a/common/src/services/state.service.ts b/common/src/services/state.service.ts index 60975d5721..6e4da55dc8 100644 --- a/common/src/services/state.service.ts +++ b/common/src/services/state.service.ts @@ -161,18 +161,18 @@ export class StateService async getAlwaysShowDock(options?: StorageOptions): Promise { return ( - (await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) - ?.settings?.alwaysShowDock ?? false + (await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) + ?.alwaysShowDock ?? false ); } async setAlwaysShowDock(value: boolean, options?: StorageOptions): Promise { - const account = await this.getAccount( + const globals = await this.getGlobals( this.reconcileOptions(options, await this.defaultOnDiskOptions()) ); - account.settings.alwaysShowDock = value; - await this.saveAccount( - account, + globals.alwaysShowDock = value; + await this.saveGlobals( + globals, this.reconcileOptions(options, await this.defaultOnDiskOptions()) ); } @@ -1027,18 +1027,18 @@ export class StateService async getEnableCloseToTray(options?: StorageOptions): Promise { return ( - (await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) - ?.settings?.enableCloseToTray ?? false + (await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) + ?.enableCloseToTray ?? false ); } async setEnableCloseToTray(value: boolean, options?: StorageOptions): Promise { - const account = await this.getAccount( + const globals = await this.getGlobals( this.reconcileOptions(options, await this.defaultOnDiskOptions()) ); - account.settings.enableCloseToTray = value; - await this.saveAccount( - account, + globals.enableCloseToTray = value; + await this.saveGlobals( + globals, this.reconcileOptions(options, await this.defaultOnDiskOptions()) ); } @@ -1087,54 +1087,54 @@ export class StateService async getEnableMinimizeToTray(options?: StorageOptions): Promise { return ( - (await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) - ?.settings?.enableMinimizeToTray ?? false + (await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) + ?.enableMinimizeToTray ?? false ); } async setEnableMinimizeToTray(value: boolean, options?: StorageOptions): Promise { - const account = await this.getAccount( + const globals = await this.getGlobals( this.reconcileOptions(options, await this.defaultOnDiskOptions()) ); - account.settings.enableMinimizeToTray = value; - await this.saveAccount( - account, + globals.enableMinimizeToTray = value; + await this.saveGlobals( + globals, this.reconcileOptions(options, await this.defaultOnDiskOptions()) ); } async getEnableStartToTray(options?: StorageOptions): Promise { return ( - (await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) - ?.settings.enableStartToTray ?? false + (await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) + ?.enableStartToTray ?? false ); } async setEnableStartToTray(value: boolean, options?: StorageOptions): Promise { - const account = await this.getAccount( + const globals = await this.getGlobals( this.reconcileOptions(options, await this.defaultOnDiskOptions()) ); - account.settings.enableStartToTray = value; - await this.saveAccount( - account, + globals.enableStartToTray = value; + await this.saveGlobals( + globals, this.reconcileOptions(options, await this.defaultOnDiskOptions()) ); } async getEnableTray(options?: StorageOptions): Promise { return ( - (await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) - ?.settings?.enableTray ?? false + (await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) + ?.enableTray ?? false ); } async setEnableTray(value: boolean, options?: StorageOptions): Promise { - const account = await this.getAccount( + const globals = await this.getGlobals( this.reconcileOptions(options, await this.defaultOnDiskOptions()) ); - account.settings.enableTray = value; - await this.saveAccount( - account, + globals.enableTray = value; + await this.saveGlobals( + globals, this.reconcileOptions(options, await this.defaultOnDiskOptions()) ); } diff --git a/common/src/services/stateMigration.service.ts b/common/src/services/stateMigration.service.ts index 36bf686486..511c8dc477 100644 --- a/common/src/services/stateMigration.service.ts +++ b/common/src/services/stateMigration.service.ts @@ -176,7 +176,6 @@ export class StateMigrationService { mainWindowSize: null, noAutoPromptBiometrics: await this.get(v1Keys.disableAutoBiometricsPrompt), noAutoPromptBiometricsText: await this.get(v1Keys.noAutoPromptBiometricsText), - openAtLogin: await this.get(v1Keys.openAtLogin), organizationInvitation: null, ssoCodeVerifier: await this.get(v1Keys.ssoCodeVerifier), ssoOrganizationIdentifier: await this.get(v1Keys.ssoIdentifier), @@ -186,6 +185,12 @@ export class StateMigrationService { vaultTimeout: await this.get(v1Keys.vaultTimeout), vaultTimeoutAction: await this.get(v1Keys.vaultTimeoutAction), window: null, + enableTray: await this.get(v1Keys.enableTray), + enableMinimizeToTray: await this.get(v1Keys.enableMinimizeToTray), + enableCloseToTray: await this.get(v1Keys.enableCloseToTray), + enableStartToTray: await this.get(v1Keys.enableStartToTray), + openAtLogin: await this.get(v1Keys.openAtLogin), + alwaysShowDock: await this.get(v1Keys.alwaysShowDock), }; const userId = await this.get(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 if (userId == null) { await this.set(keys.tempAccountSettings, { - alwaysShowDock: await this.get(v1Keys.alwaysShowDock), autoConfirmFingerPrints: await this.get(v1Keys.autoConfirmFingerprints), autoFillOnPageLoadDefault: await this.get(v1Keys.autoFillOnPageLoadDefault), biometricLocked: null, @@ -219,17 +223,12 @@ export class StateMigrationService { enableBrowserIntegrationFingerprint: await this.get( v1Keys.enableBrowserIntegrationFingerprint ), - enableCloseToTray: await this.get(v1Keys.enableCloseToTray), enableFullWidth: await this.get(v1Keys.enableFullWidth), enableGravitars: await this.get(v1Keys.enableGravatars), - enableMinimizeToTray: await this.get(v1Keys.enableMinimizeToTray), - enableStartToTray: await this.get(v1Keys.enableStartToTray), - enableTray: await this.get(v1Keys.enableTray), environmentUrls: globals.environmentUrls, equivalentDomains: await this.get(v1Keys.equivalentDomains), minimizeOnCopyToClipboard: await this.get(v1Keys.minimizeOnCopyToClipboard), neverDomains: await this.get(v1Keys.neverDomains), - openAtLogin: await this.get(v1Keys.openAtLogin), passwordGenerationOptions: await this.get(v1Keys.passwordGenerationOptions), pinProtected: { decrypted: null, @@ -331,7 +330,6 @@ export class StateMigrationService { usesKeyConnector: null, }, settings: { - alwaysShowDock: await this.get(v1Keys.alwaysShowDock), autoConfirmFingerPrints: await this.get(v1Keys.autoConfirmFingerprints), autoFillOnPageLoadDefault: await this.get(v1Keys.autoFillOnPageLoadDefault), biometricLocked: null, @@ -356,17 +354,12 @@ export class StateMigrationService { enableBrowserIntegrationFingerprint: await this.get( v1Keys.enableBrowserIntegrationFingerprint ), - enableCloseToTray: await this.get(v1Keys.enableCloseToTray), enableFullWidth: await this.get(v1Keys.enableFullWidth), enableGravitars: await this.get(v1Keys.enableGravatars), - enableMinimizeToTray: await this.get(v1Keys.enableMinimizeToTray), - enableStartToTray: await this.get(v1Keys.enableStartToTray), - enableTray: await this.get(v1Keys.enableTray), environmentUrls: globals.environmentUrls, equivalentDomains: await this.get(v1Keys.equivalentDomains), minimizeOnCopyToClipboard: await this.get(v1Keys.minimizeOnCopyToClipboard), neverDomains: await this.get(v1Keys.neverDomains), - openAtLogin: await this.get(v1Keys.openAtLogin), passwordGenerationOptions: await this.get(v1Keys.passwordGenerationOptions), pinProtected: { decrypted: null,