1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-11 00:31:45 +01:00

Fix noop notification service registration (#13131)

* Re-order the constructor dependencies to match between Noop and Default notification service

* Fix test file

* One more missed constructor
This commit is contained in:
Shane Melton 2025-01-29 09:58:01 -08:00 committed by GitHub
parent aef81210e3
commit db2b405421
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 11 additions and 11 deletions

View File

@ -1,6 +1,6 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { Subject, filter, firstValueFrom, map, merge, timeout } from "rxjs";
import { filter, firstValueFrom, map, merge, Subject, timeout } from "rxjs";
import { CollectionService, DefaultCollectionService } from "@bitwarden/admin-console/common";
import {
@ -112,10 +112,10 @@ import { NotificationsService } from "@bitwarden/common/platform/notifications";
// eslint-disable-next-line no-restricted-imports -- Needed for service creation
import {
DefaultNotificationsService,
WorkerWebPushConnectionService,
SignalRConnectionService,
UnsupportedWebPushConnectionService,
WebPushNotificationsApiService,
WorkerWebPushConnectionService,
} from "@bitwarden/common/platform/notifications/internal";
import { ScheduledTaskNames } from "@bitwarden/common/platform/scheduling";
import { AppIdService } from "@bitwarden/common/platform/services/app-id.service";
@ -198,10 +198,10 @@ import { FolderService } from "@bitwarden/common/vault/services/folder/folder.se
import { TotpService } from "@bitwarden/common/vault/services/totp.service";
import { VaultSettingsService } from "@bitwarden/common/vault/services/vault-settings/vault-settings.service";
import {
PasswordGenerationServiceAbstraction,
UsernameGenerationServiceAbstraction,
legacyPasswordGenerationServiceFactory,
legacyUsernameGenerationServiceFactory,
PasswordGenerationServiceAbstraction,
UsernameGenerationServiceAbstraction,
} from "@bitwarden/generator-legacy";
import {
ImportApiService,
@ -210,11 +210,11 @@ import {
ImportServiceAbstraction,
} from "@bitwarden/importer/core";
import {
BiometricStateService,
BiometricsService,
BiometricStateService,
DefaultBiometricStateService,
DefaultKeyService,
DefaultKdfConfigService,
DefaultKeyService,
KdfConfigService,
KeyService as KeyServiceAbstraction,
} from "@bitwarden/key-management";
@ -1057,6 +1057,7 @@ export default class MainBackground {
}
this.notificationsService = new DefaultNotificationsService(
this.logService,
this.syncService,
this.appIdService,
this.environmentService,
@ -1066,7 +1067,6 @@ export default class MainBackground {
new SignalRConnectionService(this.apiService, this.logService),
this.authService,
this.webPushConnectionService,
this.logService,
);
this.fido2UserInterfaceService = new BrowserFido2UserInterfaceService(this.authService);

View File

@ -906,6 +906,7 @@ const safeProviders: SafeProvider[] = [
? NoopNotificationsService
: DefaultNotificationsService,
deps: [
LogService,
SyncService,
AppIdServiceAbstraction,
EnvironmentService,
@ -915,7 +916,6 @@ const safeProviders: SafeProvider[] = [
SignalRConnectionService,
AuthServiceAbstraction,
WebPushConnectionService,
LogService,
],
}),
safeProvider({

View File

@ -22,7 +22,7 @@ import {
DefaultNotificationsService,
DISABLED_NOTIFICATIONS_URL,
} from "./default-notifications.service";
import { SignalRNotification, SignalRConnectionService } from "./signalr-connection.service";
import { SignalRConnectionService, SignalRNotification } from "./signalr-connection.service";
import { WebPushConnectionService, WebPushConnector } from "./webpush-connection.service";
import { WorkerWebPushConnectionService } from "./worker-webpush-connection.service";
@ -92,6 +92,7 @@ describe("NotificationsService", () => {
);
sut = new DefaultNotificationsService(
mock<LogService>(),
syncService,
appIdService,
environmentService,
@ -101,7 +102,6 @@ describe("NotificationsService", () => {
signalRNotificationConnectionService,
authService,
webPushNotificationConnectionService,
mock<LogService>(),
);
});

View File

@ -42,6 +42,7 @@ export class DefaultNotificationsService implements NotificationsServiceAbstract
private activitySubject = new BehaviorSubject<"active" | "inactive">("active");
constructor(
private readonly logService: LogService,
private syncService: SyncService,
private appIdService: AppIdService,
private environmentService: EnvironmentService,
@ -51,7 +52,6 @@ export class DefaultNotificationsService implements NotificationsServiceAbstract
private readonly signalRConnectionService: SignalRConnectionService,
private readonly authService: AuthService,
private readonly webPushConnectionService: WebPushConnectionService,
private readonly logService: LogService,
) {
this.notifications$ = this.accountService.activeAccount$.pipe(
map((account) => account?.id),