From 43a63a1ac7b6b696c82388ec60a56202341b360e Mon Sep 17 00:00:00 2001 From: jacobHancock0402 Date: Thu, 20 Apr 2023 10:49:30 +0100 Subject: [PATCH] Revert "Added message asking if you want to save pending changes before exiting" This reverts commit 71a3c494ae0be3096e21a1dbc25e80c20101e6b7. --- apps/desktop/src/main/window.main.ts | 5 +--- .../src/vault/app/vault/vault.component.ts | 30 ------------------- 2 files changed, 1 insertion(+), 34 deletions(-) diff --git a/apps/desktop/src/main/window.main.ts b/apps/desktop/src/main/window.main.ts index fd80ad64b8..e4489f7020 100644 --- a/apps/desktop/src/main/window.main.ts +++ b/apps/desktop/src/main/window.main.ts @@ -1,7 +1,7 @@ import * as path from "path"; import * as url from "url"; -import { app, BrowserWindow, screen, ipcMain } from "electron"; +import { app, BrowserWindow, screen } from "electron"; import { LogService } from "@bitwarden/common/abstractions/log.service"; import { StateService } from "@bitwarden/common/abstractions/state.service"; @@ -98,9 +98,6 @@ export class WindowMain { // throw e; reject(e); } - ipcMain.on("request-app-quit", () => { - app.quit(); - }); }); } diff --git a/apps/desktop/src/vault/app/vault/vault.component.ts b/apps/desktop/src/vault/app/vault/vault.component.ts index 16f4d803ed..858c37971d 100644 --- a/apps/desktop/src/vault/app/vault/vault.component.ts +++ b/apps/desktop/src/vault/app/vault/vault.component.ts @@ -1,7 +1,6 @@ import { ChangeDetectorRef, Component, - HostListener, NgZone, OnDestroy, OnInit, @@ -9,7 +8,6 @@ import { ViewContainerRef, } from "@angular/core"; import { ActivatedRoute, Router } from "@angular/router"; -import { ipcRenderer } from "electron"; import { first } from "rxjs/operators"; import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref"; @@ -85,7 +83,6 @@ export class VaultComponent implements OnInit, OnDestroy { activeFilter: VaultFilter = new VaultFilter(); private modal: ModalRef = null; - private triedQuit = false; constructor( private route: ActivatedRoute, @@ -633,7 +630,6 @@ export class VaultComponent implements OnInit, OnDestroy { this.addEditComponent.cipher.login.username = value; } } - this.addEditComponent.submit(); }); // eslint-disable-next-line rxjs-angular/prefer-takeuntil @@ -776,32 +772,6 @@ export class VaultComponent implements OnInit, OnDestroy { return true; } - private async saveChangesOrCancel() { - const result = await ipcRenderer.invoke("showMessageBox", { - type: "warning", - title: "Unsaved Changes", - message: "Do you want to save your pending changes?", - buttons: ["Yes", "No", "Cancel"], - }); - return result; - } - - @HostListener("window:beforeunload", ["$event"]) - private async onBeforeUnload(event: BeforeUnloadEvent) { - if (!this.triedQuit && this.dirtyInput() && this.action == "edit") { - event.returnValue = false; - let response = await this.saveChangesOrCancel(); - response = response.response; - if (response === 0 || response === 1) { - if (response === 0) { - await this.addEditComponent.submit(); - } - this.triedQuit = true; - ipcRenderer.send("request-app-quit"); - } - } - } - private async passwordReprompt(cipher: CipherView) { return ( cipher.reprompt === CipherRepromptType.None ||