Revert "Always revalidate desktop updates before install"

This reverts commit 7d80fdfd12.
This commit is contained in:
Mohamed Boudra
2026-07-16 21:20:57 +02:00
parent d5baf1a7e6
commit 623c05aa4d
8 changed files with 285 additions and 340 deletions
+11 -24
View File
@@ -46,20 +46,18 @@ export function createBeforeQuitHandler({
app,
closeTransportSessions,
stopDesktopManagedDaemonIfNeeded,
installAppUpdateOnQuit,
onStopError,
onUpdateError,
}: {
app: BeforeQuitApp;
closeTransportSessions: () => void;
stopDesktopManagedDaemonIfNeeded: () => Promise<boolean>;
installAppUpdateOnQuit: () => Promise<boolean>;
onStopError: (error: unknown) => void;
onUpdateError: (error: unknown) => void;
}): (event: BeforeQuitEvent) => void {
// The first quit waits for daemon shutdown and update revalidation. A validated
// update re-fires app.quit(); otherwise app.exit(0) bypasses Electron's macOS
// window-all-closed handler, which would veto that second quit.
// We always preventDefault on first quit so we can run the async stop
// decision, then call app.exit(0) — which bypasses Electron's
// close → window-all-closed → will-quit chain. The window-all-closed
// listener is a darwin no-op (macOS convention) and would otherwise
// veto a re-fired app.quit().
let quitting = false;
return (event) => {
@@ -68,23 +66,12 @@ export function createBeforeQuitHandler({
quitting = true;
event.preventDefault();
void (async () => {
try {
await stopDesktopManagedDaemonIfNeeded();
} catch (error) {
void stopDesktopManagedDaemonIfNeeded()
.catch((error) => {
onStopError(error);
}
try {
const installingUpdate = await installAppUpdateOnQuit();
if (installingUpdate) {
return;
}
} catch (error) {
onUpdateError(error);
}
app.exit(0);
})();
})
.finally(() => {
app.exit(0);
});
};
}