1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-25 17:13:24 +00:00

fix(notification-processing): [PM-19877] System Notification Implementation - Renamed server notification service to make more sense.

This commit is contained in:
Patrick Pimentel
2025-07-23 15:53:09 -04:00
parent 2856a82193
commit 2ca7383114
6 changed files with 13 additions and 13 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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<SignalRNotification>;
let sut: DefaultNotificationsService;
let sut: DefaultServerNotificationsService;
beforeEach(() => {
syncService = mock<SyncService>();
@@ -93,7 +93,7 @@ describe("NotificationsService", () => {
() => new Subject<SignalRNotification>(),
);
sut = new DefaultNotificationsService(
sut = new DefaultServerNotificationsService(
mock<LogService>(),
syncService,
appIdService,

View File

@@ -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<readonly [NotificationResponse, UserId]>;
private activitySubject = new BehaviorSubject<"active" | "inactive">("active");

View File

@@ -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";

View File

@@ -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<readonly [NotificationResponse, UserId]>;
/**