File tree 1 file changed +19
-4
lines changed
1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const {
11
11
getEnabledPlugins,
12
12
isAppVisible,
13
13
isTrayEnabled,
14
+ setOptions,
14
15
store,
15
16
startAtLogin,
16
17
} = require ( "./store" ) ;
@@ -196,15 +197,29 @@ app.on("ready", () => {
196
197
if ( ! is . dev ( ) && autoUpdate ( ) ) {
197
198
autoUpdater . checkForUpdatesAndNotify ( ) ;
198
199
autoUpdater . on ( "update-available" , ( ) => {
200
+ const downloadLink =
201
+ "https://github.com/th-ch/youtube-music/releases/latest" ;
199
202
const dialogOpts = {
200
203
type : "info" ,
201
- buttons : [ "OK" ] ,
204
+ buttons : [ "OK" , "Download" , "Disable updates" ] ,
202
205
title : "Application Update" ,
203
206
message : "A new version is available" ,
204
- detail :
205
- "A new version is available and can be downloaded at https://github.com/th-ch/youtube-music/releases/latest" ,
207
+ detail : `A new version is available and can be downloaded at ${ downloadLink } ` ,
206
208
} ;
207
- electron . dialog . showMessageBox ( dialogOpts ) ;
209
+ electron . dialog . showMessageBox ( dialogOpts ) . then ( ( dialogOutput ) => {
210
+ switch ( dialogOutput . response ) {
211
+ // Download
212
+ case 1 :
213
+ electron . shell . openExternal ( downloadLink ) ;
214
+ break ;
215
+ // Disable updates
216
+ case 2 :
217
+ setOptions ( { autoUpdates : false } ) ;
218
+ break ;
219
+ default :
220
+ break ;
221
+ }
222
+ } ) ;
208
223
} ) ;
209
224
}
210
225
You can’t perform that action at this time.
0 commit comments