From: Andrew Gundersen Date: Mon, 16 May 2022 11:35:09 +0000 (-0500) Subject: init changes for audo update X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=refs%2Fheads%2Fupdate;p=mime-chat init changes for audo update --- diff --git a/src/main.js b/src/main.js index 63e4d13..38967ea 100644 --- a/src/main.js +++ b/src/main.js @@ -17,6 +17,9 @@ app.on("ready", () => createWin(); initAccount(); + + /* Check for an update every minunte */ + setInterval(autoUpdater.checkForUpdates, 60000); }); app.on("will-quit", terminateAudio); @@ -26,3 +29,7 @@ app.on("activate", createWin); // Prevents app from quitting on window close event app.on('window-all-closed', (e) => e.preventDefault()); + +// Update when a new update is downloaded. +autoUpdater.on("update-downloaded", update); + diff --git a/src/update.js b/src/update.js new file mode 100644 index 0000000..6800b9e --- /dev/null +++ b/src/update.js @@ -0,0 +1,14 @@ +const { app, autoUpdater } = require("electron"); + +autoUpdater.setFeedURL({ "https://crimata.com" }); + +async function update() +{ + await dialog.showMessageBox({ + buttons: ["Ok"], + title: "App Update", + detail: "A new version of the app is available" + }); + + autoUpdater.quitAndInstall(); +} \ No newline at end of file