added force quit for instant updating

This commit is contained in:
mrvnklm
2020-05-20 13:14:26 +02:00
parent 1e290211ce
commit 634ab476a3
2 changed files with 4 additions and 3 deletions

5
app.js
View File

@@ -4,8 +4,6 @@ const AutoLaunch = require('auto-launch');
const Positioner = require('electron-traywindow-positioner'); const Positioner = require('electron-traywindow-positioner');
const Store = require('electron-store'); const Store = require('electron-store');
const indexFile = `file://${__dirname}/web/index.html`;
app.allowRendererProcessReuse = true; app.allowRendererProcessReuse = true;
// prevent multiple instances // prevent multiple instances
@@ -23,9 +21,11 @@ if (process.platform === 'darwin') app.dock.hide();
const store = new Store(); const store = new Store();
const autoLauncher = new AutoLaunch({name: 'Home Assistant Desktop'}); const autoLauncher = new AutoLaunch({name: 'Home Assistant Desktop'});
const indexFile = `file://${__dirname}/web/index.html`;
let autostartEnabled = false; let autostartEnabled = false;
let forceQuit = false; let forceQuit = false;
const useAutoUpdater = () => { const useAutoUpdater = () => {
autoUpdater.on('error', message => { autoUpdater.on('error', message => {
console.error('There was a problem updating the application'); console.error('There was a problem updating the application');
@@ -33,6 +33,7 @@ const useAutoUpdater = () => {
}); });
autoUpdater.on('update-downloaded', () => { autoUpdater.on('update-downloaded', () => {
forceQuit = true;
autoUpdater.quitAndInstall(); autoUpdater.quitAndInstall();
}); });

View File

@@ -4,7 +4,7 @@
"type": "git", "type": "git",
"url": "https://github.com/mrvnklm/homeassistant-desktop" "url": "https://github.com/mrvnklm/homeassistant-desktop"
}, },
"version": "1.2.0", "version": "1.2.1",
"description": "Desktop App (Windows / macOS) for Home Assistant built with Electron", "description": "Desktop App (Windows / macOS) for Home Assistant built with Electron",
"main": "app.js", "main": "app.js",
"scripts": { "scripts": {