@@ -17,9 +17,53 @@ class Updater {
1717 this . _Store = store ;
1818 this . _WindowManager = wm ;
1919 this . _configureEventListener ( ) ;
20+ this . _AutoUpdaterInterval = null ;
2021 autoUpdater . logger = log ;
2122 autoUpdater . logger . transports . file . level = "info" ;
22- autoUpdater . autoDownload = false ;
23+ const settings = store . get ( "settings" , { } ) ;
24+ this . _AutoCheck =
25+ settings . autoCheckDownloadUpdates === undefined || settings . autoCheckDownloadUpdates === true ? true : false ;
26+ autoUpdater . autoDownload = this . _AutoCheck ;
27+
28+ // Attempt to start auto updating interval if settings permit
29+ this . startCheckInterval ( ) ;
30+ }
31+
32+ /**
33+ * Start the automatic update checking interval
34+ *
35+ * @memberof Updater
36+ */
37+ startCheckInterval ( ) {
38+ if ( this . _AutoCheck ) {
39+ log . info ( "Starting Automatic Update Checking Interval" ) ;
40+ this . _AutoUpdaterInterval = setInterval ( ( ) => {
41+ const settings = this . _Store . get ( "settings" , { } ) ;
42+ this . _AutoCheck =
43+ settings . autoCheckDownloadUpdates === undefined || settings . autoCheckDownloadUpdates === true ? true : false ;
44+ if (
45+ this . _AutoCheck &&
46+ settings . lastUpdateCheck !== undefined &&
47+ new Date ( ) . getTime ( ) - settings . lastUpdateCheck >= 3600000
48+ ) {
49+ log . info ( "Auto Checking For Updates" ) ;
50+ this . checkForUpdates ( ) ;
51+ }
52+ } , 3600000 ) ;
53+ }
54+ }
55+
56+ /**
57+ * Stop the automatic update checking interval
58+ *
59+ * @memberof Updater
60+ */
61+ stopCheckInterval ( ) {
62+ if ( this . _AutoUpdaterInterval !== null ) {
63+ log . info ( "Stopping Automatic Update Checking Interval" ) ;
64+ clearInterval ( this . _AutoUpdaterInterval ) ;
65+ this . _AutoUpdaterInterval = null ;
66+ }
2367 }
2468
2569 /**
@@ -28,7 +72,6 @@ class Updater {
2872 async checkForUpdates ( ) {
2973 return await autoUpdater . checkForUpdates ( ) . catch ( err => {
3074 log . error ( err ) ;
31- reject ( err ) ;
3275 } ) ;
3376 }
3477
0 commit comments