1
0
mirror of https://github.com/upscayl/upscayl.git synced 2024-11-24 15:40:21 +01:00
upscayl/electron/commands/auto-update.ts

26 lines
778 B
TypeScript
Raw Normal View History

2023-09-11 04:28:33 +02:00
import { MessageBoxOptions, dialog } from "electron";
import { autoUpdater } from "electron-updater";
import logit from "../utils/logit";
const autoUpdate = (event) => {
autoUpdater.autoInstallOnAppQuit = false;
const dialogOpts: MessageBoxOptions = {
type: "info",
buttons: ["Install update", "No Thanks"],
title: "New Upscayl Update",
message: event.releaseName as string,
detail:
"A new version has been downloaded. Restart the application to apply the updates.",
};
logit("✅ Update Downloaded");
dialog.showMessageBox(dialogOpts).then((returnValue) => {
if (returnValue.response === 0) {
autoUpdater.quitAndInstall();
} else {
logit("🚫 Update Installation Cancelled");
}
});
};
export default autoUpdate;