mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 01:36:22 +00:00
Menu item calls update-check
This commit is contained in:
committed by
Junyoung Choi
parent
3b5eff582a
commit
18d65d999a
@@ -36,20 +36,25 @@ const updater = new GhReleases(ghReleasesOpts)
|
||||
|
||||
// Check for updates
|
||||
// `status` returns true if there is a new update available
|
||||
function checkUpdate() {
|
||||
if (!isPackaged) {
|
||||
// Prevents app from attempting to update when in dev mode.
|
||||
console.log('Updates are disabled in Development mode, see main-app.js')
|
||||
return true
|
||||
}
|
||||
if (!electronConfig.get('autoUpdateEnabled', true)) return
|
||||
if (process.platform === 'linux' || isUpdateReady) {
|
||||
return true
|
||||
}
|
||||
function checkUpdate(manualTriggered = false) {
|
||||
// if (!isPackaged) {
|
||||
// Prevents app from attempting to update when in dev mode.
|
||||
// console.log('Updates are disabled in Development mode, see main-app.js')
|
||||
// return true
|
||||
// }
|
||||
if (!electronConfig.get('autoUpdateEnabled', true) && !manualTriggered) return
|
||||
// if (process.platform === 'linux' || isUpdateReady) {
|
||||
// return true
|
||||
// }
|
||||
|
||||
updater.check((err, status) => {
|
||||
if (err) {
|
||||
var isLatest = err.message === 'There is no newer version.'
|
||||
if (!isLatest) console.error('Updater error! %s', err.message)
|
||||
mainWindow.webContents.send(
|
||||
'update-not-found',
|
||||
isLatest ? 'There is no newer version.' : 'Updater error'
|
||||
)
|
||||
return
|
||||
}
|
||||
if (status) {
|
||||
@@ -113,7 +118,7 @@ app.on('ready', function() {
|
||||
if (isUpdateReady) {
|
||||
mainWindow.webContents.send('update-ready', 'Update available!')
|
||||
} else {
|
||||
checkUpdate()
|
||||
checkUpdate(msg === 'manual')
|
||||
}
|
||||
})
|
||||
}, 10 * 1000)
|
||||
|
||||
@@ -3,7 +3,6 @@ const BrowserWindow = electron.BrowserWindow
|
||||
const shell = electron.shell
|
||||
const ipc = electron.ipcMain
|
||||
const mainWindow = require('./main-window')
|
||||
const { checkUpdate } = require('./main-app')
|
||||
const os = require('os')
|
||||
|
||||
const macOS = process.platform === 'darwin'
|
||||
@@ -186,7 +185,7 @@ const file = {
|
||||
{
|
||||
label: 'Update',
|
||||
click() {
|
||||
checkUpdate()
|
||||
mainWindow.webContents.send('update')
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user