mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 20:52:06 +00:00
Autoupdate modal: add download/disable updates buttons
This commit is contained in:
23
index.js
23
index.js
@ -11,6 +11,7 @@ const {
|
|||||||
getEnabledPlugins,
|
getEnabledPlugins,
|
||||||
isAppVisible,
|
isAppVisible,
|
||||||
isTrayEnabled,
|
isTrayEnabled,
|
||||||
|
setOptions,
|
||||||
store,
|
store,
|
||||||
startAtLogin,
|
startAtLogin,
|
||||||
} = require("./store");
|
} = require("./store");
|
||||||
@ -196,15 +197,29 @@ app.on("ready", () => {
|
|||||||
if (!is.dev() && autoUpdate()) {
|
if (!is.dev() && autoUpdate()) {
|
||||||
autoUpdater.checkForUpdatesAndNotify();
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
autoUpdater.on("update-available", () => {
|
autoUpdater.on("update-available", () => {
|
||||||
|
const downloadLink =
|
||||||
|
"https://github.com/th-ch/youtube-music/releases/latest";
|
||||||
const dialogOpts = {
|
const dialogOpts = {
|
||||||
type: "info",
|
type: "info",
|
||||||
buttons: ["OK"],
|
buttons: ["OK", "Download", "Disable updates"],
|
||||||
title: "Application Update",
|
title: "Application Update",
|
||||||
message: "A new version is available",
|
message: "A new version is available",
|
||||||
detail:
|
detail: `A new version is available and can be downloaded at ${downloadLink}`,
|
||||||
"A new version is available and can be downloaded at https://github.com/th-ch/youtube-music/releases/latest",
|
|
||||||
};
|
};
|
||||||
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;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user