@ -32,12 +32,12 @@ export async function start(
logger : LoggerType
) {
if ( interval ) {
logger . info ( ' auto-update: Already running') ;
logger . info ( ' [updater] auto-update: Already running') ;
return ;
}
logger . info ( ' auto-update: starting checks...') ;
logger . info ( ' [updater] auto-update: starting checks...') ;
autoUpdater . logger = logger ;
autoUpdater . autoDownload = false ;
@ -46,7 +46,7 @@ export async function start(
try {
await checkForUpdates ( getMainWindow , i18n , logger ) ;
} catch ( error ) {
logger . error ( ' auto-update: error:', getPrintableError ( error ) ) ;
logger . error ( ' [updater] auto-update: error:', getPrintableError ( error ) ) ;
}
} , UPDATER_INTERVAL_MS ) ; // trigger and try to update every 10 minutes to let the file gets downloaded if we are updating
stopped = false ;
@ -56,11 +56,11 @@ export async function start(
try {
await checkForUpdates ( getMainWindow , i18n , logger ) ;
} catch ( error ) {
logger . error ( ' auto-update: error:', getPrintableError ( error ) ) ;
logger . error ( ' [updater] auto-update: error:', getPrintableError ( error ) ) ;
}
} ,
2 * 60 * 1000
) ; // we do checks from the file server every 1 minute .
) ; // we do checks from the file server every 2 minutes .
}
export function stop() {
@ -84,7 +84,7 @@ async function checkForUpdates(
const canUpdate = await canAutoUpdate ( ) ;
logger . info ( '[updater] canUpdate' , canUpdate ) ;
if ( ! canUpdate ) {
logger . info ( ' checkForUpdates canAutoUpdate false') ;
logger . info ( ' [updater] checkForUpdates canAutoUpdate false') ;
return ;
}
@ -108,7 +108,7 @@ async function checkForUpdates(
logger . info ( '[updater] checkForUpdates isMoreRecent' , isMoreRecent ) ;
if ( ! isMoreRecent ) {
logger . info (
` File server has no update so we are not looking for an update from github current:${ currentVersion } fromFileServer: ${ latestVersionFromFsFromRenderer } `
` [updater] File server has no update so we are not looking for an update from github current:${ currentVersion } fromFileServer: ${ latestVersionFromFsFromRenderer } `
) ;
return ;
}
@ -136,7 +136,7 @@ async function checkForUpdates(
const mainWindow = getMainWindow ( ) ;
if ( ! mainWindow ) {
console . error ( ' cannot showDownloadUpdateDialog, mainWindow is unset') ;
console . error ( ' [updater] cannot showDownloadUpdateDialog, mainWindow is unset') ;
return ;
}
logger . info ( '[updater] showing download dialog...' ) ;
@ -153,7 +153,7 @@ async function checkForUpdates(
} catch ( error ) {
const mainWindow = getMainWindow ( ) ;
if ( ! mainWindow ) {
console . error ( ' cannot showDownloadUpdateDialog, mainWindow is unset') ;
console . error ( ' [updater] cannot showDownloadUpdateDialog, mainWindow is unset') ;
return ;
}
await showCannotUpdateDialog ( mainWindow , i18n ) ;
@ -161,7 +161,7 @@ async function checkForUpdates(
}
const window = getMainWindow ( ) ;
if ( ! window ) {
console . error ( ' cannot showDownloadUpdateDialog, mainWindow is unset') ;
console . error ( ' [updater] cannot showDownloadUpdateDialog, mainWindow is unset') ;
return ;
}
// Update downloaded successfully, we should ask the user to update
@ -182,13 +182,19 @@ async function checkForUpdates(
function isUpdateAvailable ( updateInfo : UpdateInfo ) : boolean {
const latestVersion = parseVersion ( updateInfo . version ) ;
if ( ! latestVersion ) {
console . error (
'[updater] isUpdateAvailable could not parse latest version:' ,
updateInfo . version
) ;
return false ;
}
// We need to convert this to string because typescript won't let us use types across submodules ....
const currentVersion = autoUpdater . currentVersion . toString ( ) ;
return isVersionGreaterThan ( latestVersion , currentVersion ) ;
const latestIsNewer = isVersionGreaterThan ( latestVersion , currentVersion ) ;
console . log ( ` [updater] isUpdateAvailable latestIsNewer: ${ latestIsNewer } ` ) ;
return latestIsNewer ;
}
/ *