Skip to content

Commit

Permalink
chore: added dialog to the update-available event handling logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Villa committed Feb 13, 2024
1 parent f7c7497 commit c3c337d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/desktop-app/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,17 @@ const buildAutoUpdater = (win: any): void => {

// Ref here: https://www.electronjs.org/docs/latest/api/auto-updater
autoUpdater.on("update-available", (info) => {
console.log("update available log by console: ", info);
autoUpdater.downloadUpdate().catch(error => console.error(error));
dialog.showMessageBox({
type: 'question',
buttons: ['Download update', 'Skip'],
defaultId: 0,
message: 'update-available event'
}).then(async (selection) => {
if (selection.response === 0) {
console.log("update available log by console: ", info);
autoUpdater.downloadUpdate().catch(error => console.error(error));
}
});
});

autoUpdater.on("update-downloaded", () => {
Expand Down

0 comments on commit c3c337d

Please sign in to comment.