1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-11 05:53:42 +00:00
Files
browser/apps/browser/src/popup/components/desktop-sync-verification-dialog.component.ts
Will Martin 76cb3fd38d [CL-623] export CDK dialog deps from libs/components (#14074)
* add cdk dialog deps to CL dialog barrel file

* find and replace cdk dialog import

* run prettier
2025-04-02 15:08:38 -04:00

54 lines
1.5 KiB
TypeScript

import { Component, Inject, OnDestroy, OnInit } from "@angular/core";
import { filter, Subject, takeUntil } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { MessageListener } from "@bitwarden/common/platform/messaging";
import {
DIALOG_DATA,
DialogRef,
ButtonModule,
DialogModule,
DialogService,
} from "@bitwarden/components";
export type DesktopSyncVerificationDialogParams = {
fingerprint: string[];
};
@Component({
templateUrl: "desktop-sync-verification-dialog.component.html",
standalone: true,
imports: [JslibModule, ButtonModule, DialogModule],
})
export class DesktopSyncVerificationDialogComponent implements OnDestroy, OnInit {
private destroy$ = new Subject<void>();
constructor(
@Inject(DIALOG_DATA) protected params: DesktopSyncVerificationDialogParams,
private dialogRef: DialogRef<DesktopSyncVerificationDialogComponent>,
private messageListener: MessageListener,
) {}
ngOnDestroy(): void {
this.destroy$.next();
this.destroy$.complete();
}
ngOnInit(): void {
this.messageListener.allMessages$
.pipe(
filter((m) => m.command === "hideNativeMessagingFingerprintDialog"),
takeUntil(this.destroy$),
)
.subscribe(() => {
this.dialogRef.close();
});
}
static open(dialogService: DialogService, data: DesktopSyncVerificationDialogParams) {
return dialogService.open(DesktopSyncVerificationDialogComponent, {
data,
});
}
}