From 93b9eba76925c95b470a4f7e8b33cef09fbd2a55 Mon Sep 17 00:00:00 2001 From: Matt Gibson Date: Mon, 27 May 2024 08:54:24 -0400 Subject: [PATCH] Separate browser foreground and background memory space (#9315) * Separate browser foreground and background memory space * Prefer inherited DI providers --- apps/browser/src/popup/services/services.module.ts | 10 ++-------- libs/common/src/auth/services/auth.service.ts | 6 +++--- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/apps/browser/src/popup/services/services.module.ts b/apps/browser/src/popup/services/services.module.ts index a4f5c8a4c67..d260b4ec7b1 100644 --- a/apps/browser/src/popup/services/services.module.ts +++ b/apps/browser/src/popup/services/services.module.ts @@ -25,7 +25,7 @@ import { VaultTimeoutService } from "@bitwarden/common/abstractions/vault-timeou import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { AccountService as AccountServiceAbstraction } from "@bitwarden/common/auth/abstractions/account.service"; -import { AuthService as AuthServiceAbstraction } from "@bitwarden/common/auth/abstractions/auth.service"; +import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; import { DeviceTrustServiceAbstraction } from "@bitwarden/common/auth/abstractions/device-trust.service.abstraction"; import { DevicesServiceAbstraction } from "@bitwarden/common/auth/abstractions/devices/devices.service.abstraction"; import { KdfConfigService } from "@bitwarden/common/auth/abstractions/kdf-config.service"; @@ -34,7 +34,6 @@ import { InternalMasterPasswordServiceAbstraction } from "@bitwarden/common/auth import { SsoLoginServiceAbstraction } from "@bitwarden/common/auth/abstractions/sso-login.service.abstraction"; import { TokenService } from "@bitwarden/common/auth/abstractions/token.service"; import { UserVerificationService } from "@bitwarden/common/auth/abstractions/user-verification/user-verification.service.abstraction"; -import { AuthService } from "@bitwarden/common/auth/services/auth.service"; import { AutofillSettingsService, AutofillSettingsServiceAbstraction, @@ -174,12 +173,7 @@ const safeProviders: SafeProvider[] = [ safeProvider({ provide: BaseUnauthGuardService, useClass: UnauthGuardService, - deps: [AuthServiceAbstraction, Router], - }), - safeProvider({ - provide: AuthServiceAbstraction, - useFactory: getBgService("authService"), - deps: [], + deps: [AuthService, Router], }), safeProvider({ provide: SsoLoginServiceAbstraction, diff --git a/libs/common/src/auth/services/auth.service.ts b/libs/common/src/auth/services/auth.service.ts index a4529084a2a..25e7b92edf2 100644 --- a/libs/common/src/auth/services/auth.service.ts +++ b/libs/common/src/auth/services/auth.service.ts @@ -11,8 +11,8 @@ import { import { ApiService } from "../../abstractions/api.service"; import { CryptoService } from "../../platform/abstractions/crypto.service"; -import { MessagingService } from "../../platform/abstractions/messaging.service"; import { StateService } from "../../platform/abstractions/state.service"; +import { MessageSender } from "../../platform/messaging"; import { Utils } from "../../platform/misc/utils"; import { UserId } from "../../types/guid"; import { AccountService } from "../abstractions/account.service"; @@ -26,7 +26,7 @@ export class AuthService implements AuthServiceAbstraction { constructor( protected accountService: AccountService, - protected messagingService: MessagingService, + protected messageSender: MessageSender, protected cryptoService: CryptoService, protected apiService: ApiService, protected stateService: StateService, @@ -95,6 +95,6 @@ export class AuthService implements AuthServiceAbstraction { logOut(callback: () => void) { callback(); - this.messagingService.send("loggedOut"); + this.messageSender.send("loggedOut"); } }