@@ -3,8 +3,9 @@ const app = electron.app
3
3
const Menu = electron . Menu
4
4
const ipc = electron . ipcMain
5
5
const GhReleases = require ( 'electron-gh-releases' )
6
- const isDev = process . env . NODE_ENV !== 'production'
6
+ const { isPackaged } = app
7
7
// electron.crashReporter.start()
8
+
8
9
var ipcServer = null
9
10
10
11
var mainWindow = null
@@ -36,7 +37,7 @@ const updater = new GhReleases(ghReleasesOpts)
36
37
// Check for updates
37
38
// `status` returns true if there is a new update available
38
39
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.
40
41
console . log ( 'Updates are disabled in Development mode, see main-app.js' )
41
42
return true
42
43
}
@@ -99,12 +100,12 @@ app.on('ready', function () {
99
100
100
101
// Check update every day
101
102
setInterval ( function ( ) {
102
- if ( ! isDev ) checkUpdate ( )
103
+ if ( isPackaged ) checkUpdate ( )
103
104
} , 1000 * 60 * 60 * 24 )
104
105
105
106
// Check update after 10 secs to prevent file locking of Windows
106
107
setTimeout ( ( ) => {
107
- if ( ! isDev ) checkUpdate ( )
108
+ if ( isPackaged ) checkUpdate ( )
108
109
109
110
ipc . on ( 'update-check' , function ( event , msg ) {
110
111
if ( isUpdateReady ) {
0 commit comments