mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-12 17:26:17 +00:00
Fix Cancel update
This commit is contained in:
committed by
Junyoung Choi
parent
553832bdfa
commit
3e405e1abf
@@ -117,8 +117,9 @@ function downloadUpdate() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
ipcRenderer.send('update-app-confirm')
|
ipcRenderer.send('update-download-confirm')
|
||||||
} else if (index === 1) {
|
} else if (index === 1) {
|
||||||
|
ipcRenderer.send('update-cancel')
|
||||||
ConfigManager.set({ autoUpdateEnabled: false })
|
ConfigManager.set({ autoUpdateEnabled: false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ if (!singleInstance) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isUpdateReady = false
|
var isUpdateReady = false
|
||||||
|
let updateFound = false
|
||||||
|
|
||||||
var ghReleasesOpts = {
|
var ghReleasesOpts = {
|
||||||
repo: 'BoostIO/boost-releases',
|
repo: 'BoostIO/boost-releases',
|
||||||
@@ -37,15 +38,17 @@ const updater = new GhReleases(ghReleasesOpts)
|
|||||||
// Check for updates
|
// Check for updates
|
||||||
// `status` returns true if there is a new update available
|
// `status` returns true if there is a new update available
|
||||||
function checkUpdate(manualTriggered = false) {
|
function checkUpdate(manualTriggered = false) {
|
||||||
// if (!isPackaged) {
|
if (!isPackaged) {
|
||||||
// Prevents app from attempting to update when in dev mode.
|
// Prevents app from attempting to update when in dev mode.
|
||||||
// console.log('Updates are disabled in Development mode, see main-app.js')
|
console.log('Updates are disabled in Development mode, see main-app.js')
|
||||||
// return true
|
return true
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (!electronConfig.get('autoUpdateEnabled', true) && !manualTriggered) return
|
if (!electronConfig.get('autoUpdateEnabled', true) && !manualTriggered) return
|
||||||
// if (process.platform === 'linux' || isUpdateReady) {
|
if (process.platform === 'linux' || isUpdateReady || updateFound) {
|
||||||
// return true
|
console.log('READY|FOUND', isUpdateReady, updateFound)
|
||||||
// }
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
updater.check((err, status) => {
|
updater.check((err, status) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
@@ -59,7 +62,7 @@ function checkUpdate(manualTriggered = false) {
|
|||||||
}
|
}
|
||||||
if (status) {
|
if (status) {
|
||||||
mainWindow.webContents.send('update-found', 'Update available!')
|
mainWindow.webContents.send('update-found', 'Update available!')
|
||||||
updater.download()
|
updateFound = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -68,6 +71,7 @@ updater.on('update-downloaded', info => {
|
|||||||
if (mainWindow != null) {
|
if (mainWindow != null) {
|
||||||
mainWindow.webContents.send('update-ready', 'Update available!')
|
mainWindow.webContents.send('update-ready', 'Update available!')
|
||||||
isUpdateReady = true
|
isUpdateReady = true
|
||||||
|
updateFound = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -82,6 +86,14 @@ ipc.on('update-app-confirm', function(event, msg) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipc.on('update-cancel', () => {
|
||||||
|
updateFound = false
|
||||||
|
})
|
||||||
|
|
||||||
|
ipc.on('update-download-confirm', () => {
|
||||||
|
updater.download()
|
||||||
|
})
|
||||||
|
|
||||||
app.on('window-all-closed', function() {
|
app.on('window-all-closed', function() {
|
||||||
app.quit()
|
app.quit()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user