mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
fix of minor app crash when updating
this hopefully fixes an OS window manager freeze on Ubuntu..
This commit is contained in:
parent
31c1bcac36
commit
25ccb6b155
3 changed files with 33 additions and 11 deletions
28
gui/main.js
28
gui/main.js
|
@ -156,9 +156,10 @@ function createWindow() {
|
||||||
|
|
||||||
win.once('ready-to-show', () => {
|
win.once('ready-to-show', () => {
|
||||||
|
|
||||||
autoUpdater.autoInstallOnAppQuit = true;
|
autoUpdater.autoInstallOnAppQuit = false;
|
||||||
autoUpdater.autoDownload = true;
|
autoUpdater.autoDownload = true;
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
|
//autoUpdater.quitAndInstall();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -347,33 +348,46 @@ ipcMain.on('request-update-rx-msg-buffer', (event, arg) => {
|
||||||
|
|
||||||
|
|
||||||
// LISTENER FOR UPDATER EVENTS
|
// LISTENER FOR UPDATER EVENTS
|
||||||
autoUpdater.on('update-available', () => {
|
autoUpdater.on('update-available', (info) => {
|
||||||
console.log('update available');
|
console.log('update available');
|
||||||
|
console.log(info)
|
||||||
let arg = {
|
let arg = {
|
||||||
status: "update-available"
|
status: "update-available",
|
||||||
|
info: info
|
||||||
};
|
};
|
||||||
win.webContents.send('action-updater', arg);
|
win.webContents.send('action-updater', arg);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
autoUpdater.on('update-not-available', () => {
|
autoUpdater.on('update-not-available', (info) => {
|
||||||
console.log('update-not-available');
|
console.log('update-not-available');
|
||||||
|
console.log(info)
|
||||||
let arg = {
|
let arg = {
|
||||||
status: "update-not-available"
|
status: "update-not-available",
|
||||||
|
info: info
|
||||||
};
|
};
|
||||||
win.webContents.send('action-updater', arg);
|
win.webContents.send('action-updater', arg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
autoUpdater.on('update-downloaded', () => {
|
autoUpdater.on('update-downloaded', (info) => {
|
||||||
|
|
||||||
console.log('update downloaded');
|
console.log('update downloaded');
|
||||||
let arg = {
|
let arg = {
|
||||||
status: "update-downloaded"
|
status: "update-downloaded",
|
||||||
|
info: info
|
||||||
};
|
};
|
||||||
win.webContents.send('action-updater', arg);
|
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', () => {
|
autoUpdater.on('checking-for-update', () => {
|
||||||
|
|
||||||
let arg = {
|
let arg = {
|
||||||
status: "checking-for-update",
|
status: "checking-for-update",
|
||||||
version: app.getVersion()
|
version: app.getVersion()
|
||||||
|
|
|
@ -1640,6 +1640,10 @@ ipcRenderer.on('action-updater', (event, arg) => {
|
||||||
console.log(arg.status)
|
console.log(arg.status)
|
||||||
|
|
||||||
if (arg.status == "download-progress"){
|
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)';
|
var progressinfo = '(' + Math.round(arg.progress.transferred/1024) + 'kB /' + Math.round(arg.progress.total/1024) + 'kB)';
|
||||||
document.getElementById("toastUpdateProgressInfo").innerHTML = progressinfo;
|
document.getElementById("toastUpdateProgressInfo").innerHTML = progressinfo;
|
||||||
document.getElementById("toastUpdateProgressSpeed").innerHTML = Math.round(arg.progress.bytesPerSecond/1024) + "kByte/s";
|
document.getElementById("toastUpdateProgressSpeed").innerHTML = Math.round(arg.progress.bytesPerSecond/1024) + "kByte/s";
|
||||||
|
|
|
@ -111,14 +111,18 @@
|
||||||
<div class="toast bg-white" role="alert" data-bs-autohide="false" id="toastUpdateDownloaded" aria-live="assertive" aria-atomic="true">
|
<div class="toast bg-white" role="alert" data-bs-autohide="false" id="toastUpdateDownloaded" aria-live="assertive" aria-atomic="true">
|
||||||
<div class="toast-header"> <strong class="me-auto"> Update ready...</strong>
|
<div class="toast-header"> <strong class="me-auto"> Update ready...</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="toast-body">Please restart the app for installation!</div>
|
<div class="toast-body">App is going to restart automatically...</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- UPDATE AVAILABLE -->
|
<!-- UPDATE AVAILABLE -->
|
||||||
<div class="toast bg-white" role="alert" data-bs-autohide="true" id="toastUpdateAvailable" aria-live="assertive" aria-atomic="true">
|
|
||||||
<div class="toast-header"> <i class="bi bi-cloud-arrow-down" style="font-size: 1rem; color: black;"></i><strong class="me-auto">Update available</strong>
|
<div class="toast align-items-center text-white bg-primary border-0" data-bs-autohide="false" id="toastUpdateAvailable" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
|
<div class="d-flex">
|
||||||
|
<div class="toast-body"> <i class="bi bi-activity" style="font-size: 1rem; color: black;"></i> Preparing for download...</div>
|
||||||
|
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="toast-body"><i class="bi bi-cloud-arrow-down" style="font-size: 1rem; color: black;"></i>going to download...</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- UPDATE NOT AVAILABLE -->
|
<!-- UPDATE NOT AVAILABLE -->
|
||||||
<div class="toast align-items-center text-white bg-success border-0" id="toastUpdateNotAvailable" role="alert" aria-live="assertive" aria-atomic="true">
|
<div class="toast align-items-center text-white bg-success border-0" id="toastUpdateNotAvailable" role="alert" aria-live="assertive" aria-atomic="true">
|
||||||
<div class="d-flex">
|
<div class="d-flex">
|
||||||
|
|
Loading…
Reference in a new issue