From 20561fff8703eefa356719662eeb88aea80e01ea Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 23 Jul 2021 23:15:32 +0200 Subject: [PATCH] Add support for helpers in environment service (#1002) * Add support for helpers in environment service * Add environment service to register component * Bump jslib --- jslib | 2 +- src/app/accounts/sso.component.ts | 5 +++-- src/app/services.module.ts | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/jslib b/jslib index c77441b353..e1ce721364 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit c77441b35348c821af7fd6261b6dc72732d5ebad +Subproject commit e1ce72136490b9055d8d6a03988e9d39ac560a89 diff --git a/src/app/accounts/sso.component.ts b/src/app/accounts/sso.component.ts index 30a45a8a1b..f2cb0039c5 100644 --- a/src/app/accounts/sso.component.ts +++ b/src/app/accounts/sso.component.ts @@ -8,6 +8,7 @@ import { import { ApiService } from 'jslib-common/abstractions/api.service'; import { AuthService } from 'jslib-common/abstractions/auth.service'; import { CryptoFunctionService } from 'jslib-common/abstractions/cryptoFunction.service'; +import { EnvironmentService } from 'jslib-common/abstractions/environment.service'; import { I18nService } from 'jslib-common/abstractions/i18n.service'; import { PasswordGenerationService } from 'jslib-common/abstractions/passwordGeneration.service'; import { PlatformUtilsService } from 'jslib-common/abstractions/platformUtils.service'; @@ -26,10 +27,10 @@ export class SsoComponent extends BaseSsoComponent { i18nService: I18nService, syncService: SyncService, route: ActivatedRoute, storageService: StorageService, stateService: StateService, platformUtilsService: PlatformUtilsService, apiService: ApiService, - cryptoFunctionService: CryptoFunctionService, + cryptoFunctionService: CryptoFunctionService, environmentService: EnvironmentService, passwordGenerationService: PasswordGenerationService) { super(authService, router, i18nService, route, storageService, stateService, platformUtilsService, - apiService, cryptoFunctionService, passwordGenerationService); + apiService, cryptoFunctionService, environmentService, passwordGenerationService); super.onSuccessfulLogin = () => { return syncService.fullSync(true); }; diff --git a/src/app/services.module.ts b/src/app/services.module.ts index bda7379558..acacb2b88d 100644 --- a/src/app/services.module.ts +++ b/src/app/services.module.ts @@ -101,7 +101,8 @@ const cryptoService = new ElectronCryptoService(storageService, secureStorageSer platformUtilsService, logService); const tokenService = new TokenService(storageService); const appIdService = new AppIdService(storageService); -const apiService = new ApiService(tokenService, platformUtilsService, +const environmentService = new EnvironmentService(storageService); +const apiService = new ApiService(tokenService, platformUtilsService, environmentService, async (expired: boolean) => messagingService.send('logout', { expired: expired })); const userService = new UserService(tokenService, storageService); const settingsService = new SettingsService(userService, storageService); @@ -130,8 +131,7 @@ const authService = new AuthService(cryptoService, apiService, userService, toke const exportService = new ExportService(folderService, cipherService, apiService, cryptoService); const auditService = new AuditService(cryptoFunctionService, apiService); const notificationsService = new NotificationsService(userService, syncService, appIdService, - apiService, vaultTimeoutService, async () => messagingService.send('logout', { expired: true }), logService); -const environmentService = new EnvironmentService(apiService, storageService, notificationsService); + apiService, vaultTimeoutService, environmentService, async () => messagingService.send('logout', { expired: true }), logService); const eventService = new EventService(storageService, apiService, userService, cipherService); const systemService = new SystemService(storageService, vaultTimeoutService, messagingService, platformUtilsService, null); @@ -150,7 +150,7 @@ export function initFactory(): Function { await i18nService.init(locale); eventService.init(true); authService.init(); - setTimeout(() => notificationsService.init(environmentService), 3000); + setTimeout(() => notificationsService.init(), 3000); const htmlEl = window.document.documentElement; htmlEl.classList.add('os_' + platformUtilsService.getDeviceString()); htmlEl.classList.add('locale_' + i18nService.translationLocale);