11// This is free and unencumbered software released into the public domain.
22// See LICENSE for details
33
4- const { app, BrowserWindow, Menu, protocol, ipcMain} = require ( 'electron' ) ;
4+ const { app, BrowserWindow, dialog , Menu, protocol, ipcMain} = require ( 'electron' ) ;
55if ( process . platform === 'linux' ) {
66 let proxy ;
77 if ( process . env . HTTPS_PROXY ) {
@@ -96,6 +96,7 @@ function createDefaultWindow() {
9696 win . loadURL ( `file://${ __dirname } /version.html#v${ app . getVersion ( ) } ` ) ;
9797 return win ;
9898}
99+
99100autoUpdater . on ( 'checking-for-update' , ( ) => {
100101 sendStatusToWindow ( 'Checking for update...' ) ;
101102} )
@@ -138,9 +139,9 @@ app.on('window-all-closed', () => {
138139// This will immediately download an update, then install when the
139140// app quits.
140141//-------------------------------------------------------------------
141- app . on ( 'ready' , function ( ) {
142- autoUpdater . checkForUpdatesAndNotify ( ) ;
143- } ) ;
142+ // app.on('ready', function() {
143+ // autoUpdater.checkForUpdatesAndNotify();
144+ // });
144145
145146//-------------------------------------------------------------------
146147// Auto updates - Option 2 - More control
@@ -153,19 +154,29 @@ app.on('ready', function() {
153154// Uncomment any of the below events to listen for them. Also,
154155// look in the previous section to see them being used.
155156//-------------------------------------------------------------------
156- // app.on('ready', function() {
157- // autoUpdater.checkForUpdates();
158- // });
159- // autoUpdater.on('checking-for-update', () => {
160- // })
161- // autoUpdater.on('update-available', (info) => {
162- // })
163- // autoUpdater.on('update-not-available', (info) => {
164- // })
165- // autoUpdater.on('error', (err) => {
166- // })
167- // autoUpdater.on('download-progress', (progressObj) => {
168- // })
169- // autoUpdater.on('update-downloaded', (info) => {
170- // autoUpdater.quitAndInstall();
171- // })
157+ autoUpdater . autoDownload = false ;
158+ autoUpdater . autoInstallOnAppQuit = false ;
159+
160+ app . on ( 'ready' , function ( ) {
161+ autoUpdater . checkForUpdates ( ) . then ( ) ;
162+ } ) ;
163+
164+ autoUpdater . on ( 'checking-for-update' , ( foo ) => {
165+ log . info ( 'got checking-for-update event: %s' , JSON . stringify ( foo ) ) ;
166+ } ) ;
167+ autoUpdater . on ( 'update-available' , ( info ) => {
168+ log . info ( 'got update-available event: %s' , JSON . stringify ( info ) ) ;
169+ } )
170+ autoUpdater . on ( 'update-not-available' , ( info ) => {
171+ log . info ( 'got update-not-available event: %s' , JSON . stringify ( info ) ) ;
172+ } )
173+ autoUpdater . on ( 'error' , ( err ) => {
174+ log . info ( 'got error event: %s' , JSON . stringify ( err ) ) ;
175+ } )
176+ autoUpdater . on ( 'download-progress' , ( progressObj ) => {
177+ log . info ( 'got download-progress event: %s' , JSON . stringify ( progressObj ) ) ;
178+ } )
179+ autoUpdater . on ( 'update-downloaded' , ( info ) => {
180+ log . info ( 'got update-downloaded event: %s' , JSON . stringify ( info ) ) ;
181+ autoUpdater . autoInstallOnAppQuit = true ;
182+ } )
0 commit comments