Skip to content

Commit

Permalink
Fixing beta updates [WIP] #269
Browse files Browse the repository at this point in the history
  • Loading branch information
akashnimare committed Aug 18, 2017
1 parent 733209e commit 39d30b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
8 changes: 8 additions & 0 deletions app/main/autoupdater.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
'use strict';
const {app, dialog} = require('electron');
const {autoUpdater} = require('electron-updater');
const isDev = require('electron-is-dev');

const ConfigUtil = require('./../renderer/js/utils/config-util.js');

function appUpdater() {
// Don't initiate auto-updates in development and on Linux system
// since autoUpdater doesn't work on Linux
if (isDev || process.platform === 'linux') {
return;
}

// Log whats happening
const log = require('electron-log');
log.transports.file.level = 'info';
autoUpdater.logger = log;

// Handle auto updates for beta/pre releases
autoUpdater.allowPrerelease = ConfigUtil.getConfigItem('betaUpdate') || false;

Expand Down
12 changes: 2 additions & 10 deletions app/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
const path = require('path');
const electron = require('electron');
const electronLocalshortcut = require('electron-localshortcut');
const isDev = require('electron-is-dev');
const windowStateKeeper = require('electron-window-state');
const appMenu = require('./menu');
const { appUpdater } = require('./autoupdater');
Expand Down Expand Up @@ -34,10 +33,6 @@ if (isAlreadyRunning) {
return app.quit();
}

function isWindowsOrmacOS() {
return process.platform === 'darwin' || process.platform === 'win32';
}

const APP_ICON = path.join(__dirname, '../resources', 'Icon');

const iconPath = () => {
Expand Down Expand Up @@ -167,11 +162,8 @@ app.on('ready', () => {
});

page.once('did-frame-finish-load', () => {
const checkOS = isWindowsOrmacOS();
if (checkOS && !isDev) {
// Initate auto-updates on MacOS and Windows
appUpdater();
}
// Initate auto-updates on MacOS and Windows
appUpdater();
});

electron.powerMonitor.on('resume', () => {
Expand Down

0 comments on commit 39d30b9

Please sign in to comment.