[PM-3682] Remove ipcRenderer from login-approval (#6838)

This commit is contained in:
Daniel García 2023-11-10 16:56:14 +01:00 committed by GitHub
parent 49103cdda4
commit f36a41b5ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 7 deletions

View File

@ -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")
);
}
}
}

View File

@ -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<void> =>
ipcRenderer.invoke("loginRequest", {
alertTitle,
alertBody,
buttonText,
}),
};