In-app toasts for electron-updater notifications (#3902)

* Add custom updater model back after electron migration
Fixes #3872

* Enable release builds (temp)

* Lint & clean up

* Change approach to no user input, heads up with toast

* Re-enable prod builds

* Working toasts

* Only one toast

* Add missing type

* Clean up before review

* New toast design test

* Clean up

* Use theme colors, add link to changelog

---------

Co-authored-by: Frank Noirot <frank@kittycad.io>
This commit is contained in:
Pierre Jacquier
2024-09-24 13:55:42 -04:00
committed by GitHub
parent 2263958fd0
commit 8b0b5a0215
5 changed files with 98 additions and 10 deletions

View File

@ -251,18 +251,14 @@ export function getAutoUpdater(): AppUpdater {
return autoUpdater
}
export async function checkForUpdates(autoUpdater: AppUpdater) {
// TODO: figure out how to get the update modal back
const result = await autoUpdater.checkForUpdatesAndNotify()
console.log(result)
}
app.on('ready', () => {
const autoUpdater = getAutoUpdater()
checkForUpdates(autoUpdater).catch(reportRejection)
setTimeout(() => {
autoUpdater.checkForUpdates().catch(reportRejection)
}, 1000)
const fifteenMinutes = 15 * 60 * 1000
setInterval(() => {
checkForUpdates(autoUpdater).catch(reportRejection)
autoUpdater.checkForUpdates().catch(reportRejection)
}, fifteenMinutes)
autoUpdater.on('update-available', (info) => {
@ -271,6 +267,11 @@ app.on('ready', () => {
autoUpdater.on('update-downloaded', (info) => {
console.log('update-downloaded', info)
mainWindow?.webContents.send('update-downloaded', info.version)
})
ipcMain.handle('app.restart', () => {
autoUpdater.quitAndInstall()
})
})