Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable updates in dev #2798

Merged
merged 5 commits into from
Jan 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/main-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const app = electron.app
const Menu = electron.Menu
const ipc = electron.ipcMain
const GhReleases = require('electron-gh-releases')
const isDev = process.env.NODE_ENV !== 'production'
// electron.crashReporter.start()
var ipcServer = null

Expand Down Expand Up @@ -35,6 +36,10 @@ const updater = new GhReleases(ghReleasesOpts)
// Check for updates
// `status` returns true if there is a new update available
function checkUpdate () {
if (isDev) { // Prevents app from attempting to update when in dev mode.
console.log('Updates are disabled in Development mode, see main-app.js')
return true
}
if (process.platform === 'linux' || isUpdateReady) {
return true
}
Expand Down Expand Up @@ -94,12 +99,12 @@ app.on('ready', function () {

// Check update every day
setInterval(function () {
checkUpdate()
if (!isDev) checkUpdate()
MiloTodt marked this conversation as resolved.
Show resolved Hide resolved
}, 1000 * 60 * 60 * 24)

// Check update after 10 secs to prevent file locking of Windows
setTimeout(() => {
checkUpdate()
if (!isDev) checkUpdate()

ipc.on('update-check', function (event, msg) {
if (isUpdateReady) {
Expand Down