feat(shortcuts): add shortcut for opening video quality modal

This commit is contained in:
Leonard Kim 2019-07-28 08:36:11 -07:00 committed by virtuacoplenny
parent a5fc62b920
commit 6bc1d87753
2 changed files with 37 additions and 4 deletions

View File

@ -343,7 +343,8 @@
"toggleFilmstrip": "Show or hide video thumbnails", "toggleFilmstrip": "Show or hide video thumbnails",
"toggleScreensharing": "Switch between camera and screen sharing", "toggleScreensharing": "Switch between camera and screen sharing",
"toggleShortcuts": "Show or hide keyboard shortcuts", "toggleShortcuts": "Show or hide keyboard shortcuts",
"videoMute": "Start or stop your camera" "videoMute": "Start or stop your camera",
"videoQuality": "Manage call quality"
}, },
"liveStreaming": { "liveStreaming": {
"busy": "We're working on freeing streaming resources. Please try again in a few minutes.", "busy": "We're working on freeing streaming resources. Please try again in a few minutes.",

View File

@ -8,7 +8,7 @@ import {
createToolbarEvent, createToolbarEvent,
sendAnalytics sendAnalytics
} from '../../../analytics'; } from '../../../analytics';
import { openDialog } from '../../../base/dialog'; import { openDialog, toggleDialog } from '../../../base/dialog';
import { translate } from '../../../base/i18n'; import { translate } from '../../../base/i18n';
import { import {
getLocalParticipant, getLocalParticipant,
@ -221,6 +221,8 @@ class Toolbox extends Component<Props, State> {
= this._onShortcutToggleRaiseHand.bind(this); = this._onShortcutToggleRaiseHand.bind(this);
this._onShortcutToggleScreenshare this._onShortcutToggleScreenshare
= this._onShortcutToggleScreenshare.bind(this); = this._onShortcutToggleScreenshare.bind(this);
this._onShortcutToggleVideoQuality
= this._onShortcutToggleVideoQuality.bind(this);
this._onToolbarOpenFeedback this._onToolbarOpenFeedback
= this._onToolbarOpenFeedback.bind(this); = this._onToolbarOpenFeedback.bind(this);
this._onToolbarOpenInvite = this._onToolbarOpenInvite.bind(this); this._onToolbarOpenInvite = this._onToolbarOpenInvite.bind(this);
@ -259,6 +261,11 @@ class Toolbox extends Component<Props, State> {
*/ */
componentDidMount() { componentDidMount() {
const KEYBOARD_SHORTCUTS = [ const KEYBOARD_SHORTCUTS = [
this._shouldShowButton('videoquality') && {
character: 'A',
exec: this._onShortcutToggleVideoQuality,
helpDescription: 'keyboardShortcuts.videoQuality'
},
this._shouldShowButton('chat') && { this._shouldShowButton('chat') && {
character: 'C', character: 'C',
exec: this._onShortcutToggleChat, exec: this._onShortcutToggleChat,
@ -320,7 +327,7 @@ class Toolbox extends Component<Props, State> {
* @returns {void} * @returns {void}
*/ */
componentWillUnmount() { componentWillUnmount() {
[ 'C', 'D', 'R', 'S' ].forEach(letter => [ 'A', 'C', 'D', 'R', 'S' ].forEach(letter =>
APP.keyboardshortcut.unregisterShortcut(letter)); APP.keyboardshortcut.unregisterShortcut(letter));
window.removeEventListener('resize', this._onResize); window.removeEventListener('resize', this._onResize);
@ -384,7 +391,7 @@ class Toolbox extends Component<Props, State> {
} }
/** /**
* Dispatches an action to toggle the video quality dialog. * Dispatches an action to open the video quality dialog.
* *
* @private * @private
* @returns {void} * @returns {void}
@ -479,6 +486,16 @@ class Toolbox extends Component<Props, State> {
this.props.dispatch(toggleSharedVideo()); this.props.dispatch(toggleSharedVideo());
} }
/**
* Dispatches an action to toggle the video quality dialog.
*
* @private
* @returns {void}
*/
_doToggleVideoQuality() {
this.props.dispatch(toggleDialog(VideoQualityDialog));
}
_onMouseOut: () => void; _onMouseOut: () => void;
/** /**
@ -554,6 +571,21 @@ class Toolbox extends Component<Props, State> {
this._doToggleChat(); this._doToggleChat();
} }
_onShortcutToggleVideoQuality: () => void;
/**
* Creates an analytics keyboard shortcut event and dispatches an action for
* toggling the display of Video Quality.
*
* @private
* @returns {void}
*/
_onShortcutToggleVideoQuality() {
sendAnalytics(createShortcutEvent('video.quality'));
this._doToggleVideoQuality();
}
_onShortcutToggleFullScreen: () => void; _onShortcutToggleFullScreen: () => void;
/** /**