From 25ccb6b15574c6999acede23b62304c40b2cd6f4 Mon Sep 17 00:00:00 2001 From: dj2ls Date: Wed, 23 Feb 2022 10:14:46 +0100 Subject: [PATCH] fix of minor app crash when updating this hopefully fixes an OS window manager freeze on Ubuntu.. --- gui/main.js | 28 +++++++++++++++++++++------- gui/preload-main.js | 4 ++++ gui/src/index.html | 12 ++++++++---- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/gui/main.js b/gui/main.js index 361bf776..c8a92923 100644 --- a/gui/main.js +++ b/gui/main.js @@ -156,9 +156,10 @@ function createWindow() { win.once('ready-to-show', () => { - autoUpdater.autoInstallOnAppQuit = true; + autoUpdater.autoInstallOnAppQuit = false; autoUpdater.autoDownload = true; autoUpdater.checkForUpdatesAndNotify(); + //autoUpdater.quitAndInstall(); }); @@ -347,33 +348,46 @@ ipcMain.on('request-update-rx-msg-buffer', (event, arg) => { // LISTENER FOR UPDATER EVENTS -autoUpdater.on('update-available', () => { +autoUpdater.on('update-available', (info) => { console.log('update available'); + console.log(info) let arg = { - status: "update-available" + status: "update-available", + info: info }; win.webContents.send('action-updater', arg); }); -autoUpdater.on('update-not-available', () => { +autoUpdater.on('update-not-available', (info) => { console.log('update-not-available'); + console.log(info) let arg = { - status: "update-not-available" + status: "update-not-available", + info: info }; win.webContents.send('action-updater', arg); }); -autoUpdater.on('update-downloaded', () => { +autoUpdater.on('update-downloaded', (info) => { + console.log('update downloaded'); let arg = { - status: "update-downloaded" + status: "update-downloaded", + info: info }; win.webContents.send('action-updater', arg); + // we need to call this at this point. + // if an update is available and we are force closing the app + // the entire screen crashes... + autoUpdater.quitAndInstall(); + + }); autoUpdater.on('checking-for-update', () => { + let arg = { status: "checking-for-update", version: app.getVersion() diff --git a/gui/preload-main.js b/gui/preload-main.js index 3ed31ab6..2c5f02a3 100644 --- a/gui/preload-main.js +++ b/gui/preload-main.js @@ -1640,6 +1640,10 @@ ipcRenderer.on('action-updater', (event, arg) => { console.log(arg.status) if (arg.status == "download-progress"){ + + bootstrap.Toast.getOrCreateInstance(document.getElementById('toastUpdateAvailable')).hide(); // close our update available notification + + var progressinfo = '(' + Math.round(arg.progress.transferred/1024) + 'kB /' + Math.round(arg.progress.total/1024) + 'kB)'; document.getElementById("toastUpdateProgressInfo").innerHTML = progressinfo; document.getElementById("toastUpdateProgressSpeed").innerHTML = Math.round(arg.progress.bytesPerSecond/1024) + "kByte/s"; diff --git a/gui/src/index.html b/gui/src/index.html index 7f7e52fe..65a90909 100644 --- a/gui/src/index.html +++ b/gui/src/index.html @@ -111,14 +111,18 @@ -