@@ -54,7 +54,8 @@ function buildMenu (ctx) {
54
54
[ 'ipfsIsStopping' , 'yellow' ] ,
55
55
[ 'ipfsIsNotRunning' , 'gray' ] ,
56
56
[ 'ipfsHasErrored' , 'red' ] ,
57
- [ 'runningWithGC' , 'yellow' ]
57
+ [ 'runningWithGC' , 'yellow' ] ,
58
+ [ 'runningWhileCheckingForUpdate' , 'yellow' ]
58
59
] . map ( ( [ status , color ] ) => ( {
59
60
id : status ,
60
61
label : i18n . t ( status ) ,
@@ -203,9 +204,15 @@ function buildMenu (ctx) {
203
204
} ,
204
205
{ type : 'separator' } ,
205
206
{
207
+ id : 'checkForUpdates' ,
206
208
label : i18n . t ( 'checkForUpdates' ) ,
207
209
click : ( ) => { ctx . manualCheckForUpdates ( ) }
208
210
} ,
211
+ {
212
+ id : 'checkingForUpdates' ,
213
+ label : i18n . t ( 'checkingForUpdates' ) ,
214
+ enabled : false
215
+ } ,
209
216
{ type : 'separator' } ,
210
217
{
211
218
label : i18n . t ( 'viewOnGitHub' ) ,
@@ -245,7 +252,8 @@ module.exports = function (ctx) {
245
252
246
253
const state = {
247
254
status : null ,
248
- gcRunning : false
255
+ gcRunning : false ,
256
+ isUpdating : false
249
257
}
250
258
251
259
// macOS tray drop files
@@ -276,15 +284,16 @@ module.exports = function (ctx) {
276
284
}
277
285
278
286
const updateMenu = ( ) => {
279
- const { status, gcRunning } = state
287
+ const { status, gcRunning, isUpdating } = state
280
288
const errored = status === STATUS . STARTING_FAILED || status === STATUS . STOPPING_FAILED
281
289
282
- menu . getMenuItemById ( 'ipfsIsStarting' ) . visible = status === STATUS . STARTING_STARTED && ! gcRunning
283
- menu . getMenuItemById ( 'ipfsIsRunning' ) . visible = status === STATUS . STARTING_FINISHED && ! gcRunning
284
- menu . getMenuItemById ( 'ipfsIsStopping' ) . visible = status === STATUS . STOPPING_STARTED && ! gcRunning
285
- menu . getMenuItemById ( 'ipfsIsNotRunning' ) . visible = status === STATUS . STOPPING_FINISHED && ! gcRunning
286
- menu . getMenuItemById ( 'ipfsHasErrored' ) . visible = errored && ! gcRunning
290
+ menu . getMenuItemById ( 'ipfsIsStarting' ) . visible = status === STATUS . STARTING_STARTED && ! gcRunning && ! isUpdating
291
+ menu . getMenuItemById ( 'ipfsIsRunning' ) . visible = status === STATUS . STARTING_FINISHED && ! gcRunning && ! isUpdating
292
+ menu . getMenuItemById ( 'ipfsIsStopping' ) . visible = status === STATUS . STOPPING_STARTED && ! gcRunning && ! isUpdating
293
+ menu . getMenuItemById ( 'ipfsIsNotRunning' ) . visible = status === STATUS . STOPPING_FINISHED && ! gcRunning && ! isUpdating
294
+ menu . getMenuItemById ( 'ipfsHasErrored' ) . visible = errored && ! gcRunning && ! isUpdating
287
295
menu . getMenuItemById ( 'runningWithGC' ) . visible = gcRunning
296
+ menu . getMenuItemById ( 'runningWhileCheckingForUpdate' ) . visible = isUpdating
288
297
289
298
menu . getMenuItemById ( 'startIpfs' ) . visible = status === STATUS . STOPPING_FINISHED
290
299
menu . getMenuItemById ( 'stopIpfs' ) . visible = status === STATUS . STARTING_FINISHED
@@ -309,6 +318,10 @@ module.exports = function (ctx) {
309
318
menu . getMenuItemById ( 'setCustomBinary' ) . visible = ! hasCustomBinary ( )
310
319
menu . getMenuItemById ( 'clearCustomBinary' ) . visible = hasCustomBinary ( )
311
320
321
+ menu . getMenuItemById ( 'checkForUpdates' ) . enabled = ! isUpdating
322
+ menu . getMenuItemById ( 'checkForUpdates' ) . visible = ! isUpdating
323
+ menu . getMenuItemById ( 'checkingForUpdates' ) . visible = isUpdating
324
+
312
325
if ( status === STATUS . STARTING_FINISHED ) {
313
326
tray . setImage ( icon ( on ) )
314
327
} else {
@@ -342,6 +355,16 @@ module.exports = function (ctx) {
342
355
updateMenu ( )
343
356
} )
344
357
358
+ ipcMain . on ( 'updating' , ( ) => {
359
+ state . isUpdating = true
360
+ updateMenu ( )
361
+ } )
362
+
363
+ ipcMain . on ( 'updatingEnded' , ( ) => {
364
+ state . isUpdating = false
365
+ updateMenu ( )
366
+ } )
367
+
345
368
ipcMain . on ( 'configUpdated' , ( ) => { updateMenu ( ) } )
346
369
ipcMain . on ( 'languageUpdated' , ( ) => { setupMenu ( ) } )
347
370
0 commit comments