From 0c400e7358d2c8e1228a3c3dc585a1ab91eefde4 Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Mon, 28 Mar 2022 06:44:27 +1000 Subject: [PATCH] Refactor StateService and Migration --- src/app/services.module.ts | 37 +++---------------------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/src/app/services.module.ts b/src/app/services.module.ts index 595dc43c..076a7913 100644 --- a/src/app/services.module.ts +++ b/src/app/services.module.ts @@ -10,6 +10,7 @@ import { I18nService as I18nServiceAbstraction } from "jslib-common/abstractions import { CLIENT_TYPE, SECURE_STORAGE, + STATE_FACTORY, WINDOW_TOKEN, } from "jslib-common/abstractions/injectionTokens"; import { LogService as LogServiceAbstraction } from "jslib-common/abstractions/log.service"; @@ -167,40 +168,8 @@ export function initFactory( useClass: LoginGuardService, }, { - provide: StateServiceAbstraction, - useFactory: ( - storageService: StorageServiceAbstraction, - secureStorageService: StorageServiceAbstraction, - logService: LogServiceAbstraction, - stateMigrationService: StateMigrationServiceAbstraction - ) => - new StateService( - storageService, - secureStorageService, - logService, - stateMigrationService, - new StateFactory(GlobalState, Account), - true - ), - deps: [ - StorageServiceAbstraction, - SECURE_STORAGE, - LogServiceAbstraction, - StateMigrationServiceAbstraction, - ], - }, - { - provide: StateMigrationServiceAbstraction, - useFactory: ( - storageService: StorageServiceAbstraction, - secureStorageService: StorageServiceAbstraction - ) => - new StateMigrationService( - storageService, - secureStorageService, - new StateFactory(GlobalState, Account) - ), - deps: [StorageServiceAbstraction, SECURE_STORAGE], + provide: STATE_FACTORY, + useFactory: () => new StateFactory(GlobalState, Account), }, ], })