Skip to content

Commit

Permalink
Squash me
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgraham committed Feb 22, 2017
1 parent a545e86 commit 2a1d106
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion app/main/appium.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import path from 'path';
import wd from 'wd';
import Bluebird from 'bluebird';
import { connectAutoUpdater } from './auto-updater';
import packageJSON from '../../package.json';
console.log(packageJSON.version);

const LOG_SEND_INTERVAL_MS = 250;
const isDev = process.env.NODE_ENV === 'development';
Expand Down Expand Up @@ -281,7 +283,6 @@ function initializeIpc (win) {
connectClientMethodListener(win);

// Look for changes
console.log('Opening auto updater');
connectAutoUpdater(win);
}

Expand Down
20 changes: 13 additions & 7 deletions app/main/auto-updater.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,42 @@
import { autoUpdater } from 'electron-updater';
import log from 'electron-log';
import packageJSON from '../../package.json';

function connectAutoUpdater (win) {

autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = "info";

log('Looking for updates');
autoUpdater.checkForUpdates();
// Autoupdater only works in binaries. Don't do anything
try {
autoUpdater.checkForUpdates();
log.info(`Looking for updates. Current version is ${packageJSON.version}`);
} catch (e) {
return;
}

autoUpdater.on('checking-for-update', () => {
log('Checking for an update!');
log.info('Checking for an update!');
win.webContents.send('checking-for-update');
});

autoUpdater.on('update-not-available', () => {
log('Update is not available');
log.info('Update is not available');
win.webContents.send('update-not-available');
});

autoUpdater.on('update-available', () => {
log('Update is available');
log.info('Update is available');
win.webContents.send('update-available');
});

autoUpdater.on('update-downloaded', () => {
log('Update downloaded');
log.info('Update downloaded');
win.webContents.send('update-downloaded');
});

autoUpdater.on('error', () => {
log('Update error');
log.info('Update error');
win.webContents.send('update-error');
});
}
Expand Down

0 comments on commit 2a1d106

Please sign in to comment.