1
0
mirror of https://github.com/bitwarden/browser synced 2026-03-01 19:11:22 +00:00

fix(browser-approval): [PM-23620] Auth Request Answering Service - Moved subscribing to main.background.ts.

This commit is contained in:
Patrick Pimentel
2025-08-07 17:18:30 -04:00
parent dd0e053d7d
commit 7484433604
3 changed files with 15 additions and 15 deletions

View File

@@ -4,8 +4,5 @@ import { UserId } from "@bitwarden/user-core";
export abstract class AuthRequestAnsweringServiceAbstraction {
abstract receivedPendingAuthRequest(userId: UserId, notificationId: string): Promise<void>;
abstract handleAuthRequestNotificationClicked(
event: SystemNotificationEvent,
authRequestId: string,
): Promise<void>;
abstract handleAuthRequestNotificationClicked(event: SystemNotificationEvent): Promise<void>;
}

View File

@@ -1,4 +1,4 @@
import { filter, firstValueFrom, map, switchMap } from "rxjs";
import { firstValueFrom } from "rxjs";
import { AccountService } from "@bitwarden/common/auth/abstractions/account.service";
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
@@ -25,15 +25,8 @@ export class AuthRequestAnsweringService implements AuthRequestAnsweringServiceA
private readonly masterPasswordService: MasterPasswordServiceAbstraction,
private readonly platformUtilsService: PlatformUtilsService,
private readonly systemNotificationsService: SystemNotificationsService,
) {
this.systemNotificationsService.notificationClicked$
.pipe(
filter((n) => n.id.startsWith("authRequest_")),
map((n) => ({ event: n, authRequestId: n.id.split("_")[1] })),
switchMap(({ event }) => this.handleAuthRequestNotificationClicked(event)),
)
.subscribe();
}
) {}
async handleAuthRequestNotificationClicked(event: SystemNotificationEvent): Promise<void> {
if (event.buttonIdentifier === ButtonLocation.NotificationButton) {
// await this.systemNotificationsService.clear({