Back out "Back out Electron 7.1.1/7.1.2 upgrades"

Summary:
Original commit changeset: 05d13aca7145

Attempt to upgrade `electron` as it instacrashed; `electron-builder` version 22.1.0 didn't sign package correctly and caused the instacrash,

Reduced the version to 21.2.0 (latest).

Reviewed By: passy, nikoant

Differential Revision: D18954671

fbshipit-source-id: bc2dbd4fec9afb51d9a535974651b13d195407b4
This commit is contained in:
Chaiwat Ekkaewnumchai
2020-01-06 09:42:46 -08:00
committed by Facebook Github Bot
parent 2fac06e018
commit bacb1958fc
11 changed files with 351 additions and 564 deletions

View File

@@ -724,8 +724,9 @@ export function showOpenDialog(store: Store) {
properties: ['openFile'],
filters: [{extensions: ['flipper', 'json', 'txt'], name: 'Flipper files'}],
};
remote.dialog.showOpenDialog(options, (filePaths?: Array<string>) => {
if (filePaths !== undefined && filePaths.length > 0) {
remote.dialog.showOpenDialog(options).then(result => {
const filePaths = result.filePaths;
if (filePaths.length > 0) {
tryCatchReportPlatformFailures(() => {
importFileToStore(filePaths[0], store);
}, `${IMPORT_FLIPPER_TRACE_EVENT}:UI`);
@@ -734,14 +735,17 @@ export function showOpenDialog(store: Store) {
}
export function startFileExport(dispatch: Store['dispatch']) {
electron.remote.dialog.showSaveDialog(
// @ts-ignore This appears to work but isn't allowed by the types
null,
{
title: 'FlipperExport',
defaultPath: path.join(os.homedir(), 'FlipperExport.flipper'),
},
async (file: string) => {
electron.remote.dialog
.showSaveDialog(
// @ts-ignore This appears to work but isn't allowed by the types
null,
{
title: 'FlipperExport',
defaultPath: path.join(os.homedir(), 'FlipperExport.flipper'),
},
)
.then(async (result: electron.SaveDialogReturnValue) => {
const file = result.filePath;
if (!file) {
return;
}
@@ -752,8 +756,7 @@ export function startFileExport(dispatch: Store['dispatch']) {
closeOnFinish: false,
}),
);
},
);
});
}
export function startLinkExport(dispatch: Store['dispatch']) {

View File

@@ -9,7 +9,7 @@
import Client, {ClientQuery} from '../../Client';
import {FlipperClientConnection} from '../../Client';
import {ipcRenderer, remote} from 'electron';
import {ipcRenderer, remote, IpcRendererEvent} from 'electron';
import JSDevice from '../../devices/JSDevice';
import {Store} from 'src/reducers';
import {Logger} from 'src/fb-interfaces/Logger';
@@ -41,7 +41,7 @@ export function initJsEmulatorIPC(
) {
ipcRenderer.on(
'from-js-emulator-init-client',
(_event: string, message: any) => {
(_event: IpcRendererEvent, message: any) => {
const {windowId} = message;
const {plugins, appName} = message.payload;
store.dispatch({
@@ -102,21 +102,24 @@ export function initJsEmulatorIPC(
flipperServer.emit('clients-change');
client.emit('plugins-change');
ipcRenderer.on('from-js-emulator', (_event: string, message: any) => {
const {command, payload} = message;
if (command === 'sendFlipperObject') {
client.onMessage(
JSON.stringify({
params: {
api: payload.api,
method: payload.method,
params: JSON.parse(payload.params),
},
method: 'execute',
}),
);
}
});
ipcRenderer.on(
'from-js-emulator',
(_event: IpcRendererEvent, message: any) => {
const {command, payload} = message;
if (command === 'sendFlipperObject') {
client.onMessage(
JSON.stringify({
params: {
api: payload.api,
method: payload.method,
params: JSON.parse(payload.params),
},
method: 'execute',
}),
);
}
},
);
});
},
);