Skip to content

Commit 2ff655d

Browse files
committed
Check update if the app is packaged
1 parent e53717c commit 2ff655d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/main-app.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ const app = electron.app
33
const Menu = electron.Menu
44
const ipc = electron.ipcMain
55
const GhReleases = require('electron-gh-releases')
6-
const isDev = process.env.NODE_ENV !== 'production'
6+
const { isPackaged } = app
77
// electron.crashReporter.start()
8+
89
var ipcServer = null
910

1011
var mainWindow = null
@@ -36,7 +37,7 @@ const updater = new GhReleases(ghReleasesOpts)
3637
// Check for updates
3738
// `status` returns true if there is a new update available
3839
function checkUpdate () {
39-
if (isDev) { // Prevents app from attempting to update when in dev mode.
40+
if (!isPackaged) { // Prevents app from attempting to update when in dev mode.
4041
console.log('Updates are disabled in Development mode, see main-app.js')
4142
return true
4243
}
@@ -99,12 +100,12 @@ app.on('ready', function () {
99100

100101
// Check update every day
101102
setInterval(function () {
102-
if (!isDev) checkUpdate()
103+
if (isPackaged) checkUpdate()
103104
}, 1000 * 60 * 60 * 24)
104105

105106
// Check update after 10 secs to prevent file locking of Windows
106107
setTimeout(() => {
107-
if (!isDev) checkUpdate()
108+
if (isPackaged) checkUpdate()
108109

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

0 commit comments

Comments
 (0)