chore: upgrade electron => 3.1.10 (#958)

This commit is contained in:
Róbert Kiss
2019-05-30 01:35:18 +02:00
committed by László Monda
parent 82c9126d82
commit c64515885b
7 changed files with 440 additions and 210 deletions

2
.nvmrc
View File

@@ -1 +1 @@
8.12.0 10.2.1

View File

@@ -45,6 +45,7 @@ addons:
install: install:
- nvm install - nvm install
- npm install -g npm@6.4.0
- npm install - npm install
before_script: before_script:

View File

@@ -7,7 +7,7 @@ environment:
secure: 3IebpEKmC39codi1wT6dXx8mql4/mCL1JzZ7lir7GQ5MWRnCxlED2OXbiKHHigDV secure: 3IebpEKmC39codi1wT6dXx8mql4/mCL1JzZ7lir7GQ5MWRnCxlED2OXbiKHHigDV
CSC_LINK: c:\projects\uhk-agent\scripts\certs\windows-cert.p12 CSC_LINK: c:\projects\uhk-agent\scripts\certs\windows-cert.p12
matrix: matrix:
- nodejs_version: "8" - nodejs_version: "10.2.1"
cache: cache:
- node_modules -> package.json - node_modules -> package.json
@@ -24,6 +24,7 @@ install:
- choco install chromium - choco install chromium
- set CI=true - set CI=true
- set PATH=%APPDATA%\npm;%PATH% - set PATH=%APPDATA%\npm;%PATH%
- npm install -g npm@6.4.0
- node -v - node -v
- npm -v - npm -v
- appveyor-retry npm install - appveyor-retry npm install

569
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -15,7 +15,7 @@
}, },
"license": "GPL-3.0", "license": "GPL-3.0",
"engines": { "engines": {
"node": ">=8.12.0 <9.0.0", "node": ">=10.2.1 <11.0.0",
"npm": ">=6.4.0 <7.0.0" "npm": ">=6.4.0 <7.0.0"
}, },
"devDependencies": { "devDependencies": {
@@ -41,12 +41,12 @@
"decompress": "4.2.0", "decompress": "4.2.0",
"decompress-tarbz2": "4.1.1", "decompress-tarbz2": "4.1.1",
"devtron": "1.4.0", "devtron": "1.4.0",
"electron": "2.0.16", "electron": "3.1.10",
"electron-builder": "20.34.0", "electron-builder": "20.34.0",
"electron-debug": "1.5.0", "electron-debug": "1.5.0",
"electron-devtools-installer": "2.2.3", "electron-devtools-installer": "2.2.3",
"electron-log": "2.2.16", "electron-log": "2.2.16",
"electron-rebuild": "1.8.2", "electron-rebuild": "1.8.5",
"electron-settings": "3.1.4", "electron-settings": "3.1.4",
"electron-updater": "2.21.4", "electron-updater": "2.21.4",
"exports-loader": "0.6.3", "exports-loader": "0.6.3",
@@ -100,6 +100,5 @@
"clean": "lerna exec rimraf ./node_modules ./dist && rimraf ./node_modules ./dist ./tmp", "clean": "lerna exec rimraf ./node_modules ./dist && rimraf ./node_modules ./dist ./tmp",
"predeploy-gh-pages": "lerna run build:web --scope=uhk-web", "predeploy-gh-pages": "lerna run build:web --scope=uhk-web",
"deploy-gh-pages": "gh-pages -d packages/uhk-web/dist" "deploy-gh-pages": "gh-pages -d packages/uhk-web/dist"
}, }
"dependencies": {}
} }

View File

@@ -60,19 +60,7 @@ if (console.debug) {
}; };
} }
const isSecondInstance = app.makeSingleInstance(function (commandLine, workingDirectory) { const isSecondInstance = !app.requestSingleInstanceLock();
// Someone tried to run a second instance, we should focus our window.
if (win) {
if (win.isMinimized()) {
win.restore();
}
win.focus();
}
});
if (isSecondInstance) {
app.quit();
}
function createWindow() { function createWindow() {
if (isSecondInstance) { if (isSecondInstance) {
@@ -157,6 +145,10 @@ function createWindow() {
win.on('move', () => saveWindowState(win)); win.on('move', () => saveWindowState(win));
} }
if (isSecondInstance) {
app.quit();
} else {
// This method will be called when Electron has finished // This method will be called when Electron has finished
// initialization and is ready to create browser windows. // initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs. // Some APIs can only be used after this event occurs.
@@ -181,5 +173,15 @@ app.on('activate', () => {
} }
}); });
app.on('second-instance', () => {
// Someone tried to run a second instance, we should focus our window.
if (win) {
if (win.isMinimized()) {
win.restore();
}
win.focus();
}
});
}
// In this file you can include the rest of your app's specific main process // In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here // code. You can also put them in separate files and require them here

View File

@@ -14,9 +14,7 @@ import {
UpdateFirmwareData UpdateFirmwareData
} from 'uhk-common'; } from 'uhk-common';
import { snooze, UhkHidDevice, UhkOperations } from 'uhk-usb'; import { snooze, UhkHidDevice, UhkOperations } from 'uhk-usb';
import { Subscription } from 'rxjs'; import { Subscription, interval, from } from 'rxjs';
import { interval } from 'rxjs/observable/interval';
import { fromPromise } from 'rxjs/observable/fromPromise';
import { distinctUntilChanged, startWith, switchMap, tap } from 'rxjs/operators'; import { distinctUntilChanged, startWith, switchMap, tap } from 'rxjs/operators';
import { emptyDir } from 'fs-extra'; import { emptyDir } from 'fs-extra';
import * as path from 'path'; import * as path from 'path';
@@ -252,7 +250,7 @@ export class DeviceService {
this.pollTimer$ = interval(1000) this.pollTimer$ = interval(1000)
.pipe( .pipe(
startWith(0), startWith(0),
switchMap(() => fromPromise(this.device.getDeviceConnectionStateAsync())), switchMap(() => from(this.device.getDeviceConnectionStateAsync())),
distinctUntilChanged<DeviceConnectionState>(isEqual), distinctUntilChanged<DeviceConnectionState>(isEqual),
tap((state: DeviceConnectionState) => { tap((state: DeviceConnectionState) => {
this.win.webContents.send(IpcEvents.device.deviceConnectionStateChanged, state); this.win.webContents.send(IpcEvents.device.deviceConnectionStateChanged, state);