From 2a338319ea69b744491f7a7ff8503405bc064ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bispo?= Date: Fri, 5 Jan 2024 19:46:57 +0000 Subject: [PATCH] [PM-2417] Update LoginApprovalComponent on Desktop (#6751) * [PM-2417] convert modal to dialog service * code format * [PM-2417] Fix title * [PM-2417] Remove unnecessary class * Updated to use a local reference for the dialog. * Changes to clarify the method naming * More cleanup with Will. * Removed unused style --------- Co-authored-by: Todd Martin Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com> Co-authored-by: Todd Martin <106564991+trmartin4@users.noreply.github.com> --- apps/desktop/src/app/app.component.ts | 19 ++--- apps/desktop/src/app/app.module.ts | 2 - .../auth/login/login-approval.component.html | 83 +++++++++---------- .../auth/login/login-approval.component.ts | 69 +++++++++------ 4 files changed, 89 insertions(+), 84 deletions(-) diff --git a/apps/desktop/src/app/app.component.ts b/apps/desktop/src/app/app.component.ts index ad87230d39f..898d4bb1278 100644 --- a/apps/desktop/src/app/app.component.ts +++ b/apps/desktop/src/app/app.component.ts @@ -399,7 +399,11 @@ export class AppComponent implements OnInit, OnDestroy { break; case "openLoginApproval": if (message.notificationId != null) { - await this.openLoginApproval(message.notificationId); + this.dialogService.closeAll(); + const dialogRef = LoginApprovalComponent.open(this.dialogService, { + notificationId: message.notificationId, + }); + await firstValueFrom(dialogRef.closed); } break; case "redrawMenu": @@ -473,19 +477,6 @@ export class AppComponent implements OnInit, OnDestroy { }); } - async openLoginApproval(notificationId: string) { - this.modalService.closeAll(); - - this.modal = await this.modalService.open(LoginApprovalComponent, { - data: { notificationId: notificationId }, - }); - - // eslint-disable-next-line rxjs-angular/prefer-takeuntil - this.modal.onClosed.subscribe(() => { - this.modal = null; - }); - } - private async updateAppMenu() { let updateRequest: MenuUpdateRequest; const stateAccounts = await firstValueFrom(this.stateService.accounts$); diff --git a/apps/desktop/src/app/app.module.ts b/apps/desktop/src/app/app.module.ts index bb25500eb4c..6317b6aaaf4 100644 --- a/apps/desktop/src/app/app.module.ts +++ b/apps/desktop/src/app/app.module.ts @@ -14,7 +14,6 @@ import { DeleteAccountComponent } from "../auth/delete-account.component"; import { EnvironmentComponent } from "../auth/environment.component"; import { HintComponent } from "../auth/hint.component"; import { LockComponent } from "../auth/lock.component"; -import { LoginApprovalComponent } from "../auth/login/login-approval.component"; import { LoginModule } from "../auth/login/login.module"; import { RegisterComponent } from "../auth/register.component"; import { RemovePasswordComponent } from "../auth/remove-password.component"; @@ -101,7 +100,6 @@ import { SendComponent } from "./tools/send/send.component"; VaultTimeoutInputComponent, ViewComponent, ViewCustomFieldsComponent, - LoginApprovalComponent, ], bootstrap: [AppComponent], }) diff --git a/apps/desktop/src/auth/login/login-approval.component.html b/apps/desktop/src/auth/login/login-approval.component.html index 8a07c37f80b..cc2c0536c9e 100644 --- a/apps/desktop/src/auth/login/login-approval.component.html +++ b/apps/desktop/src/auth/login/login-approval.component.html @@ -1,43 +1,42 @@ -