mirror of
https://github.com/bitwarden/browser
synced 2026-02-05 19:23:19 +00:00
fix(browser-approval): [PM-23620] Auth Request Answering Service - Moved subscribing to main.background.ts.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
// @ts-strict-ignore
|
||||
import "core-js/proposals/explicit-resource-management";
|
||||
|
||||
import { filter, firstValueFrom, map, merge, Subject, timeout } from "rxjs";
|
||||
import { filter, firstValueFrom, map, merge, Subject, switchMap, timeout } from "rxjs";
|
||||
|
||||
import { CollectionService, DefaultCollectionService } from "@bitwarden/admin-console/common";
|
||||
import {
|
||||
@@ -1148,6 +1148,16 @@ export default class MainBackground {
|
||||
this.systemNotificationService,
|
||||
);
|
||||
|
||||
this.systemNotificationService.notificationClicked$
|
||||
.pipe(
|
||||
filter((n) => n.id.startsWith("authRequest_")),
|
||||
map((n) => ({ event: n, authRequestId: n.id.split("_")[1] })),
|
||||
switchMap(({ event }) =>
|
||||
this.authRequestAnsweringService.handleAuthRequestNotificationClicked(event),
|
||||
),
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.serverNotificationsService = new DefaultServerNotificationsService(
|
||||
this.logService,
|
||||
this.syncService,
|
||||
|
||||
@@ -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>;
|
||||
}
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user