From 2ca73831146c12f794a179f81ad1f848b6b80458 Mon Sep 17 00:00:00 2001 From: Patrick Pimentel Date: Wed, 23 Jul 2025 15:53:09 -0400 Subject: [PATCH] fix(notification-processing): [PM-19877] System Notification Implementation - Renamed server notification service to make more sense. --- apps/browser/src/background/main.background.ts | 4 ++-- libs/angular/src/services/jslib-services.module.ts | 4 ++-- .../internal/default-notifications.service.spec.ts | 8 ++++---- ...service.ts => default-server-notifications.service.ts} | 4 ++-- libs/common/src/platform/notifications/internal/index.ts | 2 +- .../notifications/server-notifications-service.ts | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) rename libs/common/src/platform/notifications/internal/{default-notifications.service.ts => default-server-notifications.service.ts} (97%) diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index 291a56f52e9..ae0f5f25b62 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -124,7 +124,7 @@ import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/sym import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; // eslint-disable-next-line no-restricted-imports -- Needed for service creation import { - DefaultNotificationsService, + DefaultServerNotificationsService, SignalRConnectionService, UnsupportedWebPushConnectionService, WebPushNotificationsApiService, @@ -1145,7 +1145,7 @@ export default class MainBackground { this.systemNotificationService = new UnsupportedSystemNotificationsService(); } - this.notificationsService = new DefaultNotificationsService( + this.notificationsService = new DefaultServerNotificationsService( this.logService, this.syncService, this.appIdService, diff --git a/libs/angular/src/services/jslib-services.module.ts b/libs/angular/src/services/jslib-services.module.ts index 9b52bca3999..a26ec42121d 100644 --- a/libs/angular/src/services/jslib-services.module.ts +++ b/libs/angular/src/services/jslib-services.module.ts @@ -210,7 +210,7 @@ import { GlobalState } from "@bitwarden/common/platform/models/domain/global-sta import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; // eslint-disable-next-line no-restricted-imports -- Needed for service creation import { - DefaultNotificationsService, + DefaultServerNotificationsService, NoopNotificationsService, SignalRConnectionService, UnsupportedWebPushConnectionService, @@ -955,7 +955,7 @@ const safeProviders: SafeProvider[] = [ provide: ServerNotificationsService, useClass: devFlagEnabled("noopNotifications") ? NoopNotificationsService - : DefaultNotificationsService, + : DefaultServerNotificationsService, deps: [ LogService, SyncService, diff --git a/libs/common/src/platform/notifications/internal/default-notifications.service.spec.ts b/libs/common/src/platform/notifications/internal/default-notifications.service.spec.ts index 9dca079bdba..3842622d328 100644 --- a/libs/common/src/platform/notifications/internal/default-notifications.service.spec.ts +++ b/libs/common/src/platform/notifications/internal/default-notifications.service.spec.ts @@ -21,9 +21,9 @@ import { SupportStatus } from "../../misc/support-status"; import { SyncService } from "../../sync"; import { - DefaultNotificationsService, + DefaultServerNotificationsService, DISABLED_NOTIFICATIONS_URL, -} from "./default-notifications.service"; +} from "./default-server-notifications.service"; import { SignalRConnectionService, SignalRNotification } from "./signalr-connection.service"; import { WebPushConnectionService, WebPushConnector } from "./webpush-connection.service"; import { WorkerWebPushConnectionService } from "./worker-webpush-connection.service"; @@ -52,7 +52,7 @@ describe("NotificationsService", () => { notificationsUrl: string, ) => Subject; - let sut: DefaultNotificationsService; + let sut: DefaultServerNotificationsService; beforeEach(() => { syncService = mock(); @@ -93,7 +93,7 @@ describe("NotificationsService", () => { () => new Subject(), ); - sut = new DefaultNotificationsService( + sut = new DefaultServerNotificationsService( mock(), syncService, appIdService, diff --git a/libs/common/src/platform/notifications/internal/default-notifications.service.ts b/libs/common/src/platform/notifications/internal/default-server-notifications.service.ts similarity index 97% rename from libs/common/src/platform/notifications/internal/default-notifications.service.ts rename to libs/common/src/platform/notifications/internal/default-server-notifications.service.ts index 7f366318ded..3b024008f4d 100644 --- a/libs/common/src/platform/notifications/internal/default-notifications.service.ts +++ b/libs/common/src/platform/notifications/internal/default-server-notifications.service.ts @@ -32,14 +32,14 @@ import { EnvironmentService } from "../../abstractions/environment.service"; import { LogService } from "../../abstractions/log.service"; import { MessagingService } from "../../abstractions/messaging.service"; import { supportSwitch } from "../../misc/support-status"; -import { ServerNotificationsService as NotificationsServiceAbstraction } from "../server-notifications-service"; +import { ServerNotificationsService } from "../server-notifications-service"; import { ReceiveMessage, SignalRConnectionService } from "./signalr-connection.service"; import { WebPushConnectionService } from "./webpush-connection.service"; export const DISABLED_NOTIFICATIONS_URL = "http://-"; -export class DefaultNotificationsService implements NotificationsServiceAbstraction { +export class DefaultServerNotificationsService implements ServerNotificationsService { notifications$: Observable; private activitySubject = new BehaviorSubject<"active" | "inactive">("active"); diff --git a/libs/common/src/platform/notifications/internal/index.ts b/libs/common/src/platform/notifications/internal/index.ts index 067320ee56c..f55709f0f37 100644 --- a/libs/common/src/platform/notifications/internal/index.ts +++ b/libs/common/src/platform/notifications/internal/index.ts @@ -1,6 +1,6 @@ export * from "./worker-webpush-connection.service"; export * from "./signalr-connection.service"; -export * from "./default-notifications.service"; +export * from "./default-server-notifications.service"; export * from "./noop-notifications.service"; export * from "./unsupported-webpush-connection.service"; export * from "./webpush-connection.service"; diff --git a/libs/common/src/platform/notifications/server-notifications-service.ts b/libs/common/src/platform/notifications/server-notifications-service.ts index 7e7784de4ba..02d261aca35 100644 --- a/libs/common/src/platform/notifications/server-notifications-service.ts +++ b/libs/common/src/platform/notifications/server-notifications-service.ts @@ -4,7 +4,7 @@ import { NotificationResponse } from "@bitwarden/common/models/response/notifica import { UserId } from "@bitwarden/common/types/guid"; // eslint-disable-next-line @typescript-eslint/no-unused-vars -- Needed to link to API -import type { DefaultNotificationsService } from "./internal"; +import type { DefaultServerNotificationsService } from "./internal"; /** * A service offering abilities to interact with push notifications from the server. @@ -13,7 +13,7 @@ export abstract class ServerNotificationsService { /** * @deprecated This method should not be consumed, an observable to listen to server * notifications will be available one day but it is not ready to be consumed generally. - * Please add code reacting to notifications in {@link DefaultNotificationsService.processNotification} + * Please add code reacting to notifications in {@link DefaultServerNotificationsService.processNotification} */ abstract notifications$: Observable; /**