mirror of
https://github.com/bitwarden/browser
synced 2026-02-11 05:53:42 +00:00
* add cdk dialog deps to CL dialog barrel file * find and replace cdk dialog import * run prettier
54 lines
1.5 KiB
TypeScript
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,
|
|
});
|
|
}
|
|
}
|