From b93e5329d4d6ad60765983aafce7eced992e2292 Mon Sep 17 00:00:00 2001 From: Andrew Gundersen Date: Mon, 16 May 2022 06:35:09 -0500 Subject: [PATCH] init changes for audo update --- src/main.js | 7 +++++++ src/update.js | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 src/update.js 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 -- 2.43.0