diff --git a/jslib b/jslib index 172392ff3b..957e010036 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 172392ff3b3d8e68795549deef5433c0d1329c9c +Subproject commit 957e010036c89cfbcb0b526eea99c4b9e292b1f8 diff --git a/src/app/services.module.ts b/src/app/services.module.ts index a4593b88e1..385d97bed2 100644 --- a/src/app/services.module.ts +++ b/src/app/services.module.ts @@ -10,6 +10,8 @@ import { I18nService } from "../services/i18n.service"; import { LoginGuardService } from "../services/loginGuard.service"; import { NativeMessagingService } from "../services/nativeMessaging.service"; import { PasswordRepromptService } from "../services/passwordReprompt.service"; +import { StateService } from "../services/state.service"; + import { SearchBarService } from "./layout/search/search-bar.service"; import { JslibServicesModule } from "jslib-angular/services/jslib-services.module"; @@ -35,6 +37,7 @@ import { NotificationsService as NotificationsServiceAbstraction } from "jslib-c import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "jslib-common/abstractions/passwordReprompt.service"; import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "jslib-common/abstractions/platformUtils.service"; import { StateService as StateServiceAbstraction } from "jslib-common/abstractions/state.service"; +import { StateMigrationService as StateMigrationServiceAbstraction } from "jslib-common/abstractions/stateMigration.service"; import { StorageService as StorageServiceAbstraction } from "jslib-common/abstractions/storage.service"; import { SyncService as SyncServiceAbstraction } from "jslib-common/abstractions/sync.service"; import { SystemService as SystemServiceAbstraction } from "jslib-common/abstractions/system.service"; @@ -168,6 +171,16 @@ export function initFactory( useClass: LoginGuardService, deps: [StateServiceAbstraction, PlatformUtilsServiceAbstraction, I18nServiceAbstraction], }, + { + provide: StateServiceAbstraction, + useClass: StateService, + deps: [ + StorageServiceAbstraction, + "SECURE_STORAGE", + LogServiceAbstraction, + StateMigrationServiceAbstraction, + ], + }, ], }) export class ServicesModule {} diff --git a/src/models/account.ts b/src/models/account.ts new file mode 100644 index 0000000000..5df9e602fe --- /dev/null +++ b/src/models/account.ts @@ -0,0 +1,20 @@ +import { + Account as BaseAccount, + AccountSettings as BaseAccountSettings, +} from "jslib-common/models/domain/account"; + +export class AccountSettings extends BaseAccountSettings { + vaultTimeout: number = -1; // On Restart +} + +export class Account extends BaseAccount { + settings?: AccountSettings = new AccountSettings(); + + constructor(init: Partial) { + super(init); + Object.assign(this.settings, { + ...new AccountSettings(), + ...this.settings, + }); + } +} diff --git a/src/services/state.service.ts b/src/services/state.service.ts new file mode 100644 index 0000000000..d73f3fba43 --- /dev/null +++ b/src/services/state.service.ts @@ -0,0 +1,13 @@ +import { StateService as BaseStateService } from "jslib-common/services/state.service"; + +import { Account } from "../models/account"; + +import { StateService as StateServiceAbstraction } from "jslib-common/abstractions/state.service"; + +export class StateService extends BaseStateService implements StateServiceAbstraction { + async addAccount(account: Account) { + // Apply desktop overides to default account values + account = new Account(account); + await super.addAccount(account); + } +}