Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumped Electron from 4.1.1 to 11.0.1 #2226

Merged
merged 9 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34,919 changes: 16,484 additions & 18,435 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@
},
"dependencies": {
"lerna": "^3.14.1",
"keytar": "^4.7.0"
"keytar": "7.3.0"
}
}
2 changes: 1 addition & 1 deletion packages/app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"sass-loader": "^7.1.0",
"style-loader": "^0.21.0",
"terser-webpack-plugin": "2.3.3",
"typescript": "3.1.1",
"typescript": "4.1.3",
"typings-for-css-modules-loader": "^1.7.0",
"url-loader": "^1.0.1",
"webpack": "^4.32.2",
Expand Down
7 changes: 6 additions & 1 deletion packages/app/client/src/state/middleware/forwardToMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@ export const forwardToMain: Middleware = _store => next => action => {
if ((action as any).meta && (action as any).meta.doNotForward) {
return next(action);
}

// Electron 9 does not allow functions to be sent over ipc (https://www.electronjs.org/docs/api/ipc-renderer#ipcrenderersendchannel-args)
// JSON.stringify() removes function properties from objects -- these functions do not need to be maintained in the main process' copy of state
const processedAction = JSON.parse(JSON.stringify(action));

// forward the action over ipc to the main process
ipcRenderer.sendSync('sync-store', action);
ipcRenderer.sendSync('sync-store', processedAction);
return next(action);
};
10 changes: 5 additions & 5 deletions packages/app/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@
"concurrently": "^3.5.1",
"cross-env": "^5.1.3",
"del": "^3.0.0",
"electron": "4.1.1",
"electron": "11.0.1",
"electron-builder": "20.29.0",
"electron-builder-http": "19.27.5",
"electron-builder-lib": "20.23.1",
"electron-rebuild": "1.8.5",
"electron-rebuild": "2.3.4",
"eslint": "^5.12.0",
"eslint-config-prettier": "^3.5.0",
"eslint-plugin-import": "2.20.0",
Expand All @@ -119,7 +119,7 @@
"npm-run-all": "^4.1.5",
"spectron": "^6.0.0",
"through2": "^2.0.3",
"typescript": "3.1.1",
"typescript": "4.1.3",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0"
},
Expand Down Expand Up @@ -147,7 +147,7 @@
"https-proxy-agent": "2.2.3",
"jest-fetch-mock": "^1.6.2",
"jsonwebtoken": "^8.3.0",
"keytar": "^4.7.0",
"keytar": "7.3.0",
"mkdirp": "^0.5.1",
"moment": "^2.22.1",
"node-fetch": "^2.3.0",
Expand All @@ -170,7 +170,7 @@
"productName": "Bot Framework Emulator",
"copyright": "Copyright © 2018 Microsoft Corporation",
"electronDownload": {
"version": "4.1.1"
"version": "11.0.1"
},
"protocols": [
{
Expand Down
10 changes: 5 additions & 5 deletions packages/app/main/src/appMenuBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export class AppMenuBuilder {
{ role: 'services', submenu: [] },
{ type: 'separator' },
{ role: 'hide' },
{ role: 'hideothers' },
{ role: 'hideOthers' },
{ role: 'unhide' },
{ type: 'separator' },
{ role: 'quit' },
Expand Down Expand Up @@ -439,12 +439,12 @@ export class AppMenuBuilder {
label: 'View',
id: 'view',
submenu: [
{ role: 'resetzoom', label: 'Reset Zoom' },
{ role: 'zoomin' },
{ role: 'zoomout' },
{ role: 'resetZoom', label: 'Reset Zoom' },
{ role: 'zoomIn' },
{ role: 'zoomOut' },
{ type: 'separator' },
{ role: 'togglefullscreen' },
{ role: 'toggledevtools' },
{ role: 'toggleDevTools' },
],
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/app/main/src/commands/azureCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class AzureCommands {
// Sign the user out of Azure
@Command(Azure.SignUserOutOfAzure)
protected async signUserOutOfAzure(prompt: boolean = true) {
await new Promise(resolve => session.defaultSession.clearStorageData({}, resolve));
await session.defaultSession.clearStorageData({});

store.dispatch(azureLoggedInUserChanged(''));
try {
Expand Down
9 changes: 7 additions & 2 deletions packages/app/main/src/commands/electronCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,14 @@ export class ElectronCommands {
// ---------------------------------------------------------------------------
// Opens and item on the disk in Explorer (win) or Finder (mac)
@Command(Commands.OpenFileLocation)
protected openFileLocation(filePath: string): boolean {
protected async openFileLocation(filePath: string): Promise<boolean> {
const parts = path.parse(filePath);
return shell.openItem(path.resolve(parts.dir));
const err = await shell.openPath(path.resolve(parts.dir));
if (!err) {
// success
return true;
}
return false;
}

// ---------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion packages/app/main/src/commands/emulatorCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export class EmulatorCommands {
message: 'You have successfully cleared state.',
title: 'Success!',
});
await new Promise(resolve => session.defaultSession.clearStorageData({}, resolve));
await session.defaultSession.clearStorageData({});
}

return true;
Expand Down
14 changes: 10 additions & 4 deletions packages/app/main/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import {
TunnelInfo,
TunnelStatus,
} from '@bfemulator/app-shared';
import { app, BrowserWindow, Rectangle, screen, systemPreferences } from 'electron';
import { app, BrowserWindow, nativeTheme, Rectangle, screen } from 'electron';
import { CommandServiceImpl, CommandServiceInstance } from '@bfemulator/sdk-shared';

import { AppUpdater } from './appUpdater';
Expand Down Expand Up @@ -177,7 +177,7 @@ class EmulatorApplication {
}

private initializeSystemPreferencesListeners() {
systemPreferences.on('inverted-color-scheme-changed', this.onInvertedColorSchemeChanged);
nativeTheme.on('updated', this.onInvertedColorSchemeChanged);
}

private initializeAppListeners() {
Expand Down Expand Up @@ -293,7 +293,7 @@ class EmulatorApplication {
const { theme, availableThemes } = getSettings().windowState;
const themeInfo = availableThemes.find(availableTheme => availableTheme.name === theme);

const isHighContrast = systemPreferences.isInvertedColorScheme();
const isHighContrast = nativeTheme.shouldUseInvertedColorScheme;

const themeName = isHighContrast ? 'high-contrast' : themeInfo.name;
const themeComponents = isHighContrast ? path.join('.', 'themes', 'high-contrast.css') : themeInfo.href;
Expand All @@ -306,7 +306,13 @@ class EmulatorApplication {
if (this.mainBrowserWindow) {
return;
}
this.mainBrowserWindow = new BrowserWindow({ show: false, backgroundColor: '#f7f7f7', width: 1400, height: 920 });
this.mainBrowserWindow = new BrowserWindow({
show: false,
backgroundColor: '#f7f7f7',
width: 1400,
height: 920,
webPreferences: { enableRemoteModule: true, nodeIntegration: true },
});
this.initializeBrowserWindowListeners();

this.mainWindow = new Window(this.mainBrowserWindow);
Expand Down
2 changes: 1 addition & 1 deletion packages/app/main/src/server/state/botEndpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export class BotEndpoint {
client_secret: this.msaPassword,
scope: `${this.msaAppId}/.default`,
// flag to request a version 1.0 token
...(this.use10Tokens ? { atver: 1 } : {}),
...(this.use10Tokens ? { atver: '1' } : {}),
} as { [key: string]: string }).toString(),
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class AzureAuthWorkflowService {
webPreferences: { contextIsolation: true, nativeWindowOpen: true },
});

browserWindow.setMenu(null);
browserWindow.removeMenu();

const state = uuidv4();
const requestId = uuidv4();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ export const forwardToRenderer: Middleware = _store => next => action => {
if ((action as any).meta && (action as any).meta.doNotForward) {
return next(action);
}

// Electron 9 does not allow functions to be sent over ipc (https://www.electronjs.org/docs/api/web-contents#contentssendchannel-args)
// JSON.stringify() removes function properties from objects -- these functions do not need to be maintained in the client's copy of state
const processedAction = JSON.parse(JSON.stringify(action));

// forward the action over ipc to the client
emulatorApplication.mainBrowserWindow.webContents.send('sync-store', action);
emulatorApplication.mainBrowserWindow.webContents.send('sync-store', processedAction);
return next(action);
};
2 changes: 1 addition & 1 deletion packages/app/main/src/utils/showSaveDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ import { BrowserWindow, dialog, SaveDialogOptions } from 'electron';

/** Shows a native save dialog */
export const showSaveDialog = (window: BrowserWindow, options: SaveDialogOptions): string => {
return dialog.showSaveDialog(window, options);
return dialog.showSaveDialogSync(window, options);
};
2 changes: 1 addition & 1 deletion packages/app/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"eslint-plugin-typescript": "^1.0.0-rc.3",
"jest": "24.8.0",
"rimraf": "^2.6.2",
"typescript": "3.1.1"
"typescript": "4.1.3"
},
"dependencies": {
"@babel/runtime": "^7.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/extensions/json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"jest-enzyme": "^7.0.0",
"resolve-url-loader": "^2.3.0",
"sass-loader": "^7.1.0",
"typescript": "3.1.1",
"typescript": "4.1.3",
"typings-for-css-modules-loader": "^1.7.0",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/extensions/luis/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"jest": "24.8.0",
"resolve-url-loader": "^2.3.0",
"sass-loader": "^7.1.0",
"typescript": "3.1.1",
"typescript": "4.1.3",
"typings-for-css-modules-loader": "^1.7.0",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/extensions/qnamaker/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"sass-loader": "^7.1.0",
"style-loader": "^0.21.0",
"terser-webpack-plugin": "2.3.3",
"typescript": "3.1.1",
"typescript": "4.1.3",
"typings-for-css-modules-loader": "^1.7.0",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"prettier-eslint": "^8.8.2",
"prettier-eslint-cli": "5.0.0",
"rimraf": "^2.6.2",
"typescript": "3.1.1"
"typescript": "^4.1.3"
},
"dependencies": {
"@babel/runtime": "^7.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"prettier-eslint": "^8.8.2",
"prettier-eslint-cli": "5.0.0",
"rimraf": "^2.6.2",
"typescript": "3.1.1"
"typescript": "4.1.3"
},
"dependencies": {
"@babel/runtime": "^7.1.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/shared/src/command/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

import { EventEmitter } from 'electron';
import { EventEmitter } from 'events';

import { uniqueId } from '../utils';

Expand Down
3 changes: 2 additions & 1 deletion packages/sdk/shared/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"experimentalDecorators": true,
"lib": ["dom", "es2015.proxy", "es5", "esnext", "es7"],
"outDir": "build",
"target": "esnext"
"target": "esnext",
"skipLibCheck": true
},
"include": [
"./src"
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/ui-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"resolve-url-loader": "^2.3.0",
"rimraf": "^2.6.2",
"sass-loader": "^7.1.0",
"typescript": "3.1.1",
"typescript": "4.1.3",
"typings-for-css-modules-loader": "^1.7.0",
"url-loader": "^1.0.1",
"webpack": "^4.32.2",
Expand Down