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

View File

@@ -60,19 +60,7 @@ if (console.debug) {
};
}
const isSecondInstance = app.makeSingleInstance(function (commandLine, workingDirectory) {
// 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();
}
const isSecondInstance = !app.requestSingleInstanceLock();
function createWindow() {
if (isSecondInstance) {
@@ -157,29 +145,43 @@ function createWindow() {
win.on('move', () => saveWindowState(win));
}
if (isSecondInstance) {
app.quit();
} else {
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);
app.on('ready', createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', () => {
if (appUpdateService) {
appUpdateService.saveFirtsRun();
}
app.exit();
});
app.on('window-all-closed', () => {
if (appUpdateService) {
appUpdateService.saveFirtsRun();
}
app.exit();
});
app.on('will-quit', () => {
});
app.on('will-quit', () => {
});
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow();
}
});
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow();
}
});
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
// code. You can also put them in separate files and require them here

View File

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