fix: macOS updater

This commit is contained in:
ThaUnknown 2024-07-03 21:09:41 +02:00
parent 3ca45b5192
commit d44ae0dce8
3 changed files with 12 additions and 3 deletions

View file

@ -69,9 +69,9 @@ class RSSMediaManager {
if (!ignoreErrors) {
res.catch(e => {
toast.error('Search Failed', {
description: 'Failed Loading Media for Home Feed!\n' + e.message
description: 'Failed to loading media for home feed!\n' + e.message
})
console.error('Failed Loading Media for Home Feed', e)
console.error('Failed to loading media for home feed', e)
})
}
return Array.from({ length: perPage }, (_, i) => ({ type: 'episode', data: this.fromPending(res, i) }))

View file

@ -146,6 +146,6 @@ export default class App {
setTimeout(resolve, 5000).unref?.()
})
this.destroyed = true
app.quit()
if (!this.updater.install()) app.quit()
}
}

View file

@ -10,6 +10,7 @@ ipcMain.on('update', () => {
autoUpdater.checkForUpdatesAndNotify()
export default class Updater {
hasUpdate = false
/**
* @param {import('electron').BrowserWindow} window
*/
@ -18,7 +19,15 @@ export default class Updater {
window.webContents.send('update-available', true)
})
autoUpdater.on('update-downloaded', () => {
this.hasUpdate = true
window.webContents.send('update-downloaded', true)
})
}
install () {
if (this.hasUpdate) {
autoUpdater.quitAndInstall()
return true
}
}
}