Upgrade electron version

Summary:
CHANGELOG: Upgrade electron to 18.2.0.

In Electron 18.2.0 we no longer have access to `remote`. Instead, we are recommended to implement IPC communications. We re-implement `remote` methods used before as IPC commands. To support type-safe execution of the commands, we create electron IPC clients on both sides: the main process and renderer process. We also move the main menu creation to the main process and track its usage via sending IPC messages to the renderer process where the logging happens.

Reviewed By: mweststrate

Differential Revision: D36593625

fbshipit-source-id: 6dcf531461ef2edceb9cac372a650f84f3370953
This commit is contained in:
Andrey Goncharov
2022-05-31 06:52:14 -07:00
committed by Facebook GitHub Bot
parent 2fe7e73175
commit 92cdb81096
10 changed files with 2279 additions and 401 deletions

View File

@@ -32,6 +32,8 @@ import delegateToLauncher from './launcher';
import yargs from 'yargs';
import {promisify} from 'util';
import process from 'process';
import {setupMenuBar} from './setupMenuBar';
import {ElectronIpcClientMain} from './electronIpcMain';
const VERSION: string = (global as any).__VERSION__;
@@ -347,14 +349,12 @@ function createWindow(config: Config) {
? path.join(__dirname, 'icons/app_64x64.png')
: undefined,
webPreferences: {
enableRemoteModule: true,
backgroundThrottling: false,
webSecurity: false,
scrollBounce: true,
experimentalFeatures: true,
nodeIntegration: true,
webviewTag: true,
nativeWindowOpen: true,
contextIsolation: false,
},
});
@@ -410,6 +410,9 @@ function createWindow(config: Config) {
slashes: true,
});
win.loadURL(entryUrl);
const electronIpcClient = new ElectronIpcClientMain(win);
setupMenuBar(electronIpcClient);
}
function processConfig(config: Config) {