]> Repos - mime-chat/commitdiff
init changes for audo update update
authorAndrew Gundersen <adgundersen@gmail.com>
Mon, 16 May 2022 11:35:09 +0000 (06:35 -0500)
committerAndrew Gundersen <adgundersen@gmail.com>
Mon, 16 May 2022 11:35:09 +0000 (06:35 -0500)
src/main.js
src/update.js [new file with mode: 0644]

index 63e4d134f33a7edf50626650fd9934253ff91606..38967ea49219f5a17ed464197ff178661d931aaf 100644 (file)
@@ -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 (file)
index 0000000..6800b9e
--- /dev/null
@@ -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