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() { _onClick() {
this.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); export default translate(LocalRecordingButton);

View File

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

View File

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