Skip to content

Commit

Permalink
check updates every 6 hours
Browse files Browse the repository at this point in the history
  • Loading branch information
JAlbertoGonzalez committed Jun 18, 2020
1 parent 9454e0d commit d254298
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,19 +268,33 @@ app.on('set-tooltip', msg => {
* https://simulatedgreg.gitbooks.io/electron-vue/content/en/using-electron-builder.html#auto-updating
*/

autoUpdater.logger = Logger

if (process.env.NODE_ENV === 'development') {
// Only for testing
autoUpdater.updateConfigPath = 'dev-app-update.yml'
autoUpdater.logger = Logger
autoUpdater.currentVersion = '1.0.0'
}

autoUpdater.on('update-downloaded', (info) => {
if (process.env.NODE_ENV !== 'development') autoUpdater.quitAndInstall()
// Silent and force re-open after update
if (process.env.NODE_ENV !== 'development') {
Logger.info('New update downloaded, quit and install')
autoUpdater.quitAndInstall()
}
})

app.on('ready', () => {
function checkUpdates() {
autoUpdater.checkForUpdates().then((UpdateCheckResult) => {
autoUpdater.updateInfoAndProvider = UpdateCheckResult
})
}

app.on('ready', () => {
checkUpdates()

// Check updates every 6 hours
setInterval(() => {
checkUpdates()
}, 1000 * 60 * 60 * 6)
})

0 comments on commit d254298

Please sign in to comment.