From f36a41b5cab96603c65cbdd34d6c8b7e14aad57d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa?= Date: Fri, 10 Nov 2023 16:56:14 +0100 Subject: [PATCH] [PM-3682] Remove ipcRenderer from login-approval (#6838) --- .../src/auth/login/login-approval.component.ts | 13 ++++++------- apps/desktop/src/auth/preload.ts | 7 +++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/apps/desktop/src/auth/login/login-approval.component.ts b/apps/desktop/src/auth/login/login-approval.component.ts index 807059107fd..4fee03eb8a6 100644 --- a/apps/desktop/src/auth/login/login-approval.component.ts +++ b/apps/desktop/src/auth/login/login-approval.component.ts @@ -1,5 +1,4 @@ import { Component, OnInit, OnDestroy } from "@angular/core"; -import { ipcRenderer } from "electron"; import { Subject } from "rxjs"; import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref"; @@ -76,13 +75,13 @@ export class LoginApprovalComponent implements OnInit, OnDestroy { this.updateTimeText(); }, RequestTimeUpdate); - const isVisible = await ipcRenderer.invoke("windowVisible"); + const isVisible = await ipc.platform.isWindowVisible(); if (!isVisible) { - await ipcRenderer.invoke("loginRequest", { - alertTitle: this.i18nService.t("logInRequested"), - alertBody: this.i18nService.t("confirmLoginAtemptForMail", this.email), - buttonText: this.i18nService.t("close"), - }); + await ipc.auth.loginRequest( + this.i18nService.t("logInRequested"), + this.i18nService.t("confirmLoginAtemptForMail", this.email), + this.i18nService.t("close") + ); } } } diff --git a/apps/desktop/src/auth/preload.ts b/apps/desktop/src/auth/preload.ts index f4180406af0..91321d62d82 100644 --- a/apps/desktop/src/auth/preload.ts +++ b/apps/desktop/src/auth/preload.ts @@ -3,4 +3,11 @@ import { ipcRenderer } from "electron"; export default { getHcaptchaAccessibilityCookie: (): Promise<[string]> => ipcRenderer.invoke("getCookie", { url: "https://www.hcaptcha.com/", name: "hc_accessibility" }), + + loginRequest: (alertTitle: string, alertBody: string, buttonText: string): Promise => + ipcRenderer.invoke("loginRequest", { + alertTitle, + alertBody, + buttonText, + }), };