Skip to content

Commit 37e25d1

Browse files
Quit and Install Updates
- When done downloading updates it will quit the application and you'll see an install bar for the new update. Still more work to be done. But the auto updater works so I'm happy!
1 parent bcd9af7 commit 37e25d1

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "zerocraft-sync",
33
"productName": "Zerocraft Sync",
4-
"version": "1.0.1",
4+
"version": "1.0.0",
55
"description": "My Electron application description",
66
"main": "src/index.js",
77
"scripts": {

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ <h2>Host Settings</h2>
7070

7171
<div class="base-grid">
7272
<div class="frame-grid">
73-
<h4 style="color: white; padding: 10px 0px; margin: auto 10px;">Zerocraft Sync 1.0.1</h4>
73+
<h4 style="color: white; padding: 10px 0px; margin: auto 10px;">Zerocraft Sync</h4>
7474
<button id="minimizeButton" class="fa fa-window-minimize"></button>
7575
<button id="maximizeButton" class="fa fa-window-maximize"></button>
7676
<button id="exitButton" class="fa-solid fa-power-off"></button>

src/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,19 @@ autoUpdater.on('update-not-available', () => {
9090

9191
autoUpdater.on('update-downloaded', () => {
9292
mainWindow.webContents.send('auto-updater-callback', 'Update Downloaded');
93-
autoUpdater.quitAndInstall();
93+
ensureSafeQuitAndInstall()
9494
});
9595

96+
function ensureSafeQuitAndInstall() {
97+
setImmediate(() => {
98+
app.removeAllListeners("window-all-closed")
99+
if (mainWindow != null) {
100+
mainWindow.close()
101+
}
102+
autoUpdater.quitAndInstall(false)
103+
})
104+
}
105+
96106
autoUpdater.on('error', (error) => {
97107
mainWindow.webContents.send('auto-updater-callback', `Update check error: ${error.message}`);
98108
});

0 commit comments

Comments
 (0)