1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-14 07:13:32 +00:00

Feat PM-19877 System Notification Processing (#15611)

* feat(notification-processing): [PM-19877] System Notification Implementation - Minor changes to popup logic and removed content in login component.

* docs(notification-processing): [PM-19877] System Notification Implementation - Added more docs.

* docs(notification-processing): [PM-19877] System Notification Implementation - Added markdown document.

* fix(notification-processing): [PM-19877] System Notification Implementation - Updated condition for if notification is supported.

* fix(notification-processing): [PM-19877] System Notification Implementation - Updated services module with correct platform utils service.
This commit is contained in:
Patrick-Pimentel-Bitwarden
2025-08-20 12:42:16 -04:00
committed by GitHub
parent bcd73a9c00
commit 719a43d050
55 changed files with 420 additions and 132 deletions

View File

@@ -22,7 +22,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 { NotificationsService } 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";
@@ -76,7 +76,7 @@ export class AppComponent implements OnDestroy, OnInit {
private keyService: KeyService,
private collectionService: CollectionService,
private searchService: SearchService,
private notificationsService: NotificationsService,
private serverNotificationsService: ServerNotificationsService,
private stateService: StateService,
private eventUploadService: EventUploadService,
protected policyListService: PolicyListService,
@@ -88,14 +88,14 @@ export class AppComponent implements OnDestroy, OnInit {
private accountService: AccountService,
private processReloadService: ProcessReloadServiceAbstraction,
private deviceTrustToastService: DeviceTrustToastService,
private readonly destoryRef: DestroyRef,
private readonly destroy: DestroyRef,
private readonly documentLangSetter: DocumentLangSetter,
private readonly tokenService: TokenService,
) {
this.deviceTrustToastService.setupListeners$.pipe(takeUntilDestroyed()).subscribe();
const langSubscription = this.documentLangSetter.start();
this.destoryRef.onDestroy(() => langSubscription.unsubscribe());
this.destroy.onDestroy(() => langSubscription.unsubscribe());
}
ngOnInit() {
@@ -347,9 +347,9 @@ export class AppComponent implements OnDestroy, OnInit {
private idleStateChanged() {
if (this.isIdle) {
this.notificationsService.disconnectFromInactivity();
this.serverNotificationsService.disconnectFromInactivity();
} else {
this.notificationsService.reconnectFromActivity();
this.serverNotificationsService.reconnectFromActivity();
}
}
}

View File

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

View File

@@ -12,7 +12,7 @@ import { DefaultVaultTimeoutService } from "@bitwarden/common/key-management/vau
import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/platform/abstractions/i18n.service";
import { SdkLoadService } from "@bitwarden/common/platform/abstractions/sdk/sdk-load.service";
import { IpcService } from "@bitwarden/common/platform/ipc";
import { NotificationsService } from "@bitwarden/common/platform/notifications";
import { ServerNotificationsService } from "@bitwarden/common/platform/server-notifications";
import { ContainerService } from "@bitwarden/common/platform/services/container.service";
import { MigrationRunner } from "@bitwarden/common/platform/services/migration-runner";
import { UserAutoUnlockKeyService } from "@bitwarden/common/platform/services/user-auto-unlock-key.service";
@@ -26,7 +26,7 @@ import { VersionService } from "../platform/version.service";
export class InitService {
constructor(
@Inject(WINDOW) private win: Window,
private notificationsService: NotificationsService,
private serverNotificationsService: ServerNotificationsService,
private vaultTimeoutService: DefaultVaultTimeoutService,
private i18nService: I18nServiceAbstraction,
private eventUploadService: EventUploadServiceAbstraction,
@@ -56,7 +56,7 @@ export class InitService {
await this.userAutoUnlockKeyService.setUserKeyInMemoryIfAutoUserKeySet(activeAccount.id);
}
this.notificationsService.startListening();
this.serverNotificationsService.startListening();
await this.vaultTimeoutService.init(true);
await this.i18nService.init();
(this.eventUploadService as EventUploadService).init(true);

View File

@@ -98,7 +98,7 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
return false;
}
isViewOpen(): Promise<boolean> {
isPopupOpen(): Promise<boolean> {
return Promise.resolve(false);
}

View File

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

View File

@@ -565,7 +565,7 @@ export class VaultComponent<C extends CipherViewLike> 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();
},
);