Application now checks for updates every 30 minutes.
This commit is contained in:
parent
f1cf433ca8
commit
0216582827
@ -29,35 +29,42 @@ webFrame.setLayoutZoomLevelLimits(0, 0)
|
|||||||
|
|
||||||
// Initialize auto updates in production environments.
|
// Initialize auto updates in production environments.
|
||||||
// TODO Make this the case after implementation is done.
|
// TODO Make this the case after implementation is done.
|
||||||
|
let updateCheckListener
|
||||||
if(!isDev){
|
if(!isDev){
|
||||||
ipcRenderer.on('autoUpdateNotification', (event, arg, info) => {
|
ipcRenderer.on('autoUpdateNotification', (event, arg, info) => {
|
||||||
switch(arg){
|
switch(arg){
|
||||||
case 'checking-for-update':
|
case 'checking-for-update':
|
||||||
console.log('Checking for update..')
|
console.log('%c[AutoUpdater]', 'color: #a02d2a; font-weight: bold', 'Checking for update..')
|
||||||
break
|
break
|
||||||
case 'update-available':
|
case 'update-available':
|
||||||
console.log('New update available', info.version)
|
console.log('%c[AutoUpdater]', 'color: #a02d2a; font-weight: bold', 'New update available', info.version)
|
||||||
break
|
break
|
||||||
case 'update-downloaded':
|
case 'update-downloaded':
|
||||||
console.log('Update ' + info.version + ' ready to be installed.')
|
console.log('%c[AutoUpdater]', 'color: #a02d2a; font-weight: bold', 'Update ' + info.version + ' ready to be installed.')
|
||||||
showUpdateUI(info)
|
showUpdateUI(info)
|
||||||
break
|
break
|
||||||
case 'update-not-available':
|
case 'update-not-available':
|
||||||
console.log('No new update found.')
|
console.log('%c[AutoUpdater]', 'color: #a02d2a; font-weight: bold', 'No new update found.')
|
||||||
break
|
break
|
||||||
case 'ready':
|
case 'ready':
|
||||||
|
updateCheckListener = setInterval(() => {
|
||||||
ipcRenderer.send('autoUpdateAction', 'checkForUpdate')
|
ipcRenderer.send('autoUpdateAction', 'checkForUpdate')
|
||||||
case 'error':
|
}, 1800000)
|
||||||
console.log('Error during update check..')
|
ipcRenderer.send('autoUpdateAction', 'checkForUpdate')
|
||||||
console.debug('Error Code:', info != null ? info.code : null)
|
case 'realerror':
|
||||||
if(err != null && err.code != null){
|
if(info != null && info.code != null){
|
||||||
if(err.code === 'ERR_UPDATER_INVALID_RELEASE_FEED'){
|
if(info.code === 'ERR_UPDATER_INVALID_RELEASE_FEED'){
|
||||||
console.log('No suitable releases found.')
|
console.log('%c[AutoUpdater]', 'color: #a02d2a; font-weight: bold', 'No suitable releases found.')
|
||||||
|
} else if(info.code === 'ERR_XML_MISSED_ELEMENT'){
|
||||||
|
console.log('%c[AutoUpdater]', 'color: #a02d2a; font-weight: bold', 'No releases found.')
|
||||||
|
} else {
|
||||||
|
console.error('%c[AutoUpdater]', 'color: #a02d2a; font-weight: bold', 'Error during update check..', info)
|
||||||
|
console.debug('%c[AutoUpdater]', 'color: #a02d2a; font-weight: bold', 'Error Code:', info.code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
console.log('Unknown argument', arg)
|
console.log('%c[AutoUpdater]', 'color: #a02d2a; font-weight: bold', 'Unknown argument', arg)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
6
index.js
6
index.js
@ -6,7 +6,8 @@ const url = require('url')
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const ejse = require('ejs-electron')
|
const ejse = require('ejs-electron')
|
||||||
|
|
||||||
function initAutoUpdater(event){
|
// Setup auto updater.
|
||||||
|
function initAutoUpdater(event) {
|
||||||
// Defaults to true if application version contains prerelease components (e.g. 0.12.1-alpha.1)
|
// Defaults to true if application version contains prerelease components (e.g. 0.12.1-alpha.1)
|
||||||
// autoUpdater.allowPrerelease = true
|
// autoUpdater.allowPrerelease = true
|
||||||
if(isDev){
|
if(isDev){
|
||||||
@ -27,6 +28,7 @@ function initAutoUpdater(event){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Open channel to listen for update actions.
|
||||||
ipcMain.on('autoUpdateAction', (event, arg) => {
|
ipcMain.on('autoUpdateAction', (event, arg) => {
|
||||||
switch(arg){
|
switch(arg){
|
||||||
case 'initAutoUpdater':
|
case 'initAutoUpdater':
|
||||||
@ -37,7 +39,7 @@ ipcMain.on('autoUpdateAction', (event, arg) => {
|
|||||||
case 'checkForUpdate':
|
case 'checkForUpdate':
|
||||||
autoUpdater.checkForUpdates()
|
autoUpdater.checkForUpdates()
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
event.sender.send('autoUpdateNotification', 'error', err)
|
event.sender.send('autoUpdateNotification', 'realerror', err)
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
case 'installUpdateNow':
|
case 'installUpdateNow':
|
||||||
|
Loading…
Reference in New Issue
Block a user