mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-14 11:15:50 +00:00
Update Button
This commit is contained in:
parent
4bd0878842
commit
3d85467908
32
electron.js
32
electron.js
@ -1,4 +1,4 @@
|
|||||||
const { app, BrowserWindow, ipcMain, Menu, Notification, Tray, nativeImage } = require('electron');
|
const { app, BrowserWindow, ipcMain, Menu, Notification, Tray, nativeImage, dialog } = require('electron');
|
||||||
const { autoUpdater } = require('electron-updater');
|
const { autoUpdater } = require('electron-updater');
|
||||||
const server = require('./server.js');
|
const server = require('./server.js');
|
||||||
const log = require('electron-log');
|
const log = require('electron-log');
|
||||||
@ -125,26 +125,30 @@ if (!isLock) {
|
|||||||
autoUpdater.on('update-available', () => {
|
autoUpdater.on('update-available', () => {
|
||||||
const n = new Notification({
|
const n = new Notification({
|
||||||
title: 'Update Available!',
|
title: 'Update Available!',
|
||||||
body: 'It will be downloaded ⌛️ in the background and installed after download.'
|
body: 'It will be downloaded ⌛️ in the background!'
|
||||||
})
|
})
|
||||||
n.show();
|
n.show();
|
||||||
})
|
})
|
||||||
|
autoUpdater.on('update-downloaded', (event) => {
|
||||||
|
const dialogOpts = {
|
||||||
|
type: 'info',
|
||||||
|
buttons: ['Restart now', 'Install after next restart'],
|
||||||
|
title: 'Update available',
|
||||||
|
detail: 'A new Qortal UI version has been downloaded. Click RESTART NOW to apply update, or INSTALL AFTER NEXT RESTART to install after next start.'
|
||||||
|
}
|
||||||
|
dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
||||||
|
if (returnValue.response === 0) {
|
||||||
|
autoUpdater.quitAndInstall()
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
autoUpdater.on('error', (err) => {
|
autoUpdater.on('error', (err) => {
|
||||||
const n = new Notification({
|
const n = new Notification({
|
||||||
title: 'Error while Updating...',
|
title: 'Error while Updating...',
|
||||||
body: err
|
body: err
|
||||||
})
|
})
|
||||||
// n.show();
|
n.show();
|
||||||
})
|
|
||||||
autoUpdater.on('update-downloaded', () => {
|
|
||||||
const n = new Notification({
|
|
||||||
title: 'Update Downloaded!',
|
|
||||||
body: 'Restarting in 30 secounds to Update. Please finish your tasks!'
|
|
||||||
})
|
|
||||||
setTimeout(() => {
|
|
||||||
n.show();
|
|
||||||
}, 30000);
|
|
||||||
autoUpdater.quitAndInstall();
|
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user