Skip to content

Commit

Permalink
Autoupdate modal: add download/disable updates buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
th-ch committed Nov 28, 2020
1 parent 47b4414 commit ae5b85d
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const {
getEnabledPlugins,
isAppVisible,
isTrayEnabled,
setOptions,
store,
startAtLogin,
} = require("./store");
Expand Down Expand Up @@ -196,15 +197,29 @@ app.on("ready", () => {
if (!is.dev() && autoUpdate()) {
autoUpdater.checkForUpdatesAndNotify();
autoUpdater.on("update-available", () => {
const downloadLink =
"https://github.com/th-ch/youtube-music/releases/latest";
const dialogOpts = {
type: "info",
buttons: ["OK"],
buttons: ["OK", "Download", "Disable updates"],
title: "Application Update",
message: "A new version is available",
detail:
"A new version is available and can be downloaded at https://github.com/th-ch/youtube-music/releases/latest",
detail: `A new version is available and can be downloaded at ${downloadLink}`,
};
electron.dialog.showMessageBox(dialogOpts);
electron.dialog.showMessageBox(dialogOpts).then((dialogOutput) => {
switch (dialogOutput.response) {
// Download
case 1:
electron.shell.openExternal(downloadLink);
break;
// Disable updates
case 2:
setOptions({ autoUpdates: false });
break;
default:
break;
}
});
});
}

Expand Down

0 comments on commit ae5b85d

Please sign in to comment.