Browse Source

register shortcuts in the middleware

master
Radium Zheng 7 years ago
parent
commit
cc38fcc5d0

+ 0
- 14
react/features/local-recording/components/LocalRecordingButton.js View File

@@ -81,20 +81,6 @@ class LocalRecordingButton extends Component<Props> {
81 81
     _onClick() {
82 82
         this.props.onClick();
83 83
     }
84
-
85
-    _onCloseDialog: () => void;
86
-
87
-    /**
88
-     * Callback invoked when {@code InlineDialog} signals that it should be
89
-     * close.
90
-     *
91
-     * @returns {void}
92
-     */
93
-    _onCloseDialog() {
94
-        // Do nothing for now, because we want the dialog to stay open
95
-        // after certain time, otherwise the moderator might need to repeatly
96
-        // open the dialog to see the stats.
97
-    }
98 84
 }
99 85
 
100 86
 export default translate(LocalRecordingButton);

+ 12
- 0
react/features/local-recording/middleware.js View File

@@ -2,13 +2,17 @@
2 2
 
3 3
 import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../base/app';
4 4
 import { CONFERENCE_JOINED } from '../base/conference';
5
+import { toggleDialog } from '../base/dialog';
5 6
 import { i18next } from '../base/i18n';
6 7
 import { MiddlewareRegistry } from '../base/redux';
7 8
 import { showNotification } from '../notifications';
8 9
 
9 10
 import { localRecordingEngaged, localRecordingUnengaged } from './actions';
11
+import { LocalRecordingInfoDialog } from './components';
10 12
 import { recordingController } from './controller';
11 13
 
14
+declare var APP: Object;
15
+
12 16
 MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
13 17
     const result = next(action);
14 18
 
@@ -45,6 +49,14 @@ MiddlewareRegistry.register(({ getState, dispatch }) => next => action => {
45 49
                 description: i18next.t(messageKey, messageParams)
46 50
             }, 10000));
47 51
         };
52
+
53
+        // register shortcut
54
+        APP.keyboardshortcut.registerShortcut(
55
+            'L',
56
+            null,
57
+            () => dispatch(toggleDialog(LocalRecordingInfoDialog)),
58
+            'keyboardShortcuts.localRecording'
59
+        );
48 60
         break;
49 61
     case APP_WILL_UNMOUNT:
50 62
         recordingController.onStateChanged = null;

+ 8
- 13
react/features/toolbox/components/web/Toolbox.js View File

@@ -237,8 +237,8 @@ class Toolbox extends Component<Props> {
237 237
             = this._onToolbarToggleScreenshare.bind(this);
238 238
         this._onToolbarToggleSharedVideo
239 239
             = this._onToolbarToggleSharedVideo.bind(this);
240
-        this._onToolbarToggleLocalRecordingInfoDialog
241
-            = this._onToolbarToggleLocalRecordingInfoDialog.bind(this);
240
+        this._onToolbarOpenLocalRecordingInfoDialog
241
+            = this._onToolbarOpenLocalRecordingInfoDialog.bind(this);
242 242
     }
243 243
 
244 244
     /**
@@ -268,11 +268,6 @@ class Toolbox extends Component<Props> {
268 268
                 character: 'S',
269 269
                 exec: this._onShortcutToggleFullScreen,
270 270
                 helpDescription: 'keyboardShortcuts.fullScreen'
271
-            },
272
-            this._shouldShowButton('localrecording') && {
273
-                character: 'L',
274
-                exec: this._onToolbarToggleLocalRecordingInfoDialog,
275
-                helpDescription: 'keyboardShortcuts.localRecording'
276 271
             }
277 272
         ];
278 273
 
@@ -388,10 +383,8 @@ class Toolbox extends Component<Props> {
388 383
                 <div className = 'button-group-right'>
389 384
                     { this._shouldShowButton('localrecording')
390 385
                         && <LocalRecordingButton
391
-                            isDialogShown =
392
-                                { this.props._localRecState.showDialog }
393 386
                             onClick = {
394
-                                this._onToolbarToggleLocalRecordingInfoDialog
387
+                                this._onToolbarOpenLocalRecordingInfoDialog
395 388
                             } />
396 389
                     }
397 390
                     { this._shouldShowButton('invite')
@@ -864,15 +857,17 @@ class Toolbox extends Component<Props> {
864 857
         this._doToggleSharedVideo();
865 858
     }
866 859
 
867
-    _onToolbarToggleLocalRecordingInfoDialog: () => void;
860
+    _onToolbarOpenLocalRecordingInfoDialog: () => void;
868 861
 
869 862
     /**
870
-     * Switches local recording on or off.
863
+     * Opens the {@code LocalRecordingInfoDialog}.
871 864
      *
872 865
      * @private
873 866
      * @returns {void}
874 867
      */
875
-    _onToolbarToggleLocalRecordingInfoDialog() {
868
+    _onToolbarOpenLocalRecordingInfoDialog() {
869
+        sendAnalytics(createToolbarEvent('local.recording'));
870
+
876 871
         this.props.dispatch(openDialog(LocalRecordingInfoDialog));
877 872
     }
878 873
 

Loading…
Cancel
Save