register shortcuts in the middleware

This commit is contained in:
Radium Zheng 2018-07-19 08:12:25 +10:00
parent a277421ecb
commit cc38fcc5d0
3 changed files with 20 additions and 27 deletions

View File

@ -81,20 +81,6 @@ class LocalRecordingButton extends Component<Props> {
_onClick() {
this.props.onClick();
}
_onCloseDialog: () => void;
/**
* Callback invoked when {@code InlineDialog} signals that it should be
* close.
*
* @returns {void}
*/
_onCloseDialog() {
// Do nothing for now, because we want the dialog to stay open
// after certain time, otherwise the moderator might need to repeatly
// open the dialog to see the stats.
}
}
export default translate(LocalRecordingButton);

View File

@ -2,13 +2,17 @@
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
import { CONFERENCE_JOINED } from '../base/conference';
import { toggleDialog } from '../base/dialog';
import { i18next } from '../base/i18n';
import { MiddlewareRegistry } from '../base/redux';
import { showNotification } from '../notifications';
import { localRecordingEngaged, localRecordingUnengaged } from './actions';
import { LocalRecordingInfoDialog } from './components';
import { recordingController } from './controller';
declare var APP: Object;
MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
const result = next(action);
@ -45,6 +49,14 @@ MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
description: i18next.t(messageKey, messageParams)
}, 10000));
};
// register shortcut
APP.keyboardshortcut.registerShortcut(
'L',
null,
() => dispatch(toggleDialog(LocalRecordingInfoDialog)),
'keyboardShortcuts.localRecording'
);
break;
case APP_WILL_UNMOUNT:
recordingController.onStateChanged = null;

View File

@ -237,8 +237,8 @@ class Toolbox extends Component<Props> {
= this._onToolbarToggleScreenshare.bind(this);
this._onToolbarToggleSharedVideo
= this._onToolbarToggleSharedVideo.bind(this);
this._onToolbarToggleLocalRecordingInfoDialog
= this._onToolbarToggleLocalRecordingInfoDialog.bind(this);
this._onToolbarOpenLocalRecordingInfoDialog
= this._onToolbarOpenLocalRecordingInfoDialog.bind(this);
}
/**
@ -268,11 +268,6 @@ class Toolbox extends Component<Props> {
character: 'S',
exec: this._onShortcutToggleFullScreen,
helpDescription: 'keyboardShortcuts.fullScreen'
},
this._shouldShowButton('localrecording') && {
character: 'L',
exec: this._onToolbarToggleLocalRecordingInfoDialog,
helpDescription: 'keyboardShortcuts.localRecording'
}
];
@ -388,10 +383,8 @@ class Toolbox extends Component<Props> {
<div className = 'button-group-right'>
{ this._shouldShowButton('localrecording')
&& <LocalRecordingButton
isDialogShown =
{ this.props._localRecState.showDialog }
onClick = {
this._onToolbarToggleLocalRecordingInfoDialog
this._onToolbarOpenLocalRecordingInfoDialog
} />
}
{ this._shouldShowButton('invite')
@ -864,15 +857,17 @@ class Toolbox extends Component<Props> {
this._doToggleSharedVideo();
}
_onToolbarToggleLocalRecordingInfoDialog: () => void;
_onToolbarOpenLocalRecordingInfoDialog: () => void;
/**
* Switches local recording on or off.
* Opens the {@code LocalRecordingInfoDialog}.
*
* @private
* @returns {void}
*/
_onToolbarToggleLocalRecordingInfoDialog() {
_onToolbarOpenLocalRecordingInfoDialog() {
sendAnalytics(createToolbarEvent('local.recording'));
this.props.dispatch(openDialog(LocalRecordingInfoDialog));
}