diff --git a/apps/browser/src/autofill/background/overlay-notifications.background.spec.ts b/apps/browser/src/autofill/background/overlay-notifications.background.spec.ts index cf317de4fd2..c59ca28719a 100644 --- a/apps/browser/src/autofill/background/overlay-notifications.background.spec.ts +++ b/apps/browser/src/autofill/background/overlay-notifications.background.spec.ts @@ -451,7 +451,7 @@ describe("OverlayNotificationsBackground", () => { }); }); - describe("web requests that trigger notifications", () => { + describe("web requests that trigger server notifications", () => { const requestId = "123345"; const pageDetails = mock({ fields: [mock()] }); diff --git a/apps/browser/src/autofill/background/overlay-notifications.background.ts b/apps/browser/src/autofill/background/overlay-notifications.background.ts index e7126a57e9f..7a7eb0028f3 100644 --- a/apps/browser/src/autofill/background/overlay-notifications.background.ts +++ b/apps/browser/src/autofill/background/overlay-notifications.background.ts @@ -41,7 +41,7 @@ export class OverlayNotificationsBackground implements OverlayNotificationsBackg ) {} /** - * Initialize the overlay notifications background service. + * Initialize the overlay server notifications background service. */ async init() { this.setupExtensionListeners(); @@ -395,7 +395,7 @@ export class OverlayNotificationsBackground implements OverlayNotificationsBackg }; /** - * This method attempts to trigger the add login, change password, or at-risk password notifications + * This method attempts to trigger the add login, change password, or at-risk password server notifications * based on the modified login data and the tab details. * * @param requestId - The details of the web response @@ -462,7 +462,7 @@ export class OverlayNotificationsBackground implements OverlayNotificationsBackg case NotificationTypes.AtRiskPassword: return !modifyLoginData.newPassword; case NotificationTypes.Unlock: - // Unlock notifications are handled separately and do not require form data + // Unlock server notifications are handled separately and do not require form data return false; default: this.logService.error(`Unknown notification type: ${notificationType}`); diff --git a/apps/browser/src/autofill/content/autofill-init.ts b/apps/browser/src/autofill/content/autofill-init.ts index b6fc6c3392e..5a71e3bd8da 100644 --- a/apps/browser/src/autofill/content/autofill-init.ts +++ b/apps/browser/src/autofill/content/autofill-init.ts @@ -35,7 +35,7 @@ class AutofillInit implements AutofillInitInterface { * @param domElementVisibilityService - Used to check if an element is viewable. * @param autofillOverlayContentService - The autofill overlay content service, potentially undefined. * @param autofillInlineMenuContentService - The inline menu content service, potentially undefined. - * @param overlayNotificationsContentService - The overlay notifications content service, potentially undefined. + * @param overlayNotificationsContentService - The overlay server notifications content service, potentially undefined. */ constructor( domQueryService: DomQueryService, diff --git a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts index 4db00901759..fc8ce376f12 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts @@ -643,7 +643,7 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ }; /** - * Returns the form field data used for add login and change password notifications. + * Returns the form field data used for add login and change password server notifications. */ private getFormFieldData = (): ModifyLoginCipherFormData => { return { diff --git a/apps/browser/src/background/idle.background.ts b/apps/browser/src/background/idle.background.ts index aaa23a140db..81a869917a6 100644 --- a/apps/browser/src/background/idle.background.ts +++ b/apps/browser/src/background/idle.background.ts @@ -7,7 +7,7 @@ import { VaultTimeoutSettingsService, VaultTimeoutStringType, } from "@bitwarden/common/key-management/vault-timeout"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; const IdleInterval = 60 * 5; // 5 minutes diff --git a/apps/browser/src/background/main.background.ts b/apps/browser/src/background/main.background.ts index b2bb40ef700..530b67c34a3 100644 --- a/apps/browser/src/background/main.background.ts +++ b/apps/browser/src/background/main.background.ts @@ -119,7 +119,7 @@ import { Lazy } from "@bitwarden/common/platform/misc/lazy"; import { Account } from "@bitwarden/common/platform/models/domain/account"; import { GlobalState } from "@bitwarden/common/platform/models/domain/global-state"; import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; // eslint-disable-next-line no-restricted-imports -- Needed for service creation import { DefaultServerNotificationsService, @@ -127,9 +127,7 @@ import { UnsupportedWebPushConnectionService, WebPushNotificationsApiService, WorkerWebPushConnectionService, -} from "@bitwarden/common/platform/notifications/internal"; -import { SystemNotificationsService } from "@bitwarden/common/platform/notifications/system-notifications.service"; -import { UnsupportedSystemNotificationsService } from "@bitwarden/common/platform/notifications/unsupported-system-notifications.service"; +} from "@bitwarden/common/platform/server-notifications/internal"; import { AppIdService } from "@bitwarden/common/platform/services/app-id.service"; import { ConfigApiService } from "@bitwarden/common/platform/services/config/config-api.service"; import { DefaultConfigService } from "@bitwarden/common/platform/services/config/default-config.service"; @@ -169,6 +167,8 @@ import { WindowStorageService } from "@bitwarden/common/platform/storage/window- import { SyncService } from "@bitwarden/common/platform/sync"; // eslint-disable-next-line no-restricted-imports -- Needed for service creation import { DefaultSyncService } from "@bitwarden/common/platform/sync/internal"; +import { SystemNotificationsService } from "@bitwarden/common/platform/system-notifications/"; +import { UnsupportedSystemNotificationsService } from "@bitwarden/common/platform/system-notifications/unsupported-system-notifications.service"; import { DefaultThemeStateService } from "@bitwarden/common/platform/theming/theme-state.service"; import { ApiService } from "@bitwarden/common/services/api.service"; import { AuditService } from "@bitwarden/common/services/audit.service"; diff --git a/apps/browser/src/platform/notifications/foreground-server-notifications.service.ts b/apps/browser/src/platform/notifications/foreground-server-notifications.service.ts index 02fd092339f..6ab164d9c63 100644 --- a/apps/browser/src/platform/notifications/foreground-server-notifications.service.ts +++ b/apps/browser/src/platform/notifications/foreground-server-notifications.service.ts @@ -2,10 +2,10 @@ import { Observable, Subscription } from "rxjs"; import { NotificationResponse } from "@bitwarden/common/models/response/notification.response"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; import { UserId } from "@bitwarden/common/types/guid"; -// Eventually if we want to support listening to notifications from browser foreground we +// Eventually if we want to support listening to server notifications from browser foreground we // will only ever create a single SignalR connection, likely messaging to the background to reuse its connection. export class ForegroundServerNotificationsService implements ServerNotificationsService { notifications$: Observable; diff --git a/apps/browser/src/platform/system-notifications/browser-system-notification.service.ts b/apps/browser/src/platform/system-notifications/browser-system-notification.service.ts index e41609a50be..26b49515b82 100644 --- a/apps/browser/src/platform/system-notifications/browser-system-notification.service.ts +++ b/apps/browser/src/platform/system-notifications/browser-system-notification.service.ts @@ -1,5 +1,4 @@ import { map, merge, Observable } from "rxjs"; -import { v4 as uuidv4 } from "uuid"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; @@ -9,7 +8,7 @@ import { SystemNotificationCreateInfo, SystemNotificationEvent, SystemNotificationsService, -} from "@bitwarden/common/platform/notifications/system-notifications.service"; +} from "@bitwarden/common/platform/system-notifications/system-notifications.service"; import { fromChromeEvent } from "../browser/from-chrome-event"; @@ -36,48 +35,19 @@ export class BrowserSystemNotificationService implements SystemNotificationsServ ); } - async create(createInfo: SystemNotificationCreateInfo): Promise { - try { - const notificationId = createInfo.id || uuidv4(); - - chrome.notifications.create(notificationId, { - iconUrl: "https://avatars.githubusercontent.com/u/15990069?s=200", - message: createInfo.body, - type: "basic", - title: createInfo.title, - buttons: createInfo.buttons.map((value) => { - return { title: value.title }; - }), - }); - - // eslint-disable-next-line no-restricted-syntax - chrome.notifications.onButtonClicked.addListener( - (notificationId: string, buttonIndex: number) => { - this.notificationClicked$.subscribe({ - next: () => ({ - id: notificationId, - buttonIdentifier: buttonIndex, - }), - }); + async create(createInfo: SystemNotificationCreateInfo): Promise { + return new Promise((resolve) => { + chrome.notifications.create( + { + iconUrl: chrome.runtime.getURL("images/icon128.png"), + message: createInfo.body, + type: "basic", + title: createInfo.title, + buttons: createInfo.buttons.map((value) => ({ title: value.title })), }, + (notificationId) => resolve(notificationId), ); - - // eslint-disable-next-line no-restricted-syntax - chrome.notifications.onClicked.addListener((notificationId: string) => { - this.notificationClicked$.subscribe({ - next: () => ({ - id: notificationId, - buttonIdentifier: ButtonLocation.NotificationButton, - }), - }); - }); - - return notificationId; - } catch (e) { - this.logService.error( - `Failed to create notification on ${this.platformUtilsService.getDevice()} with error: ${e}`, - ); - } + }); } async clear(clearInfo: SystemNotificationClearInfo): Promise { diff --git a/apps/browser/src/popup/services/services.module.ts b/apps/browser/src/popup/services/services.module.ts index 7e9017e930a..100e472e9a4 100644 --- a/apps/browser/src/popup/services/services.module.ts +++ b/apps/browser/src/popup/services/services.module.ts @@ -96,9 +96,8 @@ import { Message, MessageListener, MessageSender } from "@bitwarden/common/platf // eslint-disable-next-line no-restricted-imports -- Used for dependency injection import { SubjectMessageSender } from "@bitwarden/common/platform/messaging/internal"; import { flagEnabled } from "@bitwarden/common/platform/misc/flags"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; -import { SystemNotificationsService } from "@bitwarden/common/platform/notifications/system-notifications.service"; import { TaskSchedulerService } from "@bitwarden/common/platform/scheduling"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; import { ConsoleLogService } from "@bitwarden/common/platform/services/console-log.service"; import { ContainerService } from "@bitwarden/common/platform/services/container.service"; import { DefaultSdkClientFactory } from "@bitwarden/common/platform/services/sdk/default-sdk-client-factory"; @@ -114,6 +113,7 @@ import { InlineDerivedStateProvider } from "@bitwarden/common/platform/state/imp import { PrimarySecondaryStorageService } from "@bitwarden/common/platform/storage/primary-secondary-storage.service"; import { WindowStorageService } from "@bitwarden/common/platform/storage/window-storage.service"; import { SyncService } from "@bitwarden/common/platform/sync"; +import { SystemNotificationsService } from "@bitwarden/common/platform/system-notifications/system-notifications.service"; import { SendApiService } from "@bitwarden/common/tools/send/services/send-api.service.abstraction"; import { InternalSendService } from "@bitwarden/common/tools/send/services/send.service.abstraction"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; diff --git a/apps/browser/src/vault/popup/components/at-risk-passwords/at-risk-passwords.component.ts b/apps/browser/src/vault/popup/components/at-risk-passwords/at-risk-passwords.component.ts index 1bfb65a15cc..d144169a715 100644 --- a/apps/browser/src/vault/popup/components/at-risk-passwords/at-risk-passwords.component.ts +++ b/apps/browser/src/vault/popup/components/at-risk-passwords/at-risk-passwords.component.ts @@ -218,7 +218,7 @@ export class AtRiskPasswordsComponent implements OnInit { }); }), concatMap((unreadTaskNotifications) => { - // TODO: Investigate creating a bulk endpoint to mark notifications as read + // TODO: Investigate creating a bulk endpoint to mark server notifications as read return concat( ...unreadTaskNotifications.map((n) => this.endUserNotificationService.markAsRead(n.id, userId), diff --git a/apps/desktop/src/app/app.component.ts b/apps/desktop/src/app/app.component.ts index 6afda4e9ddf..8c74624414b 100644 --- a/apps/desktop/src/app/app.component.ts +++ b/apps/desktop/src/app/app.component.ts @@ -61,7 +61,7 @@ import { MessagingService } from "@bitwarden/common/platform/abstractions/messag import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { SystemService } from "@bitwarden/common/platform/abstractions/system.service"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; import { StateEventRunnerService } from "@bitwarden/common/platform/state"; import { SyncService } from "@bitwarden/common/platform/sync"; import { UserId } from "@bitwarden/common/types/guid"; diff --git a/apps/desktop/src/app/services/init.service.ts b/apps/desktop/src/app/services/init.service.ts index dad7739bc5a..0738aaba295 100644 --- a/apps/desktop/src/app/services/init.service.ts +++ b/apps/desktop/src/app/services/init.service.ts @@ -13,7 +13,7 @@ import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/platfor import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { SdkLoadService } from "@bitwarden/common/platform/abstractions/sdk/sdk-load.service"; import { StateService as StateServiceAbstraction } from "@bitwarden/common/platform/abstractions/state.service"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; import { ContainerService } from "@bitwarden/common/platform/services/container.service"; import { UserAutoUnlockKeyService } from "@bitwarden/common/platform/services/user-auto-unlock-key.service"; import { SyncService as SyncServiceAbstraction } from "@bitwarden/common/platform/sync"; diff --git a/apps/web/src/app/app.component.ts b/apps/web/src/app/app.component.ts index 0729d42f053..6240fd4eec4 100644 --- a/apps/web/src/app/app.component.ts +++ b/apps/web/src/app/app.component.ts @@ -21,7 +21,7 @@ import { ConfigService } from "@bitwarden/common/platform/abstractions/config/co import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; import { StateEventRunnerService } from "@bitwarden/common/platform/state"; import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service"; import { InternalFolderService } from "@bitwarden/common/vault/abstractions/folder/folder.service.abstraction"; diff --git a/apps/web/src/app/core/core.module.ts b/apps/web/src/app/core/core.module.ts index a222b668043..965a9d5c99d 100644 --- a/apps/web/src/app/core/core.module.ts +++ b/apps/web/src/app/core/core.module.ts @@ -84,7 +84,7 @@ import { IpcService } from "@bitwarden/common/platform/ipc"; import { UnsupportedWebPushConnectionService, WebPushConnectionService, -} from "@bitwarden/common/platform/notifications/internal"; +} from "@bitwarden/common/platform/server-notifications/internal"; import { AppIdService as DefaultAppIdService } from "@bitwarden/common/platform/services/app-id.service"; import { MemoryStorageService } from "@bitwarden/common/platform/services/memory-storage.service"; import { MigrationBuilderService } from "@bitwarden/common/platform/services/migration-builder.service"; diff --git a/apps/web/src/app/core/init.service.ts b/apps/web/src/app/core/init.service.ts index ecf10bfa723..f75d1268053 100644 --- a/apps/web/src/app/core/init.service.ts +++ b/apps/web/src/app/core/init.service.ts @@ -13,7 +13,7 @@ import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/platfor import { SdkLoadService } from "@bitwarden/common/platform/abstractions/sdk/sdk-load.service"; import { StateService as StateServiceAbstraction } from "@bitwarden/common/platform/abstractions/state.service"; import { IpcService } from "@bitwarden/common/platform/ipc"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; import { ContainerService } from "@bitwarden/common/platform/services/container.service"; import { UserAutoUnlockKeyService } from "@bitwarden/common/platform/services/user-auto-unlock-key.service"; import { EventUploadService } from "@bitwarden/common/services/event/event-upload.service"; diff --git a/apps/web/src/app/platform/notifications/permissions-webpush-connection.service.ts b/apps/web/src/app/platform/notifications/permissions-webpush-connection.service.ts index 44866285251..c0bc9ed3e77 100644 --- a/apps/web/src/app/platform/notifications/permissions-webpush-connection.service.ts +++ b/apps/web/src/app/platform/notifications/permissions-webpush-connection.service.ts @@ -5,7 +5,7 @@ import { SupportStatus } from "@bitwarden/common/platform/misc/support-status"; import { WebPushConnector, WorkerWebPushConnectionService, -} from "@bitwarden/common/platform/notifications/internal"; +} from "@bitwarden/common/platform/server-notifications/internal"; import { UserId } from "@bitwarden/common/types/guid"; export class PermissionsWebPushConnectionService extends WorkerWebPushConnectionService { diff --git a/apps/web/src/app/vault/individual-vault/vault.component.ts b/apps/web/src/app/vault/individual-vault/vault.component.ts index 658f829128d..ca8b05c2701 100644 --- a/apps/web/src/app/vault/individual-vault/vault.component.ts +++ b/apps/web/src/app/vault/individual-vault/vault.component.ts @@ -565,7 +565,7 @@ export class VaultComponent implements OnInit, OnDestr this.refreshing = false; // Explicitly mark for check to ensure the view is updated - // Some sources are not always emitted within the Angular zone (e.g. ciphers updated via WS notifications) + // Some sources are not always emitted within the Angular zone (e.g. ciphers updated via WS server notifications) this.changeDetectorRef.markForCheck(); }, ); diff --git a/libs/angular/src/services/jslib-services.module.ts b/libs/angular/src/services/jslib-services.module.ts index 0a64c3a90cf..f88088f4812 100644 --- a/libs/angular/src/services/jslib-services.module.ts +++ b/libs/angular/src/services/jslib-services.module.ts @@ -202,20 +202,20 @@ import { SubjectMessageSender } from "@bitwarden/common/platform/messaging/inter import { devFlagEnabled } from "@bitwarden/common/platform/misc/flags"; import { Account } from "@bitwarden/common/platform/models/domain/account"; import { GlobalState } from "@bitwarden/common/platform/models/domain/global-state"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; -// eslint-disable-next-line no-restricted-imports -- Needed for service creation -import { - DefaultServerNotificationsService, - UnsupportedServerNotificationsService, - SignalRConnectionService, - UnsupportedWebPushConnectionService, - WebPushConnectionService, - WebPushNotificationsApiService, -} from "@bitwarden/common/platform/notifications/internal"; import { DefaultTaskSchedulerService, TaskSchedulerService, } from "@bitwarden/common/platform/scheduling"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; +// eslint-disable-next-line no-restricted-imports -- Needed for service creation +import { + DefaultServerNotificationsService, + NoopServerNotificationsService, + SignalRConnectionService, + UnsupportedWebPushConnectionService, + WebPushConnectionService, + WebPushNotificationsApiService, +} from "@bitwarden/common/platform/server-notifications/internal"; import { AppIdService } from "@bitwarden/common/platform/services/app-id.service"; import { ConfigApiService } from "@bitwarden/common/platform/services/config/config-api.service"; import { DefaultConfigService } from "@bitwarden/common/platform/services/config/default-config.service"; @@ -952,7 +952,7 @@ const safeProviders: SafeProvider[] = [ safeProvider({ provide: ServerNotificationsService, useClass: devFlagEnabled("noopNotifications") - ? UnsupportedServerNotificationsService + ? NoopServerNotificationsService : DefaultServerNotificationsService, deps: [ LogService, @@ -1115,7 +1115,7 @@ const safeProviders: SafeProvider[] = [ // This is a slightly odd dependency tree for a specialized api service // it depends on SyncService so that new data can be retrieved through the sync // rather than updating the OrganizationService directly. Instead OrganizationService - // subscribes to sync notifications and will update itself based on that. + // subscribes to sync server notifications and will update itself based on that. deps: [ApiServiceAbstraction, SyncService], }), safeProvider({ diff --git a/libs/auth/src/common/abstractions/auth-request.service.abstraction.ts b/libs/auth/src/common/abstractions/auth-request.service.abstraction.ts index 9eea3fe7bb0..10cc643fd45 100644 --- a/libs/auth/src/common/abstractions/auth-request.service.abstraction.ts +++ b/libs/auth/src/common/abstractions/auth-request.service.abstraction.ts @@ -109,9 +109,9 @@ export abstract class AuthRequestServiceAbstraction { ): Promise<{ masterKey: MasterKey; masterKeyHash: string }>; /** - * Handles incoming auth request push notifications. + * Handles incoming auth request push server notifications. * @param notification push notification. - * @remark We should only be receiving approved push notifications to prevent enumeration. + * @remark We should only be receiving approved push server notifications to prevent enumeration. */ abstract sendAuthRequestPushNotification(notification: AuthRequestPushNotification): void; diff --git a/libs/auth/src/common/services/auth-request/auth-request-api.service.ts b/libs/auth/src/common/services/auth-request/auth-request-api.service.ts index 15517a9a0e5..52c8cff1b7f 100644 --- a/libs/auth/src/common/services/auth-request/auth-request-api.service.ts +++ b/libs/auth/src/common/services/auth-request/auth-request-api.service.ts @@ -63,7 +63,7 @@ export class DefaultAuthRequestApiService implements AuthRequestApiServiceAbstra try { // Submit the current device identifier in the header as well as in the POST body. // The value in the header will be used to build the request context and ensure that the resulting - // notifications have the current device as a source. + // server notifications have the current device as a source. const response = await this.apiService.send( "POST", "/auth-requests/", diff --git a/libs/common/src/autofill/services/domain-settings.service.ts b/libs/common/src/autofill/services/domain-settings.service.ts index b2833b9ee25..d08fe07c50d 100644 --- a/libs/common/src/autofill/services/domain-settings.service.ts +++ b/libs/common/src/autofill/services/domain-settings.service.ts @@ -25,7 +25,7 @@ const SHOW_FAVICONS = new KeyDefinition(DOMAIN_SETTINGS_DISK, "showFavicons", { deserializer: (value: boolean) => value ?? true, }); -// Domain exclusion list for notifications +// Domain exclusion list for server notifications const NEVER_DOMAINS = new KeyDefinition(DOMAIN_SETTINGS_DISK, "neverDomains", { deserializer: (value: NeverDomains) => value ?? null, }); @@ -64,7 +64,7 @@ export abstract class DomainSettingsService { setShowFavicons: (newValue: boolean) => Promise; /** - * User-specified URIs for which the client notifications should not appear + * User-specified URIs for which the client server notifications should not appear */ neverDomains$: Observable; setNeverDomains: (newValue: NeverDomains) => Promise; diff --git a/libs/common/src/enums/push-technology.enum.ts b/libs/common/src/enums/push-technology.enum.ts index 1bc4e62cc9d..83de1f5849a 100644 --- a/libs/common/src/enums/push-technology.enum.ts +++ b/libs/common/src/enums/push-technology.enum.ts @@ -5,11 +5,11 @@ // eslint-disable-next-line @bitwarden/platform/no-enums export enum PushTechnology { /** - * Indicates that we should use SignalR over web sockets to receive push notifications from the server. + * Indicates that we should use SignalR over web sockets to receive push server notifications from the server. */ SignalR = 0, /** - * Indicatates that we should use WebPush to receive push notifications from the server. + * Indicates that we should use WebPush to receive push server notifications from the server. */ WebPush = 1, } diff --git a/libs/common/src/platform/notifications/index.ts b/libs/common/src/platform/server-notifications/index.ts similarity index 100% rename from libs/common/src/platform/notifications/index.ts rename to libs/common/src/platform/server-notifications/index.ts diff --git a/libs/common/src/platform/notifications/internal/default-notifications.service.spec.ts b/libs/common/src/platform/server-notifications/internal/default-notifications.service.spec.ts similarity index 97% rename from libs/common/src/platform/notifications/internal/default-notifications.service.spec.ts rename to libs/common/src/platform/server-notifications/internal/default-notifications.service.spec.ts index 3842622d328..567e0fbfc3d 100644 --- a/libs/common/src/platform/notifications/internal/default-notifications.service.spec.ts +++ b/libs/common/src/platform/server-notifications/internal/default-notifications.service.spec.ts @@ -134,7 +134,7 @@ describe("NotificationsService", () => { expect(actualNotification.type).toBe(expectedType); }; - it("emits notifications through WebPush when supported", async () => { + it("emits server notifications through WebPush when supported", async () => { const notificationsPromise = firstValueFrom(sut.notifications$.pipe(bufferCount(2))); emitActiveUser(mockUser1); @@ -227,7 +227,7 @@ describe("NotificationsService", () => { }); it.each([ - // Temporarily rolling back notifications being connected while locked + // Temporarily rolling back server notifications being connected while locked // { initialStatus: AuthenticationStatus.Locked, updatedStatus: AuthenticationStatus.Unlocked }, // { initialStatus: AuthenticationStatus.Unlocked, updatedStatus: AuthenticationStatus.Locked }, // { initialStatus: AuthenticationStatus.Locked, updatedStatus: AuthenticationStatus.Locked }, @@ -256,7 +256,7 @@ describe("NotificationsService", () => { ); it.each([ - // Temporarily disabling notifications connecting while in a locked state + // Temporarily disabling server notifications connecting while in a locked state // AuthenticationStatus.Locked, AuthenticationStatus.Unlocked, ])( @@ -282,7 +282,7 @@ describe("NotificationsService", () => { }, ); - it("does not connect to any notification stream when notifications are disabled through special url", () => { + it("does not connect to any notification stream when server notifications are disabled through special url", () => { const subscription = sut.notifications$.subscribe(); emitActiveUser(mockUser1); emitNotificationUrl(DISABLED_NOTIFICATIONS_URL); diff --git a/libs/common/src/platform/notifications/internal/default-server-notifications.service.ts b/libs/common/src/platform/server-notifications/internal/default-server-notifications.service.ts similarity index 94% rename from libs/common/src/platform/notifications/internal/default-server-notifications.service.ts rename to libs/common/src/platform/server-notifications/internal/default-server-notifications.service.ts index 09657d3908c..4502d9663a3 100644 --- a/libs/common/src/platform/notifications/internal/default-server-notifications.service.ts +++ b/libs/common/src/platform/server-notifications/internal/default-server-notifications.service.ts @@ -61,7 +61,7 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer distinctUntilChanged(), switchMap((activeAccountId) => { if (activeAccountId == null) { - // We don't emit notifications for inactive accounts currently + // We don't emit server-notifications for inactive accounts currently return EMPTY; } @@ -74,8 +74,8 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer } /** - * Retrieves a stream of push notifications for the given user. - * @param userId The user id of the user to get the push notifications for. + * Retrieves a stream of push server notifications for the given user. + * @param userId The user id of the user to get the push server notifications for. */ private userNotifications$(userId: UserId) { return this.environmentService.environment$.pipe( @@ -109,7 +109,7 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer }), supportSwitch({ supported: (service) => { - this.logService.info("Using WebPush for notifications"); + this.logService.info("Using WebPush for server notifications"); return service.notifications$.pipe( catchError((err: unknown) => { this.logService.warning("Issue with web push, falling back to SignalR", err); @@ -118,7 +118,7 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer ); }, notSupported: () => { - this.logService.info("Using SignalR for notifications"); + this.logService.info("Using SignalR for server notifications"); return this.connectSignalR$(userId, notificationsUrl); }, }), @@ -236,7 +236,8 @@ export class DefaultServerNotificationsService implements ServerNotificationsSer mergeMap(async ([notification, userId]) => this.processNotification(notification, userId)), ) .subscribe({ - error: (e: unknown) => this.logService.warning("Error in notifications$ observable", e), + error: (e: unknown) => + this.logService.warning("Error in server notifications$ observable", e), }); } diff --git a/libs/common/src/platform/notifications/internal/index.ts b/libs/common/src/platform/server-notifications/internal/index.ts similarity index 86% rename from libs/common/src/platform/notifications/internal/index.ts rename to libs/common/src/platform/server-notifications/internal/index.ts index c6ffd8162b8..daa89a79468 100644 --- a/libs/common/src/platform/notifications/internal/index.ts +++ b/libs/common/src/platform/server-notifications/internal/index.ts @@ -1,7 +1,7 @@ export * from "./worker-webpush-connection.service"; export * from "./signalr-connection.service"; export * from "./default-server-notifications.service"; -export * from "./unsupported-server-notifications.service"; +export * from "./noop-server-notifications.service"; export * from "./unsupported-webpush-connection.service"; export * from "./webpush-connection.service"; export * from "./websocket-webpush-connection.service"; diff --git a/libs/common/src/platform/notifications/internal/unsupported-server-notifications.service.ts b/libs/common/src/platform/server-notifications/internal/noop-server-notifications.service.ts similarity index 82% rename from libs/common/src/platform/notifications/internal/unsupported-server-notifications.service.ts rename to libs/common/src/platform/server-notifications/internal/noop-server-notifications.service.ts index 6422e17247c..6a6bb9e19ed 100644 --- a/libs/common/src/platform/notifications/internal/unsupported-server-notifications.service.ts +++ b/libs/common/src/platform/server-notifications/internal/noop-server-notifications.service.ts @@ -6,14 +6,14 @@ import { UserId } from "@bitwarden/common/types/guid"; import { LogService } from "../../abstractions/log.service"; import { ServerNotificationsService } from "../server-notifications.service"; -export class UnsupportedServerNotificationsService implements ServerNotificationsService { +export class NoopServerNotificationsService implements ServerNotificationsService { notifications$: Observable = new Subject(); constructor(private logService: LogService) {} startListening(): Subscription { this.logService.info( - "Initializing no-op notification service, no push notifications will be received", + "Initializing no-op notification service, no push server notifications will be received", ); return Subscription.EMPTY; } diff --git a/libs/common/src/platform/notifications/internal/signalr-connection.service.ts b/libs/common/src/platform/server-notifications/internal/signalr-connection.service.ts similarity index 100% rename from libs/common/src/platform/notifications/internal/signalr-connection.service.ts rename to libs/common/src/platform/server-notifications/internal/signalr-connection.service.ts diff --git a/libs/common/src/platform/notifications/internal/unsupported-webpush-connection.service.ts b/libs/common/src/platform/server-notifications/internal/unsupported-webpush-connection.service.ts similarity index 100% rename from libs/common/src/platform/notifications/internal/unsupported-webpush-connection.service.ts rename to libs/common/src/platform/server-notifications/internal/unsupported-webpush-connection.service.ts diff --git a/libs/common/src/platform/notifications/internal/web-push-notifications-api.service.ts b/libs/common/src/platform/server-notifications/internal/web-push-notifications-api.service.ts similarity index 94% rename from libs/common/src/platform/notifications/internal/web-push-notifications-api.service.ts rename to libs/common/src/platform/server-notifications/internal/web-push-notifications-api.service.ts index b824b8c7d65..891dab2c069 100644 --- a/libs/common/src/platform/notifications/internal/web-push-notifications-api.service.ts +++ b/libs/common/src/platform/server-notifications/internal/web-push-notifications-api.service.ts @@ -10,7 +10,7 @@ export class WebPushNotificationsApiService { ) {} /** - * Posts a device-user association to the server and ensures it's installed for push notifications + * Posts a device-user association to the server and ensures it's installed for push server notifications */ async putSubscription(pushSubscription: PushSubscriptionJSON): Promise { const request = WebPushRequest.from(pushSubscription); diff --git a/libs/common/src/platform/notifications/internal/web-push.request.ts b/libs/common/src/platform/server-notifications/internal/web-push.request.ts similarity index 100% rename from libs/common/src/platform/notifications/internal/web-push.request.ts rename to libs/common/src/platform/server-notifications/internal/web-push.request.ts diff --git a/libs/common/src/platform/notifications/internal/webpush-connection.service.ts b/libs/common/src/platform/server-notifications/internal/webpush-connection.service.ts similarity index 100% rename from libs/common/src/platform/notifications/internal/webpush-connection.service.ts rename to libs/common/src/platform/server-notifications/internal/webpush-connection.service.ts diff --git a/libs/common/src/platform/notifications/internal/websocket-webpush-connection.service.ts b/libs/common/src/platform/server-notifications/internal/websocket-webpush-connection.service.ts similarity index 100% rename from libs/common/src/platform/notifications/internal/websocket-webpush-connection.service.ts rename to libs/common/src/platform/server-notifications/internal/websocket-webpush-connection.service.ts diff --git a/libs/common/src/platform/notifications/internal/worker-webpush-connection.service.spec.ts b/libs/common/src/platform/server-notifications/internal/worker-webpush-connection.service.spec.ts similarity index 100% rename from libs/common/src/platform/notifications/internal/worker-webpush-connection.service.spec.ts rename to libs/common/src/platform/server-notifications/internal/worker-webpush-connection.service.spec.ts diff --git a/libs/common/src/platform/notifications/internal/worker-webpush-connection.service.ts b/libs/common/src/platform/server-notifications/internal/worker-webpush-connection.service.ts similarity index 98% rename from libs/common/src/platform/notifications/internal/worker-webpush-connection.service.ts rename to libs/common/src/platform/server-notifications/internal/worker-webpush-connection.service.ts index 528ad90ed61..d8a2c33568e 100644 --- a/libs/common/src/platform/notifications/internal/worker-webpush-connection.service.ts +++ b/libs/common/src/platform/server-notifications/internal/worker-webpush-connection.service.ts @@ -40,7 +40,7 @@ interface PushEvent { } /** - * An implementation for connecting to web push based notifications running in a Worker. + * An implementation for connecting to web push based server notifications running in a Worker. */ export class WorkerWebPushConnectionService implements WebPushConnectionService { private pushEvent = new Subject(); @@ -75,7 +75,7 @@ export class WorkerWebPushConnectionService implements WebPushConnectionService } supportStatus$(userId: UserId): Observable> { - // Check the server config to see if it supports sending WebPush notifications + // Check the server config to see if it supports sending WebPush server notifications // FIXME: get config of server for the specified userId, once ConfigService supports it return this.configService.serverConfig$.pipe( map((config) => diff --git a/libs/common/src/platform/notifications/server-notifications.service.ts b/libs/common/src/platform/server-notifications/server-notifications.service.ts similarity index 84% rename from libs/common/src/platform/notifications/server-notifications.service.ts rename to libs/common/src/platform/server-notifications/server-notifications.service.ts index 02d261aca35..97431290d7a 100644 --- a/libs/common/src/platform/notifications/server-notifications.service.ts +++ b/libs/common/src/platform/server-notifications/server-notifications.service.ts @@ -13,11 +13,11 @@ 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 DefaultServerNotificationsService.processNotification} + * Please add code reacting to server notifications in {@link DefaultServerNotificationsService.processNotification} */ abstract notifications$: Observable; /** - * Starts automatic listening and processing of notifications, should only be called once per application, + * Starts automatic listening and processing of server notifications, should only be called once per application, * or you will risk notifications being processed multiple times. */ abstract startListening(): Subscription; diff --git a/libs/common/src/platform/sync/core-sync.service.ts b/libs/common/src/platform/sync/core-sync.service.ts index 40419a343da..ebd28e98d95 100644 --- a/libs/common/src/platform/sync/core-sync.service.ts +++ b/libs/common/src/platform/sync/core-sync.service.ts @@ -230,7 +230,7 @@ export abstract class CoreSyncService implements SyncService { }), ), ); - // Process only notifications for currently active user when user is not logged out + // Process only server notifications for currently active user when user is not logged out // TODO: once send service allows data manipulation of non-active users, this should process any received notification if (activeUserId === notification.userId && status !== AuthenticationStatus.LoggedOut) { try { diff --git a/libs/common/src/platform/system-notifications/index.ts b/libs/common/src/platform/system-notifications/index.ts new file mode 100644 index 00000000000..1209f1b42eb --- /dev/null +++ b/libs/common/src/platform/system-notifications/index.ts @@ -0,0 +1 @@ +export { SystemNotificationsService } from "./system-notifications.service"; diff --git a/libs/common/src/platform/notifications/system-notifications.service.ts b/libs/common/src/platform/system-notifications/system-notifications.service.ts similarity index 90% rename from libs/common/src/platform/notifications/system-notifications.service.ts rename to libs/common/src/platform/system-notifications/system-notifications.service.ts index 2ebf086ed0a..54369231967 100644 --- a/libs/common/src/platform/notifications/system-notifications.service.ts +++ b/libs/common/src/platform/system-notifications/system-notifications.service.ts @@ -32,7 +32,7 @@ export type SystemNotificationEvent = { }; /** - * A service responsible for displaying operating system level notifications. + * A service responsible for displaying operating system level server notifications. */ export abstract class SystemNotificationsService { abstract notificationClicked$: Observable; @@ -43,7 +43,7 @@ export abstract class SystemNotificationsService { * @returns If a notification is successfully created it will respond back with an * id that refers to a notification. */ - abstract create(createInfo: SystemNotificationCreateInfo): Promise; + abstract create(createInfo: SystemNotificationCreateInfo): Promise; /** * Clears a notification. @@ -52,7 +52,7 @@ export abstract class SystemNotificationsService { abstract clear(clearInfo: SystemNotificationClearInfo): Promise; /** - * Used to know if a given platform supports notifications. + * Used to know if a given platform supports server notifications. */ abstract isSupported(): boolean; } diff --git a/libs/common/src/platform/notifications/unsupported-system-notifications.service.ts b/libs/common/src/platform/system-notifications/unsupported-system-notifications.service.ts similarity index 97% rename from libs/common/src/platform/notifications/unsupported-system-notifications.service.ts rename to libs/common/src/platform/system-notifications/unsupported-system-notifications.service.ts index bfc9371a92f..b3627b2b07b 100644 --- a/libs/common/src/platform/notifications/unsupported-system-notifications.service.ts +++ b/libs/common/src/platform/system-notifications/unsupported-system-notifications.service.ts @@ -9,7 +9,7 @@ import { export class UnsupportedSystemNotificationsService implements SystemNotificationsService { notificationClicked$ = throwError(() => new Error("Notification clicked is not supported.")); - async create(createInfo: SystemNotificationCreateInfo): Promise { + async create(createInfo: SystemNotificationCreateInfo): Promise { throw new Error("Create OS Notification unsupported."); } diff --git a/libs/common/src/vault/notifications/abstractions/end-user-notification.service.ts b/libs/common/src/vault/notifications/abstractions/end-user-notification.service.ts index bc5dd4d97a4..c1345a3d993 100644 --- a/libs/common/src/vault/notifications/abstractions/end-user-notification.service.ts +++ b/libs/common/src/vault/notifications/abstractions/end-user-notification.service.ts @@ -5,17 +5,17 @@ import { NotificationId, UserId } from "@bitwarden/common/types/guid"; import { NotificationView } from "../models"; /** - * A service for retrieving and managing notifications for end users. + * A service for retrieving and managing server notifications for end users. */ export abstract class EndUserNotificationService { /** - * Observable of all notifications for the given user. + * Observable of all server notifications for the given user. * @param userId */ abstract notifications$(userId: UserId): Observable; /** - * Observable of all unread notifications for the given user. + * Observable of all unread server notifications for the given user. * @param userId */ abstract unreadNotifications$(userId: UserId): Observable; @@ -35,13 +35,13 @@ export abstract class EndUserNotificationService { abstract markAsDeleted(notificationId: NotificationId, userId: UserId): Promise; /** - * Clear all notifications from state for the given user. + * Clear all server notifications from state for the given user. * @param userId */ abstract clearState(userId: UserId): Promise; /** - * Creates a subscription to listen for end user push notifications and notification status updates. + * Creates a subscription to listen for end user push server notifications and notification status updates. */ abstract listenForEndUserNotifications(): Subscription; } diff --git a/libs/common/src/vault/notifications/services/default-end-user-notification.service.spec.ts b/libs/common/src/vault/notifications/services/default-end-user-notification.service.spec.ts index 3a5ba06508e..9eecf5eb496 100644 --- a/libs/common/src/vault/notifications/services/default-end-user-notification.service.spec.ts +++ b/libs/common/src/vault/notifications/services/default-end-user-notification.service.spec.ts @@ -4,7 +4,7 @@ import { firstValueFrom, of } from "rxjs"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; import { StateProvider } from "@bitwarden/common/platform/state"; import { NotificationId, UserId } from "@bitwarden/common/types/guid"; @@ -48,7 +48,7 @@ describe("End User Notification Center Service", () => { }); describe("notifications$", () => { - it("should return notifications from state when not null", async () => { + it("should return server notifications from state when not null", async () => { fakeStateProvider.singleUser.mockFor("user-id" as UserId, NOTIFICATIONS, [ { id: "notification-id" as NotificationId, @@ -62,7 +62,7 @@ describe("End User Notification Center Service", () => { expect(mockLogService.warning).not.toHaveBeenCalled(); }); - it("should return notifications API when state is null", async () => { + it("should return server notifications API when state is null", async () => { mockApiService.send.mockResolvedValue({ data: [ { @@ -86,7 +86,7 @@ describe("End User Notification Center Service", () => { expect(mockLogService.warning).not.toHaveBeenCalled(); }); - it("should log a warning if there are more notifications available", async () => { + it("should log a warning if there are more server notifications available", async () => { mockApiService.send.mockResolvedValue({ data: [ ...new Array(DEFAULT_NOTIFICATION_PAGE_SIZE + 1).fill({ id: "notification-id" }), @@ -120,7 +120,7 @@ describe("End User Notification Center Service", () => { }); describe("unreadNotifications$", () => { - it("should return unread notifications from state when read value is null", async () => { + it("should return unread server notifications from state when read value is null", async () => { fakeStateProvider.singleUser.mockFor("user-id" as UserId, NOTIFICATIONS, [ { id: "notification-id" as NotificationId, @@ -136,7 +136,7 @@ describe("End User Notification Center Service", () => { }); describe("getNotifications", () => { - it("should call getNotifications returning notifications from API", async () => { + it("should call getNotifications returning server notifications from API", async () => { mockApiService.send.mockResolvedValue({ data: [ { @@ -156,7 +156,7 @@ describe("End User Notification Center Service", () => { ); }); - it("should update local state when notifications are updated", async () => { + it("should update local state when server notifications are updated", async () => { mockApiService.send.mockResolvedValue({ data: [ { diff --git a/libs/common/src/vault/notifications/services/default-end-user-notification.service.ts b/libs/common/src/vault/notifications/services/default-end-user-notification.service.ts index 621a5951ed5..688f90b555f 100644 --- a/libs/common/src/vault/notifications/services/default-end-user-notification.service.ts +++ b/libs/common/src/vault/notifications/services/default-end-user-notification.service.ts @@ -6,7 +6,7 @@ import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authenticatio import { NotificationType } from "@bitwarden/common/enums"; import { ListResponse } from "@bitwarden/common/models/response/list.response"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; import { StateProvider } from "@bitwarden/common/platform/state"; import { NotificationId, UserId } from "@bitwarden/common/types/guid"; import { @@ -19,7 +19,7 @@ import { NotificationView, NotificationViewData, NotificationViewResponse } from import { NOTIFICATIONS } from "../state/end-user-notification.state"; /** - * The default number of notifications to fetch from the API. + * The default number of server notifications to fetch from the API. */ export const DEFAULT_NOTIFICATION_PAGE_SIZE = 50; @@ -30,7 +30,7 @@ const getLoggedInUserIds = map, UserId[]>(( ); /** - * A service for retrieving and managing notifications for end users. + * A service for retrieving and managing server notifications for end users. */ export class DefaultEndUserNotificationService implements EndUserNotificationService { constructor( @@ -100,7 +100,7 @@ export class DefaultEndUserNotificationService implements EndUserNotificationSer } /** - * Helper observable to filter notifications by the notification type and user ids + * Helper observable to filter server notifications by the notification type and user ids * Returns EMPTY if no user ids are provided * @param userIds * @private @@ -121,7 +121,7 @@ export class DefaultEndUserNotificationService implements EndUserNotificationSer } /** - * Creates a subscription to listen for end user push notifications and notification status updates. + * Creates a subscription to listen for end user push server notifications and notification status updates. */ listenForEndUserNotifications(): Subscription { return this.authService.authStatuses$ @@ -139,7 +139,7 @@ export class DefaultEndUserNotificationService implements EndUserNotificationSer } /** - * Fetches the notifications from the API and updates the local state + * Fetches the server notifications from the API and updates the local state * @param userId * @private */ @@ -164,7 +164,7 @@ export class DefaultEndUserNotificationService implements EndUserNotificationSer } /** - * Replaces the local state with notifications and returns the updated state + * Replaces the local state with server notifications and returns the updated state * @param userId * @param notifications * @private @@ -178,7 +178,7 @@ export class DefaultEndUserNotificationService implements EndUserNotificationSer /** * Updates the local state adding the new notification or updates an existing one with the same id - * Returns the entire updated notifications state + * Returns the entire updated server notifications state * @param userId * @param notification * @private @@ -203,7 +203,7 @@ export class DefaultEndUserNotificationService implements EndUserNotificationSer } /** - * Returns the local state for notifications + * Returns the local state for server notifications * @param userId * @private */ diff --git a/libs/common/src/vault/tasks/abstractions/task.service.ts b/libs/common/src/vault/tasks/abstractions/task.service.ts index 79cefff0b71..6908476251c 100644 --- a/libs/common/src/vault/tasks/abstractions/task.service.ts +++ b/libs/common/src/vault/tasks/abstractions/task.service.ts @@ -45,7 +45,7 @@ export abstract class TaskService { abstract markAsComplete(taskId: SecurityTaskId, userId: UserId): Promise; /** - * Creates a subscription for pending security task notifications or completed syncs for unlocked users. + * Creates a subscription for pending security task server notifications or completed syncs for unlocked users. */ abstract listenForTaskNotifications(): Subscription; } diff --git a/libs/common/src/vault/tasks/services/default-task.service.spec.ts b/libs/common/src/vault/tasks/services/default-task.service.spec.ts index 2322ab8f423..9d8559cd859 100644 --- a/libs/common/src/vault/tasks/services/default-task.service.spec.ts +++ b/libs/common/src/vault/tasks/services/default-task.service.spec.ts @@ -8,7 +8,7 @@ import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authenticatio import { NotificationType } from "@bitwarden/common/enums"; import { NotificationResponse } from "@bitwarden/common/models/response/notification.response"; import { Message, MessageListener } from "@bitwarden/common/platform/messaging"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; import { SecurityTaskId, UserId } from "@bitwarden/common/types/guid"; import { FakeStateProvider, mockAccountServiceWith } from "../../../../spec"; @@ -304,7 +304,7 @@ describe("Default task service", () => { }); describe("listenForTaskNotifications()", () => { - it("should not subscribe to notifications when there are no unlocked users", () => { + it("should not subscribe to server notifications when there are no unlocked users", () => { mockAuthStatuses$.next({ [userId]: AuthenticationStatus.Locked, }); @@ -320,7 +320,7 @@ describe("Default task service", () => { subscription.unsubscribe(); }); - it("should not subscribe to notifications when no users have tasks enabled", () => { + it("should not subscribe to server notifications when no users have tasks enabled", () => { mockAuthStatuses$.next({ [userId]: AuthenticationStatus.Unlocked, }); @@ -336,7 +336,7 @@ describe("Default task service", () => { subscription.unsubscribe(); }); - it("should subscribe to notifications when there are unlocked users with tasks enabled", () => { + it("should subscribe to server notifications when there are unlocked users with tasks enabled", () => { mockAuthStatuses$.next({ [userId]: AuthenticationStatus.Unlocked, }); @@ -378,7 +378,7 @@ describe("Default task service", () => { subscription.unsubscribe(); }); - it("should ignore notifications for other users", async () => { + it("should ignore server notifications for other users", async () => { mockAuthStatuses$.next({ [userId]: AuthenticationStatus.Unlocked, }); @@ -403,7 +403,7 @@ describe("Default task service", () => { subscription.unsubscribe(); }); - it("should ignore other notifications types", async () => { + it("should ignore other server notifications types", async () => { mockAuthStatuses$.next({ [userId]: AuthenticationStatus.Unlocked, }); diff --git a/libs/common/src/vault/tasks/services/default-task.service.ts b/libs/common/src/vault/tasks/services/default-task.service.ts index 487ab16b2a2..6238076ccf5 100644 --- a/libs/common/src/vault/tasks/services/default-task.service.ts +++ b/libs/common/src/vault/tasks/services/default-task.service.ts @@ -17,7 +17,7 @@ import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authenticatio import { NotificationType } from "@bitwarden/common/enums"; import { ListResponse } from "@bitwarden/common/models/response/list.response"; import { MessageListener } from "@bitwarden/common/platform/messaging"; -import { ServerNotificationsService } from "@bitwarden/common/platform/notifications"; +import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications"; import { StateProvider } from "@bitwarden/common/platform/state"; import { SecurityTaskId, UserId } from "@bitwarden/common/types/guid"; import { @@ -171,7 +171,7 @@ export class DefaultTaskService implements TaskService { } /** - * Creates a subscription for pending security task notifications or completed syncs for unlocked users. + * Creates a subscription for pending security task server notifications or completed syncs for unlocked users. */ listenForTaskNotifications(): Subscription { return this.authService.authStatuses$ diff --git a/libs/components/src/toast/toast.service.ts b/libs/components/src/toast/toast.service.ts index f55fb3ada83..14b737040f9 100644 --- a/libs/components/src/toast/toast.service.ts +++ b/libs/components/src/toast/toast.service.ts @@ -17,7 +17,7 @@ export type ToastOptions = { }; /** - * Presents toast notifications + * Presents toast server notifications **/ @Injectable({ providedIn: "root" }) export class ToastService { diff --git a/libs/components/src/toast/toastr.component.ts b/libs/components/src/toast/toastr.component.ts index 3b7665f1d64..b8f8af6266c 100644 --- a/libs/components/src/toast/toastr.component.ts +++ b/libs/components/src/toast/toastr.component.ts @@ -5,7 +5,7 @@ import { Toast as BaseToastrComponent, ToastPackage, ToastrService } from "ngx-t import { ToastComponent } from "./toast.component"; /** - * Toasts are ephemeral notifications. They most often communicate the result of a user action. Due to their ephemeral nature, long messages and critical alerts should not utilize toasts. + * Toasts are ephemeral server notifications. They most often communicate the result of a user action. Due to their ephemeral nature, long messages and critical alerts should not utilize toasts. */ @Component({ template: ` diff --git a/libs/key-management-ui/src/lock/components/lock.component.ts b/libs/key-management-ui/src/lock/components/lock.component.ts index 92c8004e4c9..c7aa8969660 100644 --- a/libs/key-management-ui/src/lock/components/lock.component.ts +++ b/libs/key-management-ui/src/lock/components/lock.component.ts @@ -625,7 +625,7 @@ export class LockComponent implements OnInit, OnDestroy { } } - // Vault can be de-synced since notifications get ignored while locked. Need to check whether sync is required using the sync service. + // Vault can be de-synced since server notifications get ignored while locked. Need to check whether sync is required using the sync service. const startSync = new Date().getTime(); // TODO: This should probably not be blocking await this.syncService.fullSync(false);