Pārlūkot izejas kodu

feat(toolbar-buttons): Add event for notify overwritten toolbar buttons

master
Horatiu Muresan 4 gadus atpakaļ
vecāks
revīzija
1add438a1f
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
38 mainītis faili ar 380 papildinājumiem un 74 dzēšanām
  1. 37
    0
      config.js
  2. 13
    0
      modules/API/API.js
  3. 2
    1
      modules/API/external/external_api.js
  4. 1
    0
      react/features/base/config/configWhitelist.js
  5. 8
    0
      react/features/base/toolbox/components/AbstractAudioMuteButton.js
  6. 5
    0
      react/features/base/toolbox/components/AbstractButton.js
  7. 8
    0
      react/features/base/toolbox/components/AbstractVideoMuteButton.js
  8. 7
    6
      react/features/chat/components/web/ChatButton.js
  9. 7
    1
      react/features/embed-meeting/components/EmbedMeetingButton.js
  10. 10
    2
      react/features/etherpad/components/SharedDocumentButton.js
  11. 7
    1
      react/features/feedback/components/FeedbackButton.web.js
  12. 7
    1
      react/features/invite/components/add-people-dialog/web/InviteButton.js
  13. 7
    1
      react/features/keyboard-shortcuts/components/KeyboardShortcutsButton.web.js
  14. 7
    1
      react/features/local-recording/components/LocalRecordingButton.web.js
  15. 7
    6
      react/features/participants-pane/components/ParticipantsPaneButton.js
  16. 7
    1
      react/features/recording/components/LiveStream/AbstractLiveStreamButton.js
  17. 7
    1
      react/features/recording/components/Recording/AbstractRecordButton.js
  18. 10
    2
      react/features/screen-share/components/ShareAudioButton.js
  19. 10
    2
      react/features/security/components/security-dialog/SecurityDialogButton.js
  20. 9
    1
      react/features/settings/components/web/SettingsButton.js
  21. 8
    0
      react/features/shared-video/components/web/SharedVideoButton.js
  22. 7
    1
      react/features/speaker-stats/components/SpeakerStatsButton.js
  23. 7
    1
      react/features/subtitles/components/AbstractClosedCaptionButton.js
  24. 9
    1
      react/features/toolbox/components/DownloadButton.js
  25. 9
    1
      react/features/toolbox/components/HelpButton.js
  26. 7
    1
      react/features/toolbox/components/MuteEveryoneButton.js
  27. 7
    1
      react/features/toolbox/components/MuteEveryonesVideoButton.js
  28. 30
    5
      react/features/toolbox/components/web/AudioSettingsButton.js
  29. 7
    6
      react/features/toolbox/components/web/FullscreenButton.js
  30. 7
    1
      react/features/toolbox/components/web/ProfileButton.js
  31. 7
    6
      react/features/toolbox/components/web/RaiseHandButton.js
  32. 7
    6
      react/features/toolbox/components/web/ShareDesktopButton.js
  33. 9
    1
      react/features/toolbox/components/web/ToggleCameraButton.js
  34. 30
    2
      react/features/toolbox/components/web/Toolbox.js
  35. 31
    6
      react/features/toolbox/components/web/VideoSettingsButton.js
  36. 8
    1
      react/features/video-layout/components/TileViewButton.js
  37. 7
    6
      react/features/video-quality/components/VideoQualityButton.web.js
  38. 7
    1
      react/features/virtual-background/components/VideoBackgroundButton.js

+ 37
- 0
config.js Parādīt failu

@@ -539,6 +539,43 @@ var config = {
539 539
     //    '__end'
540 540
     // ],
541 541
 
542
+    // Toolbar buttons which have their click event exposed through the API on
543
+    // `toolbarButtonClicked` event instead of executing the normal click routine.
544
+    // buttonsWithNotifyClick: [
545
+    //    'camera',
546
+    //    'chat',
547
+    //    'closedcaptions',
548
+    //    'desktop',
549
+    //    'download',
550
+    //    'embedmeeting',
551
+    //    'etherpad',
552
+    //    'feedback',
553
+    //    'filmstrip',
554
+    //    'fullscreen',
555
+    //    'hangup',
556
+    //    'help',
557
+    //    'invite',
558
+    //    'livestreaming',
559
+    //    'microphone',
560
+    //    'mute-everyone',
561
+    //    'mute-video-everyone',
562
+    //    'participants-pane',
563
+    //    'profile',
564
+    //    'raisehand',
565
+    //    'recording',
566
+    //    'security',
567
+    //    'select-background',
568
+    //    'settings',
569
+    //    'shareaudio',
570
+    //    'sharedvideo',
571
+    //    'shortcuts',
572
+    //    'stats',
573
+    //    'tileview',
574
+    //    'toggle-camera',
575
+    //    'videoquality',
576
+    //    '__end'
577
+    // ],
578
+
542 579
     // List of pre meeting screens buttons to hide. The values must be one or more of the 5 allowed buttons:
543 580
     // 'microphone', 'camera', 'select-background', 'invite', 'settings'
544 581
     // hiddenPremeetingButtons: [],

+ 13
- 0
modules/API/API.js Parādīt failu

@@ -1342,6 +1342,19 @@ class API {
1342 1342
         });
1343 1343
     }
1344 1344
 
1345
+    /**
1346
+     * Notify external application ( if API is enabled) that a toolbar button was clicked.
1347
+     *
1348
+     * @param {string} key - The key of the toolbar button.
1349
+     * @returns {void}
1350
+     */
1351
+    notifyToolbarButtonClicked(key: string) {
1352
+        this._sendEvent({
1353
+            name: 'toolbar-button-clicked',
1354
+            key
1355
+        });
1356
+    }
1357
+
1345 1358
     /**
1346 1359
      * Disposes the allocated resources.
1347 1360
      *

+ 2
- 1
modules/API/external/external_api.js Parādīt failu

@@ -112,7 +112,8 @@ const events = {
112 112
     'dominant-speaker-changed': 'dominantSpeakerChanged',
113 113
     'subject-change': 'subjectChange',
114 114
     'suspend-detected': 'suspendDetected',
115
-    'tile-view-changed': 'tileViewChanged'
115
+    'tile-view-changed': 'tileViewChanged',
116
+    'toolbar-button-clicked': 'toolbarButtonClicked'
116 117
 };
117 118
 
118 119
 /**

+ 1
- 0
react/features/base/config/configWhitelist.js Parādīt failu

@@ -19,6 +19,7 @@ export default [
19 19
     'apiLogLevels',
20 20
     'avgRtpStatsN',
21 21
     'backgroundAlpha',
22
+    'buttonsWithNotifyClick',
22 23
 
23 24
     /**
24 25
      * The display name of the CallKit call representing the conference/meeting

+ 8
- 0
react/features/base/toolbox/components/AbstractAudioMuteButton.js Parādīt failu

@@ -23,6 +23,14 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
23 23
      * @returns {void}
24 24
      */
25 25
     _handleClick() {
26
+        const { handleClick } = this.props;
27
+
28
+        if (handleClick) {
29
+            handleClick();
30
+
31
+            return;
32
+        }
33
+
26 34
         this._setAudioMuted(!this._isAudioMuted());
27 35
     }
28 36
 

+ 5
- 0
react/features/base/toolbox/components/AbstractButton.js Parādīt failu

@@ -20,6 +20,11 @@ export type Props = {
20 20
      */
21 21
     disabledStyles: ?Styles,
22 22
 
23
+    /**
24
+     * External handler for click action.
25
+     */
26
+     handleClick?: Function,
27
+
23 28
     /**
24 29
      * Whether to show the label or not.
25 30
      */

+ 8
- 0
react/features/base/toolbox/components/AbstractVideoMuteButton.js Parādīt failu

@@ -22,6 +22,14 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
22 22
      * @returns {void}
23 23
      */
24 24
     _handleClick() {
25
+        const { handleClick } = this.props;
26
+
27
+        if (handleClick) {
28
+            handleClick();
29
+
30
+            return;
31
+        }
32
+
25 33
         this._setVideoMuted(!this._isVideoMuted());
26 34
     }
27 35
 

+ 7
- 6
react/features/chat/components/web/ChatButton.js Parādīt failu

@@ -18,11 +18,6 @@ type Props = AbstractButtonProps & {
18 18
      * Whether or not the chat feature is currently displayed.
19 19
      */
20 20
      _chatOpen: boolean,
21
-
22
-    /**
23
-     * External handler for click action.
24
-     */
25
-    handleClick: Function
26 21
 };
27 22
 
28 23
 /**
@@ -61,7 +56,13 @@ class ChatButton extends AbstractButton<Props, *> {
61 56
      * @returns {void}
62 57
      */
63 58
     _handleClick() {
64
-        this.props.handleClick();
59
+        const { handleClick } = this.props;
60
+
61
+        if (handleClick) {
62
+            handleClick();
63
+
64
+            return;
65
+        }
65 66
     }
66 67
 
67 68
     /**

+ 7
- 1
react/features/embed-meeting/components/EmbedMeetingButton.js Parādīt failu

@@ -36,7 +36,13 @@ class EmbedMeetingButton extends AbstractButton<Props, *> {
36 36
      * @returns {void}
37 37
      */
38 38
     _handleClick() {
39
-        const { dispatch } = this.props;
39
+        const { dispatch, handleClick } = this.props;
40
+
41
+        if (handleClick) {
42
+            handleClick();
43
+
44
+            return;
45
+        }
40 46
 
41 47
         sendAnalytics(createToolbarEvent('embed.meeting'));
42 48
         dispatch(openDialog(EmbedMeetingDialog));

+ 10
- 2
react/features/etherpad/components/SharedDocumentButton.js Parādīt failu

@@ -59,12 +59,20 @@ class SharedDocumentButton extends AbstractButton<Props, *> {
59 59
      * @returns {void}
60 60
      */
61 61
     _handleClick() {
62
+        const { _editing, dispatch, handleClick } = this.props;
63
+
64
+        if (handleClick) {
65
+            handleClick();
66
+
67
+            return;
68
+        }
69
+
62 70
         sendAnalytics(createToolbarEvent(
63 71
             'toggle.etherpad',
64 72
             {
65
-                enable: !this.props._editing
73
+                enable: !_editing
66 74
             }));
67
-        this.props.dispatch(toggleDocument());
75
+        dispatch(toggleDocument());
68 76
     }
69 77
 
70 78
     /**

+ 7
- 1
react/features/feedback/components/FeedbackButton.web.js Parādīt failu

@@ -40,7 +40,13 @@ class FeedbackButton extends AbstractButton<Props, *> {
40 40
      * @returns {void}
41 41
      */
42 42
     _handleClick() {
43
-        const { _conference, dispatch } = this.props;
43
+        const { _conference, dispatch, handleClick } = this.props;
44
+
45
+        if (handleClick) {
46
+            handleClick();
47
+
48
+            return;
49
+        }
44 50
 
45 51
         sendAnalytics(createToolbarEvent('feedback'));
46 52
         dispatch(openFeedbackDialog(_conference));

+ 7
- 1
react/features/invite/components/add-people-dialog/web/InviteButton.js Parādīt failu

@@ -34,7 +34,13 @@ class InviteButton extends AbstractButton<Props, *> {
34 34
      * @returns {void}
35 35
      */
36 36
     _handleClick() {
37
-        const { dispatch } = this.props;
37
+        const { dispatch, handleClick } = this.props;
38
+
39
+        if (handleClick) {
40
+            handleClick();
41
+
42
+            return;
43
+        }
38 44
 
39 45
         sendAnalytics(createToolbarEvent('invite'));
40 46
         dispatch(beginAddPeople());

+ 7
- 1
react/features/keyboard-shortcuts/components/KeyboardShortcutsButton.web.js Parādīt failu

@@ -34,7 +34,13 @@ class KeyboardShortcutsButton extends AbstractButton<Props, *> {
34 34
      * @returns {void}
35 35
      */
36 36
     _handleClick() {
37
-        const { dispatch } = this.props;
37
+        const { dispatch, handleClick } = this.props;
38
+
39
+        if (handleClick) {
40
+            handleClick();
41
+
42
+            return;
43
+        }
38 44
 
39 45
         sendAnalytics(createToolbarEvent('shortcuts'));
40 46
         dispatch(openKeyboardShortcutsDialog());

+ 7
- 1
react/features/local-recording/components/LocalRecordingButton.web.js Parādīt failu

@@ -36,7 +36,13 @@ class LocalRecording extends AbstractButton<Props, *> {
36 36
      * @returns {void}
37 37
      */
38 38
     _handleClick() {
39
-        const { dispatch } = this.props;
39
+        const { dispatch, handleClick } = this.props;
40
+
41
+        if (handleClick) {
42
+            handleClick();
43
+
44
+            return;
45
+        }
40 46
 
41 47
         sendAnalytics(createToolbarEvent('local.recording'));
42 48
         dispatch(openDialog(LocalRecordingInfoDialog));

+ 7
- 6
react/features/participants-pane/components/ParticipantsPaneButton.js Parādīt failu

@@ -14,11 +14,6 @@ type Props = AbstractButtonProps & {
14 14
      * Whether or not the participants pane is open.
15 15
      */
16 16
     _isOpen: boolean,
17
-
18
-    /**
19
-     * External handler for click action.
20
-     */
21
-    handleClick: Function
22 17
 };
23 18
 
24 19
 /**
@@ -37,7 +32,13 @@ class ParticipantsPaneButton extends AbstractButton<Props, *> {
37 32
      * @returns {void}
38 33
      */
39 34
     _handleClick() {
40
-        this.props.handleClick();
35
+        const { handleClick } = this.props;
36
+
37
+        if (handleClick) {
38
+            handleClick();
39
+
40
+            return;
41
+        }
41 42
     }
42 43
 
43 44
     /**

+ 7
- 1
react/features/recording/components/LiveStream/AbstractLiveStreamButton.js Parādīt failu

@@ -76,7 +76,13 @@ export default class AbstractLiveStreamButton<P: Props> extends AbstractButton<P
76 76
      * @returns {void}
77 77
      */
78 78
     async _handleClick() {
79
-        const { _isLiveStreamRunning, dispatch } = this.props;
79
+        const { _isLiveStreamRunning, dispatch, handleClick } = this.props;
80
+
81
+        if (handleClick) {
82
+            handleClick();
83
+
84
+            return;
85
+        }
80 86
 
81 87
         const dialogShown = await dispatch(maybeShowPremiumFeatureDialog(FEATURES.RECORDING));
82 88
 

+ 7
- 1
react/features/recording/components/Recording/AbstractRecordButton.js Parādīt failu

@@ -77,7 +77,13 @@ export default class AbstractRecordButton<P: Props> extends AbstractButton<P, *>
77 77
      * @returns {void}
78 78
      */
79 79
     async _handleClick() {
80
-        const { _isRecordingRunning, dispatch } = this.props;
80
+        const { _isRecordingRunning, dispatch, handleClick } = this.props;
81
+
82
+        if (handleClick) {
83
+            handleClick();
84
+
85
+            return;
86
+        }
81 87
 
82 88
         sendAnalytics(createToolbarEvent(
83 89
             'recording.button',

+ 10
- 2
react/features/screen-share/components/ShareAudioButton.js Parādīt failu

@@ -47,8 +47,16 @@ class ShareAudioButton extends AbstractButton<Props, *> {
47 47
      * @returns {void}
48 48
      */
49 49
     _handleClick() {
50
-        this.props.dispatch(startAudioScreenShareFlow());
51
-        this.props.dispatch(setOverflowMenuVisible(false));
50
+        const { dispatch, handleClick } = this.props;
51
+
52
+        if (handleClick) {
53
+            handleClick();
54
+
55
+            return;
56
+        }
57
+
58
+        dispatch(startAudioScreenShareFlow());
59
+        dispatch(setOverflowMenuVisible(false));
52 60
     }
53 61
 
54 62
     /**

+ 10
- 2
react/features/security/components/security-dialog/SecurityDialogButton.js Parādīt failu

@@ -48,8 +48,16 @@ class SecurityDialogButton extends AbstractButton<Props, *> {
48 48
      * @returns {void}
49 49
      */
50 50
     _handleClick() {
51
-        sendAnalytics(createToolbarEvent('toggle.security', { enable: !this.props._locked }));
52
-        this.props.dispatch(toggleSecurityDialog());
51
+        const { _locked, dispatch, handleClick } = this.props;
52
+
53
+        if (handleClick) {
54
+            handleClick();
55
+
56
+            return;
57
+        }
58
+
59
+        sendAnalytics(createToolbarEvent('toggle.security', { enable: !_locked }));
60
+        dispatch(toggleSecurityDialog());
53 61
     }
54 62
 
55 63
     /**

+ 9
- 1
react/features/settings/components/web/SettingsButton.js Parādīt failu

@@ -42,7 +42,15 @@ class SettingsButton extends AbstractButton<Props, *> {
42 42
     _handleClick() {
43 43
         const {
44 44
             defaultTab = SETTINGS_TABS.DEVICES,
45
-            dispatch } = this.props;
45
+            dispatch,
46
+            handleClick
47
+        } = this.props;
48
+
49
+        if (handleClick) {
50
+            handleClick();
51
+
52
+            return;
53
+        }
46 54
 
47 55
         sendAnalytics(createToolbarEvent('settings'));
48 56
         dispatch(openSettingsDialog(defaultTab));

+ 8
- 0
react/features/shared-video/components/web/SharedVideoButton.js Parādīt failu

@@ -66,6 +66,14 @@ class SharedVideoButton extends AbstractButton<Props, *> {
66 66
      * @returns {void}
67 67
      */
68 68
     _handleClick() {
69
+        const { handleClick } = this.props;
70
+
71
+        if (handleClick) {
72
+            handleClick();
73
+
74
+            return;
75
+        }
76
+
69 77
         this._doToggleSharedVideo();
70 78
     }
71 79
 

+ 7
- 1
react/features/speaker-stats/components/SpeakerStatsButton.js Parādīt failu

@@ -41,7 +41,13 @@ class SpeakerStatsButton extends AbstractButton<Props, *> {
41 41
      * @returns {void}
42 42
      */
43 43
     _handleClick() {
44
-        const { _conference, dispatch } = this.props;
44
+        const { _conference, dispatch, handleClick } = this.props;
45
+
46
+        if (handleClick) {
47
+            handleClick();
48
+
49
+            return;
50
+        }
45 51
 
46 52
         sendAnalytics(createToolbarEvent('speaker.stats'));
47 53
         dispatch(openDialog(SpeakerStats, {

+ 7
- 1
react/features/subtitles/components/AbstractClosedCaptionButton.js Parādīt failu

@@ -38,7 +38,13 @@ export class AbstractClosedCaptionButton
38 38
      * @returns {void}
39 39
      */
40 40
     async _handleClick() {
41
-        const { _requestingSubtitles, dispatch } = this.props;
41
+        const { _requestingSubtitles, dispatch, handleClick } = this.props;
42
+
43
+        if (handleClick) {
44
+            handleClick();
45
+
46
+            return;
47
+        }
42 48
 
43 49
         sendAnalytics(createToolbarEvent('transcribing.ccButton',
44 50
             {

+ 9
- 1
react/features/toolbox/components/DownloadButton.js Parādīt failu

@@ -32,8 +32,16 @@ class DownloadButton extends AbstractButton<Props, *> {
32 32
      * @returns {void}
33 33
      */
34 34
     _handleClick() {
35
+        const { _downloadAppsUrl, handleClick } = this.props;
36
+
37
+        if (handleClick) {
38
+            handleClick();
39
+
40
+            return;
41
+        }
42
+
35 43
         sendAnalytics(createToolbarEvent('download.pressed'));
36
-        openURLInBrowser(this.props._downloadAppsUrl);
44
+        openURLInBrowser(_downloadAppsUrl);
37 45
     }
38 46
 }
39 47
 

+ 9
- 1
react/features/toolbox/components/HelpButton.js Parādīt failu

@@ -33,8 +33,16 @@ class HelpButton extends AbstractButton<Props, *> {
33 33
      * @returns {void}
34 34
      */
35 35
     _handleClick() {
36
+        const { _userDocumentationURL, handleClick } = this.props;
37
+
38
+        if (handleClick) {
39
+            handleClick();
40
+
41
+            return;
42
+        }
43
+
36 44
         sendAnalytics(createToolbarEvent('help.pressed'));
37
-        openURLInBrowser(this.props._userDocumentationURL);
45
+        openURLInBrowser(_userDocumentationURL);
38 46
     }
39 47
 }
40 48
 

+ 7
- 1
react/features/toolbox/components/MuteEveryoneButton.js Parādīt failu

@@ -39,7 +39,13 @@ class MuteEveryoneButton extends AbstractButton<Props, *> {
39 39
      * @returns {void}
40 40
      */
41 41
     _handleClick() {
42
-        const { dispatch, localParticipantId } = this.props;
42
+        const { dispatch, localParticipantId, handleClick } = this.props;
43
+
44
+        if (handleClick) {
45
+            handleClick();
46
+
47
+            return;
48
+        }
43 49
 
44 50
         sendAnalytics(createToolbarEvent('mute.everyone.pressed'));
45 51
         dispatch(openDialog(MuteEveryoneDialog, {

+ 7
- 1
react/features/toolbox/components/MuteEveryonesVideoButton.js Parādīt failu

@@ -39,7 +39,13 @@ class MuteEveryonesVideoButton extends AbstractButton<Props, *> {
39 39
      * @returns {void}
40 40
      */
41 41
     _handleClick() {
42
-        const { dispatch, localParticipantId } = this.props;
42
+        const { dispatch, localParticipantId, handleClick } = this.props;
43
+
44
+        if (handleClick) {
45
+            handleClick();
46
+
47
+            return;
48
+        }
43 49
 
44 50
         sendAnalytics(createToolbarEvent('mute.everyone.pressed'));
45 51
         dispatch(openDialog(MuteEveryonesVideoDialog, {

+ 30
- 5
react/features/toolbox/components/web/AudioSettingsButton.js Parādīt failu

@@ -15,6 +15,11 @@ import AudioMuteButton from '../AudioMuteButton';
15 15
 
16 16
 type Props = {
17 17
 
18
+    /**
19
+     * External handler for click action.
20
+     */
21
+     handleClick: Function,
22
+
18 23
     /**
19 24
      * Indicates whether audio permissions have been granted or denied.
20 25
      */
@@ -62,6 +67,7 @@ class AudioSettingsButton extends Component<Props> {
62 67
         super(props);
63 68
 
64 69
         this._onEscClick = this._onEscClick.bind(this);
70
+        this._onClick = this._onClick.bind(this);
65 71
     }
66 72
 
67 73
     _onEscClick: (KeyboardEvent) => void;
@@ -76,17 +82,36 @@ class AudioSettingsButton extends Component<Props> {
76 82
         if (event.key === 'Escape' && this.props.isOpen) {
77 83
             event.preventDefault();
78 84
             event.stopPropagation();
79
-            this.props.onAudioOptionsClick();
85
+            this._onClick();
80 86
         }
81 87
     }
82 88
 
89
+    _onClick: () => void;
90
+
91
+    /**
92
+     * Click handler for the more actions entries.
93
+     *
94
+     * @returns {void}
95
+     */
96
+    _onClick() {
97
+        const { handleClick, onAudioOptionsClick } = this.props;
98
+
99
+        if (handleClick) {
100
+            handleClick();
101
+
102
+            return;
103
+        }
104
+
105
+        onAudioOptionsClick();
106
+    }
107
+
83 108
     /**
84 109
      * Implements React's {@link Component#render}.
85 110
      *
86 111
      * @inheritdoc
87 112
      */
88 113
     render() {
89
-        const { hasPermissions, isDisabled, onAudioOptionsClick, visible, isOpen, t } = this.props;
114
+        const { handleClick, hasPermissions, isDisabled, visible, isOpen, t } = this.props;
90 115
         const settingsDisabled = !hasPermissions
91 116
             || isDisabled
92 117
             || !JitsiMeetJS.mediaDevices.isMultipleAudioInputSupported();
@@ -102,12 +127,12 @@ class AudioSettingsButton extends Component<Props> {
102 127
                     iconDisabled = { settingsDisabled }
103 128
                     iconId = 'audio-settings-button'
104 129
                     iconTooltip = { t('toolbar.audioSettings') }
105
-                    onIconClick = { onAudioOptionsClick }
130
+                    onIconClick = { this._onClick }
106 131
                     onIconKeyDown = { this._onEscClick }>
107
-                    <AudioMuteButton />
132
+                    <AudioMuteButton handleClick = { handleClick } />
108 133
                 </ToolboxButtonWithIcon>
109 134
             </AudioSettingsPopup>
110
-        ) : <AudioMuteButton />;
135
+        ) : <AudioMuteButton handleClick = { handleClick } />;
111 136
     }
112 137
 }
113 138
 

+ 7
- 6
react/features/toolbox/components/web/FullscreenButton.js Parādīt failu

@@ -11,11 +11,6 @@ type Props = AbstractButtonProps & {
11 11
    * Whether or not the app is currently in full screen.
12 12
    */
13 13
    _fullScreen: boolean,
14
-
15
-    /**
16
-     * External handler for click action.
17
-     */
18
-    handleClick: Function
19 14
 };
20 15
 
21 16
 /**
@@ -73,7 +68,13 @@ class FullscreenButton extends AbstractButton<Props, *> {
73 68
      * @returns {void}
74 69
      */
75 70
     _handleClick() {
76
-        this.props.handleClick();
71
+        const { handleClick } = this.props;
72
+
73
+        if (handleClick) {
74
+            handleClick();
75
+
76
+            return;
77
+        }
77 78
     }
78 79
 
79 80
     /**

+ 7
- 1
react/features/toolbox/components/web/ProfileButton.js Parādīt failu

@@ -87,7 +87,13 @@ class ProfileButton extends AbstractButton<Props, *> {
87 87
      * @returns {void}
88 88
      */
89 89
     _handleClick() {
90
-        const { dispatch, _unclickable } = this.props;
90
+        const { dispatch, _unclickable, handleClick } = this.props;
91
+
92
+        if (handleClick) {
93
+            handleClick();
94
+
95
+            return;
96
+        }
91 97
 
92 98
         if (!_unclickable) {
93 99
             sendAnalytics(createToolbarEvent('profile'));

+ 7
- 6
react/features/toolbox/components/web/RaiseHandButton.js Parādīt failu

@@ -12,11 +12,6 @@ type Props = AbstractButtonProps & {
12 12
      * Whether or not the local participant's hand is raised.
13 13
      */
14 14
     _raisedHand: boolean,
15
-
16
-    /**
17
-     * External handler for click action.
18
-     */
19
-    handleClick: Function
20 15
 };
21 16
 
22 17
 /**
@@ -51,7 +46,13 @@ class RaiseHandButton extends AbstractButton<Props, *> {
51 46
      * @returns {void}
52 47
      */
53 48
     _handleClick() {
54
-        this.props.handleClick();
49
+        const { handleClick } = this.props;
50
+
51
+        if (handleClick) {
52
+            handleClick();
53
+
54
+            return;
55
+        }
55 56
     }
56 57
 
57 58
     /**

+ 7
- 6
react/features/toolbox/components/web/ShareDesktopButton.js Parādīt failu

@@ -29,11 +29,6 @@ type Props = AbstractButtonProps & {
29 29
      * The redux {@code dispatch} function.
30 30
      */
31 31
      dispatch: Function,
32
-
33
-     /**
34
-      * External handler for click action.
35
-      */
36
-      handleClick: Function
37 32
 };
38 33
 
39 34
 /**
@@ -79,7 +74,13 @@ class ShareDesktopButton extends AbstractButton<Props, *> {
79 74
      * @returns {void}
80 75
      */
81 76
     _handleClick() {
82
-        this.props.handleClick();
77
+        const { handleClick } = this.props;
78
+
79
+        if (handleClick) {
80
+            handleClick();
81
+
82
+            return;
83
+        }
83 84
     }
84 85
 
85 86
     /**

+ 9
- 1
react/features/toolbox/components/web/ToggleCameraButton.js Parādīt failu

@@ -41,7 +41,15 @@ class ToggleCameraButton extends AbstractButton<Props, any> {
41 41
      * @returns {void}
42 42
      */
43 43
     _handleClick() {
44
-        this.props.dispatch(toggleCamera());
44
+        const { dispatch, handleClick } = this.props;
45
+
46
+        if (handleClick) {
47
+            handleClick();
48
+
49
+            return;
50
+        }
51
+
52
+        dispatch(toggleCamera());
45 53
     }
46 54
 
47 55
     /**

+ 30
- 2
react/features/toolbox/components/web/Toolbox.js Parādīt failu

@@ -103,6 +103,11 @@ type Props = {
103 103
      */
104 104
     _backgroundType: String,
105 105
 
106
+    /**
107
+     * Toolbar buttons which have their click exposed through the API.
108
+     */
109
+    _buttonsWithNotifyClick: Array<string>,
110
+
106 111
     /**
107 112
      * Whether or not the chat feature is currently displayed.
108 113
      */
@@ -835,6 +840,24 @@ class Toolbox extends Component<Props, State> {
835 840
         };
836 841
     }
837 842
 
843
+    /**
844
+     * Overwrites click handlers for buttons in case click is exposed through the iframe API.
845
+     *
846
+     * @param {Object} buttons - The list of toolbar buttons.
847
+     * @returns {void}
848
+     */
849
+    _overwriteButtonsClickHandlers(buttons) {
850
+        if (typeof APP === 'undefined' || !this.props._buttonsWithNotifyClick?.length) {
851
+            return;
852
+        }
853
+
854
+        Object.values(buttons).forEach((button: any) => {
855
+            if (this.props._buttonsWithNotifyClick.includes(button.key)) {
856
+                button.handleClick = () => APP.API.notifyToolbarButtonClicked(button.key);
857
+            }
858
+        });
859
+    }
860
+
838 861
     /**
839 862
      * Returns all buttons that need to be rendered.
840 863
      *
@@ -849,6 +872,8 @@ class Toolbox extends Component<Props, State> {
849 872
 
850 873
 
851 874
         const buttons = this._getAllButtons();
875
+
876
+        this._overwriteButtonsClickHandlers(buttons);
852 877
         const isHangupVisible = isToolbarButtonEnabled('hangup', _toolbarButtons);
853 878
         const { order } = THRESHOLDS.find(({ width }) => _clientWidth > width)
854 879
             || THRESHOLDS[THRESHOLDS.length - 1];
@@ -1313,7 +1338,9 @@ function _mapStateToProps(state, ownProps) {
1313 1338
     let desktopSharingEnabled = JitsiMeetJS.isDesktopSharingEnabled();
1314 1339
     const {
1315 1340
         callStatsID,
1316
-        enableFeaturesBasedOnToken
1341
+        disableProfile,
1342
+        enableFeaturesBasedOnToken,
1343
+        buttonsWithNotifyClick
1317 1344
     } = state['features/base/config'];
1318 1345
     const {
1319 1346
         fullScreen,
@@ -1345,6 +1372,7 @@ function _mapStateToProps(state, ownProps) {
1345 1372
 
1346 1373
     return {
1347 1374
         _backgroundType: state['features/virtual-background'].backgroundType,
1375
+        _buttonsWithNotifyClick: buttonsWithNotifyClick,
1348 1376
         _chatOpen: state['features/chat'].isOpen,
1349 1377
         _clientWidth: clientWidth,
1350 1378
         _conference: conference,
@@ -1353,7 +1381,7 @@ function _mapStateToProps(state, ownProps) {
1353 1381
         _dialog: Boolean(state['features/base/dialog'].component),
1354 1382
         _feedbackConfigured: Boolean(callStatsID),
1355 1383
         _fullScreen: fullScreen,
1356
-        _isProfileDisabled: Boolean(state['features/base/config'].disableProfile),
1384
+        _isProfileDisabled: Boolean(disableProfile),
1357 1385
         _isMobile: isMobileBrowser(),
1358 1386
         _isVpaasMeeting: isVpaasMeeting(state),
1359 1387
         _localParticipantID: localParticipant?.id,

+ 31
- 6
react/features/toolbox/components/web/VideoSettingsButton.js Parādīt failu

@@ -16,6 +16,11 @@ import VideoMuteButton from '../VideoMuteButton';
16 16
 
17 17
 type Props = {
18 18
 
19
+    /**
20
+     * External handler for click action.
21
+     */
22
+    handleClick: Function,
23
+
19 24
     /**
20 25
      * Click handler for the small icon. Opens video options.
21 26
      */
@@ -62,7 +67,7 @@ type Props = {
62 67
  */
63 68
 class VideoSettingsButton extends Component<Props> {
64 69
     /**
65
-     * Initializes a new {@code AudioSettingsButton} instance.
70
+     * Initializes a new {@code VideoSettingsButton} instance.
66 71
      *
67 72
      * @inheritdoc
68 73
      */
@@ -70,6 +75,7 @@ class VideoSettingsButton extends Component<Props> {
70 75
         super(props);
71 76
 
72 77
         this._onEscClick = this._onEscClick.bind(this);
78
+        this._onClick = this._onClick.bind(this);
73 79
     }
74 80
 
75 81
     /**
@@ -94,17 +100,36 @@ class VideoSettingsButton extends Component<Props> {
94 100
         if (event.key === 'Escape' && this.props.isOpen) {
95 101
             event.preventDefault();
96 102
             event.stopPropagation();
97
-            this.props.onVideoOptionsClick();
103
+            this._onClick();
98 104
         }
99 105
     }
100 106
 
107
+    _onClick: () => void;
108
+
109
+    /**
110
+     * Click handler for the more actions entries.
111
+     *
112
+     * @returns {void}
113
+     */
114
+    _onClick() {
115
+        const { handleClick, onVideoOptionsClick } = this.props;
116
+
117
+        if (handleClick) {
118
+            handleClick();
119
+
120
+            return;
121
+        }
122
+
123
+        onVideoOptionsClick();
124
+    }
125
+
101 126
     /**
102 127
      * Implements React's {@link Component#render}.
103 128
      *
104 129
      * @inheritdoc
105 130
      */
106 131
     render() {
107
-        const { onVideoOptionsClick, t, visible, isOpen } = this.props;
132
+        const { handleClick, t, visible, isOpen } = this.props;
108 133
 
109 134
         return visible ? (
110 135
             <VideoSettingsPopup>
@@ -117,12 +142,12 @@ class VideoSettingsButton extends Component<Props> {
117 142
                     iconDisabled = { this._isIconDisabled() }
118 143
                     iconId = 'video-settings-button'
119 144
                     iconTooltip = { t('toolbar.videoSettings') }
120
-                    onIconClick = { onVideoOptionsClick }
145
+                    onIconClick = { this._onClick }
121 146
                     onIconKeyDown = { this._onEscClick }>
122
-                    <VideoMuteButton />
147
+                    <VideoMuteButton handleClick = { handleClick } />
123 148
                 </ToolboxButtonWithIcon>
124 149
             </VideoSettingsPopup>
125
-        ) : <VideoMuteButton />;
150
+        ) : <VideoMuteButton handleClick = { handleClick } />;
126 151
     }
127 152
 }
128 153
 

+ 8
- 1
react/features/video-layout/components/TileViewButton.js Parādīt failu

@@ -51,7 +51,14 @@ class TileViewButton<P: Props> extends AbstractButton<P, *> {
51 51
      * @returns {void}
52 52
      */
53 53
     _handleClick() {
54
-        const { _tileViewEnabled, dispatch } = this.props;
54
+        const { _tileViewEnabled, dispatch, handleClick } = this.props;
55
+
56
+        if (handleClick) {
57
+            handleClick();
58
+
59
+            return;
60
+        }
61
+
55 62
         const value = !_tileViewEnabled;
56 63
 
57 64
         sendAnalytics(createToolbarEvent(

+ 7
- 6
react/features/video-quality/components/VideoQualityButton.web.js Parādīt failu

@@ -42,11 +42,6 @@ type Props = AbstractButtonProps & {
42 42
      */
43 43
     _videoQuality: number,
44 44
 
45
-    /**
46
-     * Callback to invoke when {@link VideoQualityButton} is clicked.
47
-     */
48
-     handleClick: Function,
49
-
50 45
     /**
51 46
      * Invoked to obtain translated strings.
52 47
      */
@@ -97,7 +92,13 @@ class VideoQualityButton extends AbstractButton<Props, *> {
97 92
      * @returns {void}
98 93
      */
99 94
     _handleClick() {
100
-        this.props.handleClick();
95
+        const { handleClick } = this.props;
96
+
97
+        if (handleClick) {
98
+            handleClick();
99
+
100
+            return;
101
+        }
101 102
     }
102 103
 }
103 104
 

+ 7
- 1
react/features/virtual-background/components/VideoBackgroundButton.js Parādīt failu

@@ -43,7 +43,13 @@ class VideoBackgroundButton extends AbstractButton<Props, *> {
43 43
      * @returns {void}
44 44
      */
45 45
     _handleClick() {
46
-        const { dispatch } = this.props;
46
+        const { dispatch, handleClick } = this.props;
47
+
48
+        if (handleClick) {
49
+            handleClick();
50
+
51
+            return;
52
+        }
47 53
 
48 54
         dispatch(openDialog(VirtualBackgroundDialog));
49 55
     }

Notiek ielāde…
Atcelt
Saglabāt