@@ -3,6 +3,8 @@ const { autoUpdater } = require('electron-updater');
33const path = require ( '../../lib/path2' ) ;
44const { HOME_BIN_LINUX } = require ( '../../lib/Constants' ) ;
55const fs = require ( 'fs' ) ;
6+ const ipcChannel = require ( '../../lib/icpChannel' ) ;
7+ const Env = require ( '../../env' ) ;
68
79
810// WARNING: THIS SCRIPT WILL CHANGE THE MACHINE'S STARTUP BEHAVIOUR.
@@ -18,6 +20,7 @@ class Autoupdater extends require('../../lib/BaseModule')
1820
1921 setup_linux ( )
2022 {
23+
2124 this . updateFunction = function ( ) {
2225 this . EXECUTABLE_NAME = app . app_info . app_executable ;
2326 this . DOWNLOAD_PATH = app . getPath ( "downloads" ) ;
@@ -49,12 +52,12 @@ class Autoupdater extends require('../../lib/BaseModule')
4952 this . warn ( "User refused to update" ) ;
5053 } ) ;
5154 } ) ;
52-
53- autoUpdater . on ( 'download-progress' , progressObj => {
54- const logMsg = `Download speed: ${ progressObj . bytesPerSecond } - ${ progressObj . percent . toFixed ( 2 ) } %` ;
55- this . log ( logMsg ) ;
56- this . window . setTitle ( `Downloading update... ${ progressObj . percent . toFixed ( 0 ) } %` ) ;
57- } ) ;
55+ if ( Env . VERBOSE )
56+ autoUpdater . on ( 'download-progress' , progressObj => {
57+ const logMsg = `Download speed: ${ progressObj . bytesPerSecond } - ${ progressObj . percent . toFixed ( 2 ) } %` ;
58+ this . log ( logMsg ) ;
59+ this . window . setTitle ( `Downloading update... ${ progressObj . percent . toFixed ( 0 ) } %` ) ;
60+ } ) ;
5861
5962 autoUpdater . on ( 'update-downloaded' , info => {
6063 // dialog.showMessageBox(this.window, {
@@ -75,6 +78,12 @@ class Autoupdater extends require('../../lib/BaseModule')
7578
7679 autoUpdater . on ( 'update-not-available' , ( ) => {
7780 this . log ( 'No updates available.' ) ;
81+ dialog . showMessageBox ( this . window , {
82+ type : 'info' ,
83+ title : 'No updated available' ,
84+ message : `` ,
85+ buttons : [ 'Ok' ]
86+ } )
7887 } ) ;
7988
8089 autoUpdater . on ( 'error' , err => {
@@ -93,6 +102,7 @@ class Autoupdater extends require('../../lib/BaseModule')
93102 late_setup ( )
94103 {
95104 this . updateFunction ( ) ;
105+ ipcChannel . newMainHandler ( 'usr-check-for-updates' , ( ) => this . updateFunction ( ) ) ;
96106 }
97107}
98108
0 commit comments