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

Merge v4.12.0 release into main branch #2240

Merged
merged 14 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,22 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

## v4.12.0 - 2021 - 3 - 04
## Added
- [client/main] Added UI to open bot dialog that allows the user to set transcript testing properties `randomSeed` and `randomValue` in PR [2209](https://github.com/microsoft/BotFramework-Emulator/pull/2209)
- [client] Added a dialog to the "Conversation -> Send System Activity" menu that allows the user to send custom activity payloads to their bot in PR [2213](https://github.com/microsoft/BotFramework-Emulator/pull/2213)
- [main] Bumped `electron` from `4.1.1` to `11.0.1` in PR [2226](https://github.com/microsoft/BotFramework-Emulator/pull/2226)
- [main] Bumped `electron-builder` to `22.9.1` and `electron-updater` to `4.3.5` to fix the Mac build in PR [2230](https://github.com/microsoft/BotFramework-Emulator/pull/2230)
- [client] Re-enabled the `<webview>` tag in the client so that the inspectors show again in PR [2233](https://github.com/microsoft/BotFramework-Emulator/pull/2233)
- [client] Bumped `botframework-webchat` to v4.12.0 and fixed various Web Chat-related bugs in PR [2236](https://github.com/microsoft/BotFramework-Emulator/pull/2236)

## Fixed
- [client] Re-enabled the `<webview>` tag in the client so that the inspectors show again in PR [2233](https://github.com/microsoft/BotFramework-Emulator/pull/2233)
- [main] Fixed a bug where we were expecting the incorrect shape from Electron's updated `dialog.showOpenDialog()` API in PR [2237](https://github.com/microsoft/BotFramework-Emulator/pull/2237)
- [main] Fixed a bug that was causing Electron's native context menu to silently fail when selecting an option in PR [2238](https://github.com/microsoft/BotFramework-Emulator/pull/2238)
- [client] Fixed an aligment issue with the caret button of the `<SplitButton />` widget in PR [2239](https://github.com/microsoft/BotFramework-Emulator/pull/2239)
- [main] Fixed an outdated path to an `electron-builder` utility function used to generate the auto update yaml files in PR [2240](https://github.com/microsoft/BotFramework-Emulator/pull/2240)

## v4.11.0 - 2020 - 11 - 05
- [client] Moved from master to main as the default branch. [2194](https://github.com/microsoft/BotFramework-Emulator/pull/2194)
- [client] Updated support for new activity middleware contract provided by Web Chat. [2202](https://github.com/microsoft/BotFramework-Emulator/pull/2202)
Expand Down
2 changes: 1 addition & 1 deletion packages/app/main/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@bfemulator/main",
"packagename": "BotFramework-Emulator",
"version": "4.11.0",
"version": "4.12.0",
"private": true,
"description": "Development tool for the Microsoft Bot Framework. Allows developers to test and debug bots on localhost.",
"main": "./app/server/main.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/app/main/scripts/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

/** Hashes a file asynchronously */
function hashFileAsync(filename, algo = 'sha512', encoding = 'base64') {
var builderUtil = require('builder-util');
var builderUtil = require('app-builder-lib/out/util/hash');
return builderUtil.hashFile(filename, algo, encoding);
}

module.exports = {
hashFileAsync
hashFileAsync,
};
2 changes: 1 addition & 1 deletion packages/app/main/src/commands/electronCommands.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jest.mock('electron', () => ({
dialog: {
showMessageBox: (mainBrowserWindow: any, p: { buttons: string[]; type: string; title: string; message: string }) =>
void 0,
showOpenDialog: () => void 0,
showOpenDialog: () => ({ filePaths: [] }),
showSaveDialogSync: () => void 0,
},
shell: {
Expand Down
2 changes: 1 addition & 1 deletion packages/app/main/src/commands/electronCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class ElectronCommands {
// ---------------------------------------------------------------------------
// Shows an open dialog and returns a path
@Command(Commands.ShowOpenDialog)
protected showOpenDialog(dialogOptions: Electron.OpenDialogOptions = {}): false | string {
protected showOpenDialog(dialogOptions: Electron.OpenDialogOptions = {}): Promise<string> {
return showOpenDialog(emulatorApplication.mainWindow.browserWindow, dialogOptions);
}

Expand Down
12 changes: 8 additions & 4 deletions packages/app/main/src/services/contextMenuService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,24 @@
import { Menu, MenuItem, MenuItemConstructorOptions, BrowserWindow } from 'electron';
import { ContextMenuCoordinates } from '@bfemulator/app-shared';

type ContextMenuResult = {
id: string;
};

export class ContextMenuService {
private static currentMenu: Menu;

public static showMenuAndWaitForInput(
options: Partial<MenuItemConstructorOptions>[] = [],
menuCoords?: ContextMenuCoordinates
): Promise<MenuItem> {
): Promise<ContextMenuResult> {
if (ContextMenuService.currentMenu) {
ContextMenuService.currentMenu.closePopup();
}
return new Promise(resolve => {
const clickHandler = menuItem => {
return new Promise<ContextMenuResult>(resolve => {
const clickHandler = (menuItem: MenuItem) => {
ContextMenuService.currentMenu = null;
resolve(menuItem);
resolve({ id: menuItem.id });
};

const template = options.map(option => {
Expand Down
56 changes: 56 additions & 0 deletions packages/app/main/src/utils/showOpenDialog.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license.
//
// Microsoft Bot Framework: http://botframework.com
//
// Bot Framework Emulator Github:
// https://github.com/Microsoft/BotFramwork-Emulator
//
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// MIT License:
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

import { showOpenDialog } from './showOpenDialog';

const mockShowOpenDialog = jest.fn().mockResolvedValue({ filePaths: [] });
jest.mock('electron', () => ({
dialog: {
showOpenDialog: async (...args) => mockShowOpenDialog(...args),
},
}));

describe('showOpenDialog', () => {
it('should return an empty string if nothing was selected', async () => {
const filePath = await showOpenDialog(undefined, undefined);

expect(filePath).toBe('');
});

it('should return the selected file path', async () => {
mockShowOpenDialog.mockResolvedValueOnce({ filePaths: ['someFile'] });
const filePath = await showOpenDialog(undefined, undefined);

expect(filePath).toBe('someFile');
});
});
6 changes: 3 additions & 3 deletions packages/app/main/src/utils/showOpenDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import { BrowserWindow, dialog, OpenDialogOptions } from 'electron';

/** Shows a native open file / directory dialog */
export const showOpenDialog = (window: BrowserWindow, options: OpenDialogOptions): false | string => {
const filePaths = dialog.showOpenDialog(window, options);
return filePaths && filePaths[0];
export const showOpenDialog = async (window: BrowserWindow, options: OpenDialogOptions): Promise<string> => {
const { filePaths = [] } = await dialog.showOpenDialog(window, options);
return filePaths[0] || '';
};
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@

&:before {
display: inline-block;
height: 7px;
height: 11px;
width: 9px;
-webkit-mask-size: 9px;
-webkit-mask: url('../../media/ic_chevron_up.svg');
Expand Down