提交 a0bfd9e4 编写于 作者: M Milo Todt

Disables updates in development mode

上级 5a9de1a9
......@@ -2,7 +2,8 @@ const electron = require('electron')
const app = electron.app
const Menu = electron.Menu
const ipc = electron.ipcMain
const GhReleases = require('electron-gh-releases')
const GhReleases = require('electron-gh-releases')
const isDev = require('electron-is-dev') //isDev is True if running in development mode. Overide by setting ELECTRON_IS_DEV environment variable to 1
// electron.crashReporter.start()
var ipcServer = null
......@@ -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
}
......@@ -94,12 +99,12 @@ app.on('ready', function () {
// Check update every day
setInterval(function () {
checkUpdate()
if(!isDev) checkUpdate()
}, 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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册