Bläddra i källkod

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

master
Horatiu Muresan 4 år sedan
förälder
incheckning
1add438a1f
Inget konto är kopplat till bidragsgivarens mejladress
38 ändrade filer med 380 tillägg och 74 borttagningar
  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 Visa fil

539
     //    '__end'
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
     // List of pre meeting screens buttons to hide. The values must be one or more of the 5 allowed buttons:
579
     // List of pre meeting screens buttons to hide. The values must be one or more of the 5 allowed buttons:
543
     // 'microphone', 'camera', 'select-background', 'invite', 'settings'
580
     // 'microphone', 'camera', 'select-background', 'invite', 'settings'
544
     // hiddenPremeetingButtons: [],
581
     // hiddenPremeetingButtons: [],

+ 13
- 0
modules/API/API.js Visa fil

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
      * Disposes the allocated resources.
1359
      * Disposes the allocated resources.
1347
      *
1360
      *

+ 2
- 1
modules/API/external/external_api.js Visa fil

112
     'dominant-speaker-changed': 'dominantSpeakerChanged',
112
     'dominant-speaker-changed': 'dominantSpeakerChanged',
113
     'subject-change': 'subjectChange',
113
     'subject-change': 'subjectChange',
114
     'suspend-detected': 'suspendDetected',
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 Visa fil

19
     'apiLogLevels',
19
     'apiLogLevels',
20
     'avgRtpStatsN',
20
     'avgRtpStatsN',
21
     'backgroundAlpha',
21
     'backgroundAlpha',
22
+    'buttonsWithNotifyClick',
22
 
23
 
23
     /**
24
     /**
24
      * The display name of the CallKit call representing the conference/meeting
25
      * The display name of the CallKit call representing the conference/meeting

+ 8
- 0
react/features/base/toolbox/components/AbstractAudioMuteButton.js Visa fil

23
      * @returns {void}
23
      * @returns {void}
24
      */
24
      */
25
     _handleClick() {
25
     _handleClick() {
26
+        const { handleClick } = this.props;
27
+
28
+        if (handleClick) {
29
+            handleClick();
30
+
31
+            return;
32
+        }
33
+
26
         this._setAudioMuted(!this._isAudioMuted());
34
         this._setAudioMuted(!this._isAudioMuted());
27
     }
35
     }
28
 
36
 

+ 5
- 0
react/features/base/toolbox/components/AbstractButton.js Visa fil

20
      */
20
      */
21
     disabledStyles: ?Styles,
21
     disabledStyles: ?Styles,
22
 
22
 
23
+    /**
24
+     * External handler for click action.
25
+     */
26
+     handleClick?: Function,
27
+
23
     /**
28
     /**
24
      * Whether to show the label or not.
29
      * Whether to show the label or not.
25
      */
30
      */

+ 8
- 0
react/features/base/toolbox/components/AbstractVideoMuteButton.js Visa fil

22
      * @returns {void}
22
      * @returns {void}
23
      */
23
      */
24
     _handleClick() {
24
     _handleClick() {
25
+        const { handleClick } = this.props;
26
+
27
+        if (handleClick) {
28
+            handleClick();
29
+
30
+            return;
31
+        }
32
+
25
         this._setVideoMuted(!this._isVideoMuted());
33
         this._setVideoMuted(!this._isVideoMuted());
26
     }
34
     }
27
 
35
 

+ 7
- 6
react/features/chat/components/web/ChatButton.js Visa fil

18
      * Whether or not the chat feature is currently displayed.
18
      * Whether or not the chat feature is currently displayed.
19
      */
19
      */
20
      _chatOpen: boolean,
20
      _chatOpen: boolean,
21
-
22
-    /**
23
-     * External handler for click action.
24
-     */
25
-    handleClick: Function
26
 };
21
 };
27
 
22
 
28
 /**
23
 /**
61
      * @returns {void}
56
      * @returns {void}
62
      */
57
      */
63
     _handleClick() {
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 Visa fil

36
      * @returns {void}
36
      * @returns {void}
37
      */
37
      */
38
     _handleClick() {
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
         sendAnalytics(createToolbarEvent('embed.meeting'));
47
         sendAnalytics(createToolbarEvent('embed.meeting'));
42
         dispatch(openDialog(EmbedMeetingDialog));
48
         dispatch(openDialog(EmbedMeetingDialog));

+ 10
- 2
react/features/etherpad/components/SharedDocumentButton.js Visa fil

59
      * @returns {void}
59
      * @returns {void}
60
      */
60
      */
61
     _handleClick() {
61
     _handleClick() {
62
+        const { _editing, dispatch, handleClick } = this.props;
63
+
64
+        if (handleClick) {
65
+            handleClick();
66
+
67
+            return;
68
+        }
69
+
62
         sendAnalytics(createToolbarEvent(
70
         sendAnalytics(createToolbarEvent(
63
             'toggle.etherpad',
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 Visa fil

40
      * @returns {void}
40
      * @returns {void}
41
      */
41
      */
42
     _handleClick() {
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
         sendAnalytics(createToolbarEvent('feedback'));
51
         sendAnalytics(createToolbarEvent('feedback'));
46
         dispatch(openFeedbackDialog(_conference));
52
         dispatch(openFeedbackDialog(_conference));

+ 7
- 1
react/features/invite/components/add-people-dialog/web/InviteButton.js Visa fil

34
      * @returns {void}
34
      * @returns {void}
35
      */
35
      */
36
     _handleClick() {
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
         sendAnalytics(createToolbarEvent('invite'));
45
         sendAnalytics(createToolbarEvent('invite'));
40
         dispatch(beginAddPeople());
46
         dispatch(beginAddPeople());

+ 7
- 1
react/features/keyboard-shortcuts/components/KeyboardShortcutsButton.web.js Visa fil

34
      * @returns {void}
34
      * @returns {void}
35
      */
35
      */
36
     _handleClick() {
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
         sendAnalytics(createToolbarEvent('shortcuts'));
45
         sendAnalytics(createToolbarEvent('shortcuts'));
40
         dispatch(openKeyboardShortcutsDialog());
46
         dispatch(openKeyboardShortcutsDialog());

+ 7
- 1
react/features/local-recording/components/LocalRecordingButton.web.js Visa fil

36
      * @returns {void}
36
      * @returns {void}
37
      */
37
      */
38
     _handleClick() {
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
         sendAnalytics(createToolbarEvent('local.recording'));
47
         sendAnalytics(createToolbarEvent('local.recording'));
42
         dispatch(openDialog(LocalRecordingInfoDialog));
48
         dispatch(openDialog(LocalRecordingInfoDialog));

+ 7
- 6
react/features/participants-pane/components/ParticipantsPaneButton.js Visa fil

14
      * Whether or not the participants pane is open.
14
      * Whether or not the participants pane is open.
15
      */
15
      */
16
     _isOpen: boolean,
16
     _isOpen: boolean,
17
-
18
-    /**
19
-     * External handler for click action.
20
-     */
21
-    handleClick: Function
22
 };
17
 };
23
 
18
 
24
 /**
19
 /**
37
      * @returns {void}
32
      * @returns {void}
38
      */
33
      */
39
     _handleClick() {
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 Visa fil

76
      * @returns {void}
76
      * @returns {void}
77
      */
77
      */
78
     async _handleClick() {
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
         const dialogShown = await dispatch(maybeShowPremiumFeatureDialog(FEATURES.RECORDING));
87
         const dialogShown = await dispatch(maybeShowPremiumFeatureDialog(FEATURES.RECORDING));
82
 
88
 

+ 7
- 1
react/features/recording/components/Recording/AbstractRecordButton.js Visa fil

77
      * @returns {void}
77
      * @returns {void}
78
      */
78
      */
79
     async _handleClick() {
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
         sendAnalytics(createToolbarEvent(
88
         sendAnalytics(createToolbarEvent(
83
             'recording.button',
89
             'recording.button',

+ 10
- 2
react/features/screen-share/components/ShareAudioButton.js Visa fil

47
      * @returns {void}
47
      * @returns {void}
48
      */
48
      */
49
     _handleClick() {
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 Visa fil

48
      * @returns {void}
48
      * @returns {void}
49
      */
49
      */
50
     _handleClick() {
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 Visa fil

42
     _handleClick() {
42
     _handleClick() {
43
         const {
43
         const {
44
             defaultTab = SETTINGS_TABS.DEVICES,
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
         sendAnalytics(createToolbarEvent('settings'));
55
         sendAnalytics(createToolbarEvent('settings'));
48
         dispatch(openSettingsDialog(defaultTab));
56
         dispatch(openSettingsDialog(defaultTab));

+ 8
- 0
react/features/shared-video/components/web/SharedVideoButton.js Visa fil

66
      * @returns {void}
66
      * @returns {void}
67
      */
67
      */
68
     _handleClick() {
68
     _handleClick() {
69
+        const { handleClick } = this.props;
70
+
71
+        if (handleClick) {
72
+            handleClick();
73
+
74
+            return;
75
+        }
76
+
69
         this._doToggleSharedVideo();
77
         this._doToggleSharedVideo();
70
     }
78
     }
71
 
79
 

+ 7
- 1
react/features/speaker-stats/components/SpeakerStatsButton.js Visa fil

41
      * @returns {void}
41
      * @returns {void}
42
      */
42
      */
43
     _handleClick() {
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
         sendAnalytics(createToolbarEvent('speaker.stats'));
52
         sendAnalytics(createToolbarEvent('speaker.stats'));
47
         dispatch(openDialog(SpeakerStats, {
53
         dispatch(openDialog(SpeakerStats, {

+ 7
- 1
react/features/subtitles/components/AbstractClosedCaptionButton.js Visa fil

38
      * @returns {void}
38
      * @returns {void}
39
      */
39
      */
40
     async _handleClick() {
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
         sendAnalytics(createToolbarEvent('transcribing.ccButton',
49
         sendAnalytics(createToolbarEvent('transcribing.ccButton',
44
             {
50
             {

+ 9
- 1
react/features/toolbox/components/DownloadButton.js Visa fil

32
      * @returns {void}
32
      * @returns {void}
33
      */
33
      */
34
     _handleClick() {
34
     _handleClick() {
35
+        const { _downloadAppsUrl, handleClick } = this.props;
36
+
37
+        if (handleClick) {
38
+            handleClick();
39
+
40
+            return;
41
+        }
42
+
35
         sendAnalytics(createToolbarEvent('download.pressed'));
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 Visa fil

33
      * @returns {void}
33
      * @returns {void}
34
      */
34
      */
35
     _handleClick() {
35
     _handleClick() {
36
+        const { _userDocumentationURL, handleClick } = this.props;
37
+
38
+        if (handleClick) {
39
+            handleClick();
40
+
41
+            return;
42
+        }
43
+
36
         sendAnalytics(createToolbarEvent('help.pressed'));
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 Visa fil

39
      * @returns {void}
39
      * @returns {void}
40
      */
40
      */
41
     _handleClick() {
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
         sendAnalytics(createToolbarEvent('mute.everyone.pressed'));
50
         sendAnalytics(createToolbarEvent('mute.everyone.pressed'));
45
         dispatch(openDialog(MuteEveryoneDialog, {
51
         dispatch(openDialog(MuteEveryoneDialog, {

+ 7
- 1
react/features/toolbox/components/MuteEveryonesVideoButton.js Visa fil

39
      * @returns {void}
39
      * @returns {void}
40
      */
40
      */
41
     _handleClick() {
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
         sendAnalytics(createToolbarEvent('mute.everyone.pressed'));
50
         sendAnalytics(createToolbarEvent('mute.everyone.pressed'));
45
         dispatch(openDialog(MuteEveryonesVideoDialog, {
51
         dispatch(openDialog(MuteEveryonesVideoDialog, {

+ 30
- 5
react/features/toolbox/components/web/AudioSettingsButton.js Visa fil

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

+ 7
- 6
react/features/toolbox/components/web/FullscreenButton.js Visa fil

11
    * Whether or not the app is currently in full screen.
11
    * Whether or not the app is currently in full screen.
12
    */
12
    */
13
    _fullScreen: boolean,
13
    _fullScreen: boolean,
14
-
15
-    /**
16
-     * External handler for click action.
17
-     */
18
-    handleClick: Function
19
 };
14
 };
20
 
15
 
21
 /**
16
 /**
73
      * @returns {void}
68
      * @returns {void}
74
      */
69
      */
75
     _handleClick() {
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 Visa fil

87
      * @returns {void}
87
      * @returns {void}
88
      */
88
      */
89
     _handleClick() {
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
         if (!_unclickable) {
98
         if (!_unclickable) {
93
             sendAnalytics(createToolbarEvent('profile'));
99
             sendAnalytics(createToolbarEvent('profile'));

+ 7
- 6
react/features/toolbox/components/web/RaiseHandButton.js Visa fil

12
      * Whether or not the local participant's hand is raised.
12
      * Whether or not the local participant's hand is raised.
13
      */
13
      */
14
     _raisedHand: boolean,
14
     _raisedHand: boolean,
15
-
16
-    /**
17
-     * External handler for click action.
18
-     */
19
-    handleClick: Function
20
 };
15
 };
21
 
16
 
22
 /**
17
 /**
51
      * @returns {void}
46
      * @returns {void}
52
      */
47
      */
53
     _handleClick() {
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 Visa fil

29
      * The redux {@code dispatch} function.
29
      * The redux {@code dispatch} function.
30
      */
30
      */
31
      dispatch: Function,
31
      dispatch: Function,
32
-
33
-     /**
34
-      * External handler for click action.
35
-      */
36
-      handleClick: Function
37
 };
32
 };
38
 
33
 
39
 /**
34
 /**
79
      * @returns {void}
74
      * @returns {void}
80
      */
75
      */
81
     _handleClick() {
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 Visa fil

41
      * @returns {void}
41
      * @returns {void}
42
      */
42
      */
43
     _handleClick() {
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 Visa fil

103
      */
103
      */
104
     _backgroundType: String,
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
      * Whether or not the chat feature is currently displayed.
112
      * Whether or not the chat feature is currently displayed.
108
      */
113
      */
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
      * Returns all buttons that need to be rendered.
862
      * Returns all buttons that need to be rendered.
840
      *
863
      *
849
 
872
 
850
 
873
 
851
         const buttons = this._getAllButtons();
874
         const buttons = this._getAllButtons();
875
+
876
+        this._overwriteButtonsClickHandlers(buttons);
852
         const isHangupVisible = isToolbarButtonEnabled('hangup', _toolbarButtons);
877
         const isHangupVisible = isToolbarButtonEnabled('hangup', _toolbarButtons);
853
         const { order } = THRESHOLDS.find(({ width }) => _clientWidth > width)
878
         const { order } = THRESHOLDS.find(({ width }) => _clientWidth > width)
854
             || THRESHOLDS[THRESHOLDS.length - 1];
879
             || THRESHOLDS[THRESHOLDS.length - 1];
1313
     let desktopSharingEnabled = JitsiMeetJS.isDesktopSharingEnabled();
1338
     let desktopSharingEnabled = JitsiMeetJS.isDesktopSharingEnabled();
1314
     const {
1339
     const {
1315
         callStatsID,
1340
         callStatsID,
1316
-        enableFeaturesBasedOnToken
1341
+        disableProfile,
1342
+        enableFeaturesBasedOnToken,
1343
+        buttonsWithNotifyClick
1317
     } = state['features/base/config'];
1344
     } = state['features/base/config'];
1318
     const {
1345
     const {
1319
         fullScreen,
1346
         fullScreen,
1345
 
1372
 
1346
     return {
1373
     return {
1347
         _backgroundType: state['features/virtual-background'].backgroundType,
1374
         _backgroundType: state['features/virtual-background'].backgroundType,
1375
+        _buttonsWithNotifyClick: buttonsWithNotifyClick,
1348
         _chatOpen: state['features/chat'].isOpen,
1376
         _chatOpen: state['features/chat'].isOpen,
1349
         _clientWidth: clientWidth,
1377
         _clientWidth: clientWidth,
1350
         _conference: conference,
1378
         _conference: conference,
1353
         _dialog: Boolean(state['features/base/dialog'].component),
1381
         _dialog: Boolean(state['features/base/dialog'].component),
1354
         _feedbackConfigured: Boolean(callStatsID),
1382
         _feedbackConfigured: Boolean(callStatsID),
1355
         _fullScreen: fullScreen,
1383
         _fullScreen: fullScreen,
1356
-        _isProfileDisabled: Boolean(state['features/base/config'].disableProfile),
1384
+        _isProfileDisabled: Boolean(disableProfile),
1357
         _isMobile: isMobileBrowser(),
1385
         _isMobile: isMobileBrowser(),
1358
         _isVpaasMeeting: isVpaasMeeting(state),
1386
         _isVpaasMeeting: isVpaasMeeting(state),
1359
         _localParticipantID: localParticipant?.id,
1387
         _localParticipantID: localParticipant?.id,

+ 31
- 6
react/features/toolbox/components/web/VideoSettingsButton.js Visa fil

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

+ 8
- 1
react/features/video-layout/components/TileViewButton.js Visa fil

51
      * @returns {void}
51
      * @returns {void}
52
      */
52
      */
53
     _handleClick() {
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
         const value = !_tileViewEnabled;
62
         const value = !_tileViewEnabled;
56
 
63
 
57
         sendAnalytics(createToolbarEvent(
64
         sendAnalytics(createToolbarEvent(

+ 7
- 6
react/features/video-quality/components/VideoQualityButton.web.js Visa fil

42
      */
42
      */
43
     _videoQuality: number,
43
     _videoQuality: number,
44
 
44
 
45
-    /**
46
-     * Callback to invoke when {@link VideoQualityButton} is clicked.
47
-     */
48
-     handleClick: Function,
49
-
50
     /**
45
     /**
51
      * Invoked to obtain translated strings.
46
      * Invoked to obtain translated strings.
52
      */
47
      */
97
      * @returns {void}
92
      * @returns {void}
98
      */
93
      */
99
     _handleClick() {
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 Visa fil

43
      * @returns {void}
43
      * @returns {void}
44
      */
44
      */
45
     _handleClick() {
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
         dispatch(openDialog(VirtualBackgroundDialog));
54
         dispatch(openDialog(VirtualBackgroundDialog));
49
     }
55
     }

Laddar…
Avbryt
Spara