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:
17
src/main.ts
17
src/main.ts
@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user