mirror of
https://github.com/bitwarden/desktop.git
synced 2025-03-23 15:10:42 +01:00
Minimal refactor to work with jslib
This commit is contained in:
parent
cbadcccc85
commit
95e234e265
@ -1,4 +1,4 @@
|
||||
import { APP_INITIALIZER, NgModule } from "@angular/core";
|
||||
import { APP_INITIALIZER, InjectionToken, NgModule } from "@angular/core";
|
||||
|
||||
import { JslibServicesModule } from "jslib-angular/services/jslib-services.module";
|
||||
import { BroadcasterService as BroadcasterServiceAbstraction } from "jslib-common/abstractions/broadcaster.service";
|
||||
@ -43,6 +43,9 @@ import { StateService } from "../services/state.service";
|
||||
|
||||
import { SearchBarService } from "./layout/search/search-bar.service";
|
||||
|
||||
import { CLIENT_TYPE, SECURE_STORAGE, WINDOW_TOKEN } from "jslib-common/abstractions/injectionTokens";
|
||||
import { ClientType } from "jslib-common/enums/clientType";
|
||||
|
||||
export function initFactory(
|
||||
window: Window,
|
||||
environmentService: EnvironmentServiceAbstraction,
|
||||
@ -107,7 +110,7 @@ export function initFactory(
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: initFactory,
|
||||
deps: [
|
||||
"WINDOW",
|
||||
WINDOW_TOKEN,
|
||||
EnvironmentServiceAbstraction,
|
||||
SyncServiceAbstraction,
|
||||
VaultTimeoutServiceAbstraction,
|
||||
@ -123,6 +126,7 @@ export function initFactory(
|
||||
multi: true,
|
||||
},
|
||||
{ provide: LogServiceAbstraction, useClass: ElectronLogService, deps: [] },
|
||||
{ provide: CLIENT_TYPE, useValue: ClientType.Desktop },
|
||||
{
|
||||
provide: PlatformUtilsServiceAbstraction,
|
||||
useFactory: (
|
||||
@ -135,7 +139,7 @@ export function initFactory(
|
||||
{
|
||||
provide: I18nServiceAbstraction,
|
||||
useFactory: (window: Window) => new I18nService(window.navigator.language, "./locales"),
|
||||
deps: ["WINDOW"],
|
||||
deps: [WINDOW_TOKEN],
|
||||
},
|
||||
{
|
||||
provide: MessagingServiceAbstraction,
|
||||
@ -143,7 +147,7 @@ export function initFactory(
|
||||
deps: [BroadcasterServiceAbstraction],
|
||||
},
|
||||
{ provide: StorageServiceAbstraction, useClass: ElectronRendererStorageService },
|
||||
{ provide: "SECURE_STORAGE", useClass: ElectronRendererSecureStorageService },
|
||||
{ provide: SECURE_STORAGE, useClass: ElectronRendererSecureStorageService },
|
||||
{
|
||||
provide: CryptoServiceAbstraction,
|
||||
useClass: ElectronCryptoService,
|
||||
@ -169,7 +173,6 @@ export function initFactory(
|
||||
{
|
||||
provide: LoginGuardService,
|
||||
useClass: LoginGuardService,
|
||||
deps: [StateServiceAbstraction, PlatformUtilsServiceAbstraction, I18nServiceAbstraction],
|
||||
},
|
||||
{
|
||||
provide: StateServiceAbstraction,
|
||||
@ -184,11 +187,12 @@ export function initFactory(
|
||||
secureStorageService,
|
||||
logService,
|
||||
stateMigrationService,
|
||||
new StateFactory(GlobalState, Account)
|
||||
new StateFactory(GlobalState, Account),
|
||||
true
|
||||
),
|
||||
deps: [
|
||||
StorageServiceAbstraction,
|
||||
"SECURE_STORAGE",
|
||||
SECURE_STORAGE,
|
||||
LogServiceAbstraction,
|
||||
StateMigrationServiceAbstraction,
|
||||
],
|
||||
@ -204,7 +208,7 @@ export function initFactory(
|
||||
secureStorageService,
|
||||
new StateFactory(GlobalState, Account)
|
||||
),
|
||||
deps: [StorageServiceAbstraction, "SECURE_STORAGE"],
|
||||
deps: [StorageServiceAbstraction, SECURE_STORAGE],
|
||||
},
|
||||
],
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user