Bläddra i källkod

feat(toolbox): axe the old toolbox (#2731)

This PR takes The Bulldozer Approach (R): removes the old toolbox and lots of
associated code, though not all of it. Subsequent cleanups will follow.
j8
Saúl Ibarra Corretgé 7 år sedan
förälder
incheckning
b73b51f1f4

+ 1
- 6
conference.js Visa fil

@@ -106,10 +106,7 @@ import {
106 106
     suspendDetected
107 107
 } from './react/features/overlay';
108 108
 import { setSharedVideoStatus } from './react/features/shared-video';
109
-import {
110
-    isButtonEnabled,
111
-    showDesktopSharingButton
112
-} from './react/features/toolbox';
109
+import { isButtonEnabled } from './react/features/toolbox';
113 110
 
114 111
 const logger = require('jitsi-meet-logger').getLogger(__filename);
115 112
 
@@ -768,7 +765,6 @@ export default {
768 765
 
769 766
                 APP.store.dispatch(
770 767
                     setDesktopSharingEnabled(this.isDesktopSharingEnabled));
771
-                APP.store.dispatch(showDesktopSharingButton());
772 768
 
773 769
                 this._createRoom(tracks);
774 770
                 APP.remoteControl.init();
@@ -1359,7 +1355,6 @@ export default {
1359 1355
         this.isSharingScreen = newStream && newStream.videoType === 'desktop';
1360 1356
 
1361 1357
         if (wasSharingScreen !== this.isSharingScreen) {
1362
-            APP.UI.updateDesktopSharingButtons();
1363 1358
             APP.API.notifyScreenSharingStatusChanged(this.isSharingScreen);
1364 1359
         }
1365 1360
     },

+ 1
- 13
interface_config.js Visa fil

@@ -153,19 +153,7 @@ var interfaceConfig = {
153 153
      *
154 154
      * @type {boolean}
155 155
      */
156
-    VIDEO_QUALITY_LABEL_DISABLED: false,
157
-
158
-    /**
159
-     * This is a temporary feature flag used to gate access to the toolbox so it
160
-     * can be developed through smaller changesets and set to false if bad bugs
161
-     * are found. This feature flag will be removed at some point, as well as
162
-     * the old toolbox. This new toolbox will be horizontal and the previous
163
-     * feature of supporting menu button ordering through interfaceConfig will
164
-     * be removed. Support for configuring which buttons display will remain.
165
-     *
166
-     * @type {boolean}
167
-     */
168
-    _USE_NEW_TOOLBOX: true
156
+    VIDEO_QUALITY_LABEL_DISABLED: false
169 157
 
170 158
     /**
171 159
      * Specify custom URL for downloading android mobile app.

+ 7
- 35
modules/UI/UI.js Visa fil

@@ -36,14 +36,7 @@ import {
36 36
     showWarningNotification
37 37
 } from '../../react/features/notifications';
38 38
 import {
39
-    checkAutoEnableDesktopSharing,
40
-    clearButtonPopup,
41 39
     dockToolbox,
42
-    setButtonPopupTimeout,
43
-    setToolbarButton,
44
-    showDialPadButton,
45
-    showEtherpadButton,
46
-    showSharedVideoButton,
47 40
     showToolbox
48 41
 } from '../../react/features/toolbox';
49 42
 
@@ -278,7 +271,7 @@ UI.setLocalRaisedHandStatus
278 271
  * Initialize conference UI.
279 272
  */
280 273
 UI.initConference = function() {
281
-    const { dispatch, getState } = APP.store;
274
+    const { getState } = APP.store;
282 275
     const { email, id, name } = getLocalParticipant(getState);
283 276
 
284 277
     // Update default button states before showing the toolbar
@@ -298,8 +291,6 @@ UI.initConference = function() {
298 291
         UI.setUserEmail(id, email);
299 292
     }
300 293
 
301
-    dispatch(checkAutoEnableDesktopSharing());
302
-
303 294
     // FollowMe attempts to copy certain aspects of the moderator's UI into the
304 295
     // other participants' UI. Consequently, it needs (1) read and write access
305 296
     // to the UI (depending on the moderator role of the local participant) and
@@ -372,11 +363,10 @@ UI.start = function() {
372 363
         $('body').addClass('vertical-filmstrip');
373 364
     }
374 365
 
375
-
376 366
     // TODO: remove this class once the old toolbar has been removed. This class
377 367
     // is set so that any CSS changes needed to adjust elements outside of the
378 368
     // new toolbar can be scoped to just the app with the new toolbar enabled.
379
-    if (interfaceConfig._USE_NEW_TOOLBOX && !interfaceConfig.filmStripOnly) {
369
+    if (!interfaceConfig.filmStripOnly) {
380 370
         $('body').addClass('use-new-toolbox');
381 371
     }
382 372
 
@@ -476,7 +466,6 @@ UI.initEtherpad = name => {
476 466
         = new EtherpadManager(config.etherpad_base, name, eventEmitter);
477 467
 
478 468
     APP.store.dispatch(setEtherpadHasInitialzied());
479
-    APP.store.dispatch(showEtherpadButton());
480 469
 };
481 470
 
482 471
 /**
@@ -544,8 +533,6 @@ UI.onPeerVideoTypeChanged
544 533
 UI.updateLocalRole = isModerator => {
545 534
     VideoLayout.showModeratorIndicator();
546 535
 
547
-    APP.store.dispatch(showSharedVideoButton());
548
-
549 536
     Recording.showRecordingButton(isModerator);
550 537
 
551 538
     if (isModerator) {
@@ -672,14 +659,9 @@ UI.inputDisplayNameHandler = function(newDisplayName) {
672 659
  * @param {number} timeout - The time to show the popup
673 660
  * @returns {void}
674 661
  */
675
-// eslint-disable-next-line max-params
662
+// eslint-disable-next-line max-params, no-unused-vars
676 663
 UI.showCustomToolbarPopup = function(buttonName, popupID, show, timeout) {
677
-    const action
678
-        = show
679
-            ? setButtonPopupTimeout(buttonName, popupID, timeout)
680
-            : clearButtonPopup(buttonName);
681
-
682
-    APP.store.dispatch(action);
664
+    // TODO: this is no longer implemented as of Toolbox v2. Remove?
683 665
 };
684 666
 
685 667
 /**
@@ -904,17 +886,6 @@ UI.promptDisplayName = () => {
904 886
  */
905 887
 UI.setAudioLevel = (id, lvl) => VideoLayout.setAudioLevel(id, lvl);
906 888
 
907
-/**
908
- * Update state of desktop sharing buttons.
909
- *
910
- * @returns {void}
911
- */
912
-UI.updateDesktopSharingButtons
913
-    = () =>
914
-        APP.store.dispatch(setToolbarButton('desktop', {
915
-            toggled: APP.conference.isSharingScreen
916
-        }));
917
-
918 889
 /**
919 890
  * Hide connection quality statistics from UI.
920 891
  */
@@ -946,8 +917,9 @@ UI.addMessage = function(from, displayName, message, stamp) {
946 917
     Chat.updateChatConversation(from, displayName, message, stamp);
947 918
 };
948 919
 
949
-UI.updateDTMFSupport
950
-    = isDTMFSupported => APP.store.dispatch(showDialPadButton(isDTMFSupported));
920
+// TODO: With Toolbox v2 this got scrapped. Remove?
921
+// eslint-disable-next-line no-empty-function
922
+UI.updateDTMFSupport = () => { };
951 923
 
952 924
 UI.updateRecordingState = function(state) {
953 925
     Recording.updateRecordingState(state);

+ 1
- 2
modules/UI/etherpad/Etherpad.js Visa fil

@@ -129,8 +129,7 @@ class Etherpad extends LargeContainer {
129 129
         let height, width;
130 130
 
131 131
         if (interfaceConfig.VERTICAL_FILMSTRIP) {
132
-            height = interfaceConfig._USE_NEW_TOOLBOX
133
-                ? containerHeight - getToolboxHeight() : containerHeight;
132
+            height = containerHeight - getToolboxHeight();
134 133
             width = containerWidth - Filmstrip.getFilmstripWidth();
135 134
         } else {
136 135
             height = containerHeight - Filmstrip.getFilmstripHeight();

+ 1
- 2
modules/UI/shared_video/SharedVideo.js Visa fil

@@ -699,8 +699,7 @@ class SharedVideoContainer extends LargeContainer {
699 699
         let height, width;
700 700
 
701 701
         if (interfaceConfig.VERTICAL_FILMSTRIP) {
702
-            height = interfaceConfig._USE_NEW_TOOLBOX
703
-                ? containerHeight - getToolboxHeight() : containerHeight;
702
+            height = containerHeight - getToolboxHeight();
704 703
             width = containerWidth - Filmstrip.getFilmstripWidth();
705 704
         } else {
706 705
             height = containerHeight - Filmstrip.getFilmstripHeight();

+ 5
- 9
modules/UI/side_pannels/chat/Chat.js Visa fil

@@ -1,4 +1,4 @@
1
-/* global APP, $, interfaceConfig */
1
+/* global APP, $ */
2 2
 
3 3
 import { processReplacements, linkify } from './Replacement';
4 4
 import CommandsProcessor from './Commands';
@@ -181,15 +181,11 @@ function resizeChatConversation() {
181 181
     $('#smileysContainer').css('bottom', msgareaHeight);
182 182
     chat.width(width - 10);
183 183
 
184
-    if (interfaceConfig._USE_NEW_TOOLBOX) {
185
-        const maybeAMagicNumberForPaddingAndMargin = 100;
186
-        const offset = maybeAMagicNumberForPaddingAndMargin
187
-            + msgareaHeight + getToolboxHeight();
184
+    const maybeAMagicNumberForPaddingAndMargin = 100;
185
+    const offset = maybeAMagicNumberForPaddingAndMargin
186
+        + msgareaHeight + getToolboxHeight();
188 187
 
189
-        chat.height(window.innerHeight - offset);
190
-    } else {
191
-        chat.height(window.innerHeight - 15 - msgareaHeight);
192
-    }
188
+    chat.height(window.innerHeight - offset);
193 189
 }
194 190
 
195 191
 /**

+ 2
- 16
react/features/conference/components/Conference.web.js Visa fil

@@ -14,7 +14,6 @@ import { NotificationsContainer } from '../../notifications';
14 14
 import { SidePanel } from '../../side-panel';
15 15
 import {
16 16
     Toolbox,
17
-    ToolboxV2,
18 17
     fullScreenChanged,
19 18
     setToolboxAlwaysVisible,
20 19
     showToolbox
@@ -139,7 +138,6 @@ class Conference extends Component<Props> {
139 138
      */
140 139
     render() {
141 140
         const {
142
-            _USE_NEW_TOOLBOX,
143 141
             VIDEO_QUALITY_LABEL_DISABLED,
144 142
             filmStripOnly
145 143
         } = interfaceConfig;
@@ -148,16 +146,6 @@ class Conference extends Component<Props> {
148 146
                 || VIDEO_QUALITY_LABEL_DISABLED
149 147
                 || this.props._iAmRecorder;
150 148
 
151
-        let ToolboxToUse;
152
-
153
-        if (filmStripOnly) {
154
-            ToolboxToUse = null;
155
-        } else if (interfaceConfig._USE_NEW_TOOLBOX) {
156
-            ToolboxToUse = ToolboxV2;
157
-        } else {
158
-            ToolboxToUse = Toolbox;
159
-        }
160
-
161 149
         return (
162 150
             <div
163 151
                 id = 'videoconference_page'
@@ -168,10 +156,8 @@ class Conference extends Component<Props> {
168 156
                     <Filmstrip filmstripOnly = { filmStripOnly } />
169 157
                 </div>
170 158
 
171
-                { ToolboxToUse && <ToolboxToUse /> }
172
-
173
-                { _USE_NEW_TOOLBOX && !filmStripOnly
174
-                    && <SidePanel /> }
159
+                { !filmStripOnly && <Toolbox /> }
160
+                { !filmStripOnly && <SidePanel /> }
175 161
 
176 162
                 <DialogContainer />
177 163
                 <NotificationsContainer />

+ 3
- 56
react/features/filmstrip/components/Filmstrip.web.js Visa fil

@@ -5,9 +5,7 @@ import PropTypes from 'prop-types';
5 5
 import React, { Component } from 'react';
6 6
 import { connect } from 'react-redux';
7 7
 
8
-import { getLocalParticipant, PARTICIPANT_ROLE } from '../../base/participants';
9
-import { InviteButton } from '../../invite';
10
-import { Toolbox, ToolboxFilmstrip, dockToolbox } from '../../toolbox';
8
+import { ToolboxFilmstrip, dockToolbox } from '../../toolbox';
11 9
 
12 10
 import { setFilmstripHovered } from '../actions';
13 11
 import { shouldRemoteVideosBeVisible } from '../functions';
@@ -35,29 +33,11 @@ class Filmstrip extends Component<*> {
35 33
      * @static
36 34
      */
37 35
     static propTypes = {
38
-        /**
39
-         * Whether invite button rendering should be skipped,
40
-         * by default it is. false
41
-         */
42
-        _hideInviteButton: PropTypes.bool,
43
-
44 36
         /**
45 37
          * Whether or not remote videos are currently being hovered over.
46 38
          */
47 39
         _hovered: PropTypes.bool,
48 40
 
49
-        /**
50
-         * Whether or not the feature to directly invite people into the
51
-         * conference is available.
52
-         */
53
-        _isAddToCallAvailable: PropTypes.bool,
54
-
55
-        /**
56
-         * Whether or not the feature to dial out to number to join the
57
-         * conference is available.
58
-         */
59
-        _isDialOutAvailable: PropTypes.bool,
60
-
61 41
         /**
62 42
          * Whether or not the remote videos should be visible. Will toggle
63 43
          * a class for hiding the videos.
@@ -115,9 +95,6 @@ class Filmstrip extends Component<*> {
115 95
      */
116 96
     render() {
117 97
         const {
118
-            _hideInviteButton,
119
-            _isAddToCallAvailable,
120
-            _isDialOutAvailable,
121 98
             _remoteVideosVisible,
122 99
             _toolboxVisible,
123 100
             filmstripOnly
@@ -136,12 +113,9 @@ class Filmstrip extends Component<*> {
136 113
         const filmstripClassNames = `filmstrip ${_remoteVideosVisible
137 114
             ? '' : 'hide-videos'} ${reduceHeight ? 'reduce-height' : ''}`;
138 115
 
139
-        const ToolboxToUse = interfaceConfig._USE_NEW_TOOLBOX
140
-            ? ToolboxFilmstrip : Toolbox;
141
-
142 116
         return (
143 117
             <div className = { filmstripClassNames }>
144
-                { filmstripOnly ? <ToolboxToUse /> : null }
118
+                { filmstripOnly && <ToolboxFilmstrip /> }
145 119
                 <div
146 120
                     className = 'filmstrip__videos'
147 121
                     id = 'remoteVideos'>
@@ -150,11 +124,6 @@ class Filmstrip extends Component<*> {
150 124
                         id = 'filmstripLocalVideo'
151 125
                         onMouseOut = { this._onMouseOut }
152 126
                         onMouseOver = { this._onMouseOver }>
153
-                        { filmstripOnly || _hideInviteButton
154
-                            ? null
155
-                            : <InviteButton
156
-                                enableAddPeople = { _isAddToCallAvailable }
157
-                                enableDialOut = { _isDialOutAvailable } /> }
158 127
                         <div id = 'filmstripLocalVideoThumbnail' />
159 128
                     </div>
160 129
                     <div
@@ -185,9 +154,7 @@ class Filmstrip extends Component<*> {
185 154
      */
186 155
     _notifyOfHoveredStateUpdate() {
187 156
         if (this.props._hovered !== this._isHovered) {
188
-            if (interfaceConfig._USE_NEW_TOOLBOX) {
189
-                this.props.dispatch(dockToolbox(this._isHovered));
190
-            }
157
+            this.props.dispatch(dockToolbox(this._isHovered));
191 158
             this.props.dispatch(setFilmstripHovered(this._isHovered));
192 159
         }
193 160
     }
@@ -223,36 +190,16 @@ class Filmstrip extends Component<*> {
223 190
  * @param {Object} state - The Redux state.
224 191
  * @private
225 192
  * @returns {{
226
- *     _hideInviteButton: boolean,
227 193
  *     _hovered: boolean,
228
- *     _isAddToCallAvailable: boolean,
229
- *     _isDialOutAvailable: boolean,
230 194
  *     _remoteVideosVisible: boolean,
231 195
  *     _toolboxVisible: boolean
232 196
  * }}
233 197
  */
234 198
 function _mapStateToProps(state) {
235
-    const { conference } = state['features/base/conference'];
236
-    const {
237
-        enableUserRolesBasedOnToken,
238
-        iAmRecorder
239
-    } = state['features/base/config'];
240
-    const { isGuest } = state['features/base/jwt'];
241 199
     const { hovered } = state['features/filmstrip'];
242 200
 
243
-    const isAddToCallAvailable = !isGuest;
244
-    const isDialOutAvailable
245
-        = getLocalParticipant(state).role === PARTICIPANT_ROLE.MODERATOR
246
-                && conference && conference.isSIPCallingSupported()
247
-                && (!enableUserRolesBasedOnToken || !isGuest);
248
-
249 201
     return {
250
-        _hideInviteButton: iAmRecorder
251
-            || (!isAddToCallAvailable && !isDialOutAvailable)
252
-            || interfaceConfig._USE_NEW_TOOLBOX,
253 202
         _hovered: hovered,
254
-        _isAddToCallAvailable: isAddToCallAvailable,
255
-        _isDialOutAvailable: isDialOutAvailable,
256 203
         _remoteVideosVisible: shouldRemoteVideosBeVisible(state),
257 204
         _toolboxVisible: state['features/toolbox'].visible
258 205
     };

+ 21
- 87
react/features/invite/components/InfoDialogButton.web.js Visa fil

@@ -1,5 +1,3 @@
1
-/* global interfaceConfig */
2
-
3 1
 import InlineDialog from '@atlaskit/inline-dialog';
4 2
 import PropTypes from 'prop-types';
5 3
 import React, { Component } from 'react';
@@ -8,30 +6,12 @@ import { connect } from 'react-redux';
8 6
 import { createToolbarEvent, sendAnalytics } from '../../analytics';
9 7
 import { translate } from '../../base/i18n';
10 8
 import { getParticipantCount } from '../../base/participants';
11
-import {
12
-    ToolbarButton,
13
-    ToolbarButtonV2,
14
-    TOOLTIP_TO_POPUP_POSITION
15
-} from '../../toolbox';
9
+import { ToolbarButtonV2 } from '../../toolbox';
16 10
 
17 11
 import { updateDialInNumbers } from '../actions';
18 12
 
19 13
 import { InfoDialog } from './info-dialog';
20 14
 
21
-/**
22
- * A configuration object to describe how {@code ToolbarButton} should render
23
- * the button.
24
- *
25
- * @type {object}
26
- */
27
-const DEFAULT_BUTTON_CONFIGURATION = {
28
-    buttonName: 'info',
29
-    classNames: [ 'button', 'icon-info' ],
30
-    enabled: true,
31
-    id: 'toolbar_button_info',
32
-    tooltipKey: 'info.tooltip'
33
-};
34
-
35 15
 /**
36 16
  * The amount of time, in milliseconds, to wait until automatically showing
37 17
  * the {@code InfoDialog}. This is essentially a hack as automatic showing
@@ -170,9 +150,26 @@ class InfoDialogButton extends Component {
170 150
      * @returns {ReactElement}
171 151
      */
172 152
     render() {
173
-        return interfaceConfig._USE_NEW_TOOLBOX
174
-            ? this._renderNewToolbarButton()
175
-            : this._renderOldToolbarButton();
153
+        const { t } = this.props;
154
+        const { showDialog } = this.state;
155
+        const iconClass = `icon-info ${showDialog ? 'toggled' : ''}`;
156
+
157
+        return (
158
+            <div className = 'toolbox-button-wth-dialog'>
159
+                <InlineDialog
160
+                    content = {
161
+                        <InfoDialog onClose = { this._onDialogClose } /> }
162
+                    isOpen = { showDialog }
163
+                    onClose = { this._onDialogClose }
164
+                    position = { 'top right' }>
165
+                    <ToolbarButtonV2
166
+                        accessibilityLabel = 'Info'
167
+                        iconName = { iconClass }
168
+                        onClick = { this._onDialogToggle }
169
+                        tooltip = { t('info.tooltip') } />
170
+                </InlineDialog>
171
+            </div>
172
+        );
176 173
     }
177 174
 
178 175
     /**
@@ -209,69 +206,6 @@ class InfoDialogButton extends Component {
209 206
 
210 207
         this.setState({ showDialog: !this.state.showDialog });
211 208
     }
212
-
213
-    /**
214
-     * Renders a React Element for the {@code InfoDialog} using legacy
215
-     * {@code ToolbarButton}.
216
-     *
217
-     * @private
218
-     * @returns {ReactElement}
219
-     */
220
-    _renderOldToolbarButton() {
221
-        const { tooltipPosition } = this.props;
222
-        const { showDialog } = this.state;
223
-
224
-        const buttonConfiguration = {
225
-            ...DEFAULT_BUTTON_CONFIGURATION,
226
-            classNames: [
227
-                ...DEFAULT_BUTTON_CONFIGURATION.classNames,
228
-                showDialog ? 'toggled button-active' : ''
229
-            ]
230
-        };
231
-
232
-        return (
233
-            <InlineDialog
234
-                content = { <InfoDialog onClose = { this._onDialogClose } /> }
235
-                isOpen = { showDialog }
236
-                onClose = { this._onDialogClose }
237
-                position = { TOOLTIP_TO_POPUP_POSITION[tooltipPosition] }>
238
-                <ToolbarButton
239
-                    button = { buttonConfiguration }
240
-                    onClick = { this._onDialogToggle }
241
-                    tooltipPosition = { tooltipPosition } />
242
-            </InlineDialog>
243
-        );
244
-    }
245
-
246
-    /**
247
-     * Renders a React Element for the {@code InfoDialog} using the newer
248
-     * {@code ToolbarButtonV2}.
249
-     *
250
-     * @private
251
-     * @returns {ReactElement}
252
-     */
253
-    _renderNewToolbarButton() {
254
-        const { t } = this.props;
255
-        const { showDialog } = this.state;
256
-        const iconClass = `icon-info ${showDialog ? 'toggled' : ''}`;
257
-
258
-        return (
259
-            <div className = 'toolbox-button-wth-dialog'>
260
-                <InlineDialog
261
-                    content = {
262
-                        <InfoDialog onClose = { this._onDialogClose } /> }
263
-                    isOpen = { showDialog }
264
-                    onClose = { this._onDialogClose }
265
-                    position = { 'top right' }>
266
-                    <ToolbarButtonV2
267
-                        accessibilityLabel = 'Info'
268
-                        iconName = { iconClass }
269
-                        onClick = { this._onDialogToggle }
270
-                        tooltip = { t('info.tooltip') } />
271
-                </InlineDialog>
272
-            </div>
273
-        );
274
-    }
275 209
 }
276 210
 
277 211
 /**

+ 0
- 11
react/features/toolbox/actionTypes.js Visa fil

@@ -61,17 +61,6 @@ export const SET_SUBJECT = Symbol('SET_SUBJECT');
61 61
  */
62 62
 export const SET_SUBJECT_SLIDE_IN = Symbol('SET_SUBJECT_SLIDE_IN');
63 63
 
64
-/**
65
- * The type of the action which sets the descriptor of a toolbar button.
66
- *
67
- * {
68
- *     type: SET_TOOLBAR_BUTTON,
69
- *     button: Object,
70
- *     key: string
71
- * }
72
- */
73
-export const SET_TOOLBAR_BUTTON = Symbol('SET_TOOLBAR_BUTTON');
74
-
75 64
 /**
76 65
  * The type of the action which sets the indicator which determiens whether a
77 66
  * fToolbar in the Toolbox is hovered.

+ 0
- 92
react/features/toolbox/actions.native.js Visa fil

@@ -1,12 +1,9 @@
1 1
 /* @flow */
2 2
 
3
-import type { Dispatch } from 'redux-thunk';
4
-
5 3
 import {
6 4
     CLEAR_TOOLBOX_TIMEOUT,
7 5
     SET_SUBJECT,
8 6
     SET_SUBJECT_SLIDE_IN,
9
-    SET_TOOLBAR_BUTTON,
10 7
     SET_TOOLBAR_HOVERED,
11 8
     SET_TOOLBOX_ALWAYS_VISIBLE,
12 9
     SET_TOOLBOX_ENABLED,
@@ -15,28 +12,6 @@ import {
15 12
     SET_TOOLBOX_VISIBLE
16 13
 } from './actionTypes';
17 14
 
18
-/**
19
- * FIXME: We should make sure all common functions for native and web are
20
- * merged in a global functions file.
21
- */
22
-import { getButton } from './functions.native';
23
-
24
-/**
25
- * Event handler for local raise hand changed event.
26
- *
27
- * @param {boolean} handRaised - Flag showing whether hand is raised.
28
- * @returns {Function}
29
- */
30
-export function changeLocalRaiseHand(handRaised: boolean): Function {
31
-    return (dispatch: Dispatch<*>, getState: Function) => {
32
-        const buttonName = 'raisehand';
33
-        const button = getButton(buttonName, getState());
34
-
35
-        button.toggled = handRaised;
36
-
37
-        dispatch(setToolbarButton(buttonName, button));
38
-    };
39
-}
40 15
 
41 16
 /**
42 17
  * Signals that toolbox timeout should be cleared.
@@ -81,25 +56,6 @@ export function setSubjectSlideIn(subjectSlideIn: boolean): Object {
81 56
     };
82 57
 }
83 58
 
84
-/**
85
- * Signals that value of the button specified by key should be changed.
86
- *
87
- * @param {string} buttonName - Button key.
88
- * @param {Object} button - Button object.
89
- * @returns {{
90
- *     type: SET_TOOLBAR_BUTTON,
91
- *     button: Object,
92
- *     buttonName: string
93
- * }}
94
- */
95
-export function setToolbarButton(buttonName: string, button: Object): Object {
96
-    return {
97
-        type: SET_TOOLBAR_BUTTON,
98
-        button,
99
-        buttonName
100
-    };
101
-}
102
-
103 59
 /**
104 60
  * Signals that toolbar is hovered value should be changed.
105 61
  *
@@ -203,51 +159,3 @@ export function setToolboxVisible(visible: boolean): Object {
203 159
         visible
204 160
     };
205 161
 }
206
-
207
-/**
208
- * Shows etherpad button if it's not shown.
209
- *
210
- * @returns {Function}
211
- */
212
-export function showEtherpadButton(): Function {
213
-    return (dispatch: Dispatch<*>) => {
214
-        dispatch(setToolbarButton('etherpad', {
215
-            hidden: false
216
-        }));
217
-    };
218
-}
219
-
220
-/**
221
- * Event handler for full screen toggled event.
222
- *
223
- * @param {boolean} isFullScreen - Flag showing whether app in full
224
- * screen mode.
225
- * @returns {Function}
226
- */
227
-export function toggleFullScreen(isFullScreen: boolean): Function {
228
-    return (dispatch: Dispatch<*>, getState: Function) => {
229
-        const buttonName = 'fullscreen';
230
-        const button = getButton(buttonName, getState());
231
-
232
-        if (button) {
233
-            button.toggled = isFullScreen;
234
-            dispatch(setToolbarButton(buttonName, button));
235
-        }
236
-    };
237
-}
238
-
239
-/**
240
- * Sets negation of button's toggle property.
241
- *
242
- * @param {string} buttonName - Button key.
243
- * @returns {Function}
244
- */
245
-export function toggleToolbarButton(buttonName: string): Function {
246
-    return (dispatch: Dispatch, getState: Function) => {
247
-        const button = getButton(buttonName, getState());
248
-
249
-        dispatch(setToolbarButton(buttonName, {
250
-            toggled: !button.toggled
251
-        }));
252
-    };
253
-}

+ 1
- 264
react/features/toolbox/actions.web.js Visa fil

@@ -1,73 +1,24 @@
1 1
 /* @flow */
2 2
 
3
-import Recording from '../../../modules/UI/recording/Recording';
4 3
 import SideContainerToggler
5 4
     from '../../../modules/UI/side_pannels/SideContainerToggler';
6 5
 
7
-import UIEvents from '../../../service/UI/UIEvents';
8
-
9 6
 import {
10
-    changeLocalRaiseHand,
11 7
     clearToolboxTimeout,
12 8
     setSubjectSlideIn,
13
-    setToolbarButton,
14 9
     setToolboxTimeout,
15 10
     setToolboxTimeoutMS,
16
-    setToolboxVisible,
17
-    toggleToolbarButton
11
+    setToolboxVisible
18 12
 } from './actions.native';
19 13
 import {
20 14
     FULL_SCREEN_CHANGED,
21
-    SET_DEFAULT_TOOLBOX_BUTTONS,
22 15
     SET_FULL_SCREEN
23 16
 } from './actionTypes';
24
-import {
25
-    getButton,
26
-    getDefaultToolboxButtons,
27
-    isButtonEnabled
28
-} from './functions';
29 17
 
30
-declare var $: Function;
31
-declare var APP: Object;
32
-declare var config: Object;
33 18
 declare var interfaceConfig: Object;
34 19
 
35 20
 export * from './actions.native';
36 21
 
37
-/**
38
- * Checks whether desktop sharing is enabled and whether
39
- * we have params to start automatically sharing.
40
- *
41
- * @returns {Function}
42
- */
43
-export function checkAutoEnableDesktopSharing(): Function {
44
-    return () => {
45
-        // XXX Should use dispatcher to toggle screensharing but screensharing
46
-        // hasn't been React-ified yet.
47
-        if (isButtonEnabled('desktop')
48
-                && config.autoEnableDesktopSharing) {
49
-            APP.UI.eventEmitter.emit(UIEvents.TOGGLE_SCREENSHARING);
50
-        }
51
-    };
52
-}
53
-
54
-/**
55
- * Dispatches an action to hide any popups displayed by the associated button.
56
- *
57
- * @param {string} buttonName - The name of the button as specified in the
58
- * button configurations for the toolbar.
59
- * @returns {Function}
60
- */
61
-export function clearButtonPopup(buttonName) {
62
-    return (dispatch, getState) => {
63
-        _clearPopupTimeout(buttonName, getState());
64
-
65
-        dispatch(setToolbarButton(buttonName, {
66
-            popupDisplay: null
67
-        }));
68
-    };
69
-}
70
-
71 22
 /**
72 23
  * Docks/undocks the Toolbox.
73 24
  *
@@ -115,56 +66,6 @@ export function fullScreenChanged(fullScreen: boolean) {
115 66
     };
116 67
 }
117 68
 
118
-/**
119
- * Returns button on mount/unmount handlers with dispatch function stored in
120
- * closure.
121
- *
122
- * @param {Function} dispatch - Redux action dispatcher.
123
- * @returns {Object} Button on mount/unmount handlers.
124
- * @private
125
- */
126
-function _getButtonHandlers(dispatch) {
127
-    const localRaiseHandHandler
128
-        = (...args) => dispatch(changeLocalRaiseHand(...args));
129
-
130
-    return {
131
-        /**
132
-         * Mount handler for desktop button.
133
-         *
134
-         * @type {Object}
135
-         */
136
-        desktop: {
137
-            onMount: () => dispatch(showDesktopSharingButton())
138
-        },
139
-
140
-        /**
141
-         * Mount/Unmount handlers for raisehand button.
142
-         *
143
-         * @type {button}
144
-         */
145
-        raisehand: {
146
-            onMount: () =>
147
-                APP.UI.addListener(
148
-                    UIEvents.LOCAL_RAISE_HAND_CHANGED,
149
-                    localRaiseHandHandler),
150
-            onUnmount: () =>
151
-                APP.UI.removeListener(
152
-                    UIEvents.LOCAL_RAISE_HAND_CHANGED,
153
-                    localRaiseHandHandler)
154
-        },
155
-
156
-        /**
157
-         * Mount handler for recording button.
158
-         *
159
-         * @type {Object}
160
-         */
161
-        recording: {
162
-            onMount: () =>
163
-                config.enableRecording && dispatch(showRecordingButton())
164
-        }
165
-    };
166
-}
167
-
168 69
 /**
169 70
  * Hides the toolbox.
170 71
  *
@@ -202,97 +103,6 @@ export function hideToolbox(force: boolean = false): Function {
202 103
     };
203 104
 }
204 105
 
205
-/**
206
- * Dispatches an action to show the popup associated with a button. Sets a
207
- * timeout to be fired which will dismiss the popup.
208
- *
209
- * @param {string} buttonName - The name of the button as specified in the
210
- * button configurations for the toolbar.
211
- * @param {string} popupName - The id of the popup to show as specified in
212
- * the button configurations for the toolbar.
213
- * @param {number} timeout - The time in milliseconds to show the popup.
214
- * @returns {Function}
215
- */
216
-export function setButtonPopupTimeout(buttonName, popupName, timeout) {
217
-    return (dispatch, getState) => {
218
-        _clearPopupTimeout(buttonName, getState());
219
-
220
-        const newTimeoutId = setTimeout(() => {
221
-            dispatch(clearButtonPopup(buttonName));
222
-        }, timeout);
223
-
224
-        dispatch(setToolbarButton(buttonName, {
225
-            popupDisplay: {
226
-                popupID: popupName,
227
-                timeoutID: newTimeoutId
228
-            }
229
-        }));
230
-    };
231
-}
232
-
233
-/**
234
- * Sets the default toolbar buttons of the Toolbox.
235
- *
236
- * @returns {Function}
237
- */
238
-export function setDefaultToolboxButtons(): Function {
239
-    return (dispatch: Dispatch) => {
240
-        // Save dispatch function in closure.
241
-        const buttonHandlers = _getButtonHandlers(dispatch);
242
-        const toolboxButtons = getDefaultToolboxButtons(buttonHandlers);
243
-
244
-        dispatch({
245
-            type: SET_DEFAULT_TOOLBOX_BUTTONS,
246
-            ...toolboxButtons
247
-        });
248
-    };
249
-}
250
-
251
-/**
252
- * Shows desktop sharing button.
253
- *
254
- * @returns {Function}
255
- */
256
-export function showDesktopSharingButton(): Function {
257
-    return (dispatch: Dispatch<*>) => {
258
-        const buttonName = 'desktop';
259
-        const disabledTooltipText
260
-            = APP.conference.desktopSharingDisabledTooltip;
261
-        const showTooltip
262
-            = disabledTooltipText
263
-                && APP.conference.isDesktopSharingDisabledByConfig;
264
-        const visible
265
-            = isButtonEnabled(buttonName)
266
-                && (APP.conference.isDesktopSharingEnabled || showTooltip);
267
-
268
-        const newState = {
269
-            enabled: APP.conference.isDesktopSharingEnabled,
270
-            hidden: !visible,
271
-            tooltipText: showTooltip ? disabledTooltipText : undefined
272
-        };
273
-
274
-        dispatch(setToolbarButton(buttonName, newState));
275
-    };
276
-}
277
-
278
-/**
279
- * Shows or hides the dialpad button.
280
- *
281
- * @param {boolean} show - Flag showing whether to show button or not.
282
- * @returns {Function}
283
- */
284
-export function showDialPadButton(show: boolean): Function {
285
-    return (dispatch: Dispatch<*>) => {
286
-        const buttonName = 'dialpad';
287
-
288
-        if (show && isButtonEnabled(buttonName)) {
289
-            dispatch(setToolbarButton(buttonName, {
290
-                hidden: false
291
-            }));
292
-        }
293
-    };
294
-}
295
-
296 106
 /**
297 107
  * Signals a request to enter or exit full screen mode.
298 108
  *
@@ -309,39 +119,6 @@ export function setFullScreen(fullScreen: boolean) {
309 119
     };
310 120
 }
311 121
 
312
-/**
313
- * Shows recording button.
314
- *
315
- * @returns {Function}
316
- */
317
-export function showRecordingButton(): Function {
318
-    return (dispatch: Dispatch<*>) => {
319
-        dispatch(setToolbarButton('recording', {
320
-            hidden: false
321
-        }));
322
-
323
-        Recording.initRecordingButton();
324
-    };
325
-}
326
-
327
-/**
328
- * Shows or hides the 'shared video' button.
329
- *
330
- * @returns {Function}
331
- */
332
-export function showSharedVideoButton(): Function {
333
-    return (dispatch: Dispatch<*>) => {
334
-        const buttonName = 'sharedvideo';
335
-
336
-        if (isButtonEnabled(buttonName)
337
-                && !config.disableThirdPartyRequests) {
338
-            dispatch(setToolbarButton(buttonName, {
339
-                hidden: false
340
-            }));
341
-        }
342
-    };
343
-}
344
-
345 122
 /**
346 123
  * Shows the toolbox for specified timeout.
347 124
  *
@@ -374,43 +151,3 @@ export function showToolbox(timeout: number = 0): Object {
374 151
         }
375 152
     };
376 153
 }
377
-
378
-/**
379
- * Event handler for side toolbar container toggled event.
380
- *
381
- * @param {string} containerId - ID of the container.
382
- * @returns {Function}
383
- */
384
-export function toggleSideToolbarContainer(containerId: string): Function {
385
-    return (dispatch: Dispatch, getState: Function) => {
386
-        const { secondaryToolbarButtons } = getState()['features/toolbox'];
387
-
388
-        for (const key of secondaryToolbarButtons.keys()) {
389
-            const button = secondaryToolbarButtons.get(key);
390
-
391
-            if (isButtonEnabled(key)
392
-                    && button.sideContainerId
393
-                    && button.sideContainerId === containerId) {
394
-                dispatch(toggleToolbarButton(key));
395
-                break;
396
-            }
397
-        }
398
-    };
399
-}
400
-
401
-/**
402
- * Clears the timeout set for hiding a button popup.
403
- *
404
- * @param {string} buttonName - The name of the button as specified in the
405
- * button configurations for the toolbar.
406
- * @param {Object} state - The redux state in which the button is expected to
407
- * be defined.
408
- * @private
409
- * @returns {void}
410
- */
411
-function _clearPopupTimeout(buttonName, state) {
412
-    const { popupDisplay } = getButton(buttonName, state);
413
-    const { timeoutID } = popupDisplay || {};
414
-
415
-    clearTimeout(timeoutID);
416
-}

+ 0
- 97
react/features/toolbox/components/PrimaryToolbar.web.js Visa fil

@@ -1,97 +0,0 @@
1
-/* @flow */
2
-
3
-import PropTypes from 'prop-types';
4
-import React, { Component } from 'react';
5
-import { connect } from 'react-redux';
6
-
7
-import { getToolbarClassNames } from '../functions';
8
-import Toolbar from './Toolbar';
9
-
10
-declare var interfaceConfig: Object;
11
-
12
-/**
13
- * Implementation of PrimaryToolbar React Component.
14
- *
15
- * @class PrimaryToolbar
16
- * @extends Component
17
- */
18
-class PrimaryToolbar extends Component<*, *> {
19
-    static propTypes = {
20
-
21
-        /**
22
-         * Contains toolbar buttons for primary toolbar.
23
-         */
24
-        _primaryToolbarButtons: PropTypes.instanceOf(Map),
25
-
26
-        /**
27
-         * Shows whether toolbox is visible.
28
-         */
29
-        _visible: PropTypes.bool
30
-    };
31
-
32
-    state: Object;
33
-
34
-    /**
35
-     * Renders primary toolbar component.
36
-     *
37
-     * @returns {ReactElement}
38
-     */
39
-    render(): React$Element<*> | null {
40
-        const { _primaryToolbarButtons } = this.props;
41
-
42
-        // The number of buttons to show in the toolbar isn't fixed, it depends
43
-        // on the availability of features and configuration parameters. So
44
-        // there may be nothing to render.
45
-        if (_primaryToolbarButtons.size === 0) {
46
-            return null;
47
-        }
48
-
49
-        const { primaryToolbarClassName } = getToolbarClassNames(this.props);
50
-        const tooltipPosition
51
-            = interfaceConfig.filmStripOnly ? 'left' : 'bottom';
52
-
53
-        return (
54
-            <Toolbar
55
-                className = { primaryToolbarClassName }
56
-                toolbarButtons = { _primaryToolbarButtons }
57
-                tooltipPosition = { tooltipPosition } />
58
-        );
59
-    }
60
-}
61
-
62
-/**
63
- * Maps part of Redux store to React component props.
64
- *
65
- * @param {Object} state - Snapshot of Redux store.
66
- * @returns {{
67
- *     _primaryToolbarButtons: Map,
68
- *     _visible: boolean
69
- * }}
70
- * @private
71
- */
72
-function _mapStateToProps(state: Object): Object {
73
-    const {
74
-        primaryToolbarButtons,
75
-        visible
76
-    } = state['features/toolbox'];
77
-
78
-    return {
79
-        /**
80
-         * Default toolbar buttons for primary toolbar.
81
-         *
82
-         * @private
83
-         * @type {Map}
84
-         */
85
-        _primaryToolbarButtons: primaryToolbarButtons,
86
-
87
-        /**
88
-         * Shows whether toolbox is visible.
89
-         *
90
-         * @private
91
-         * @type {boolean}
92
-         */
93
-        _visible: visible
94
-    };
95
-}
96
-
97
-export default connect(_mapStateToProps)(PrimaryToolbar);

+ 0
- 188
react/features/toolbox/components/SecondaryToolbar.web.js Visa fil

@@ -1,188 +0,0 @@
1
-/* @flow */
2
-
3
-import PropTypes from 'prop-types';
4
-import React, { Component } from 'react';
5
-import { connect } from 'react-redux';
6
-
7
-import { FeedbackButton } from '../../feedback';
8
-import UIEvents from '../../../../service/UI/UIEvents';
9
-
10
-import {
11
-    toggleSideToolbarContainer
12
-} from '../actions';
13
-import { getToolbarClassNames } from '../functions';
14
-import Toolbar from './Toolbar';
15
-
16
-declare var APP: Object;
17
-declare var config: Object;
18
-
19
-/**
20
- * Implementation of secondary toolbar React component.
21
- *
22
- * @class SecondaryToolbar
23
- * @extends Component
24
- */
25
-class SecondaryToolbar extends Component<*, *> {
26
-    state: Object;
27
-
28
-    /**
29
-     * Secondary toolbar property types.
30
-     *
31
-     * @static
32
-     */
33
-    static propTypes = {
34
-        /**
35
-         * Application ID for callstats.io API. The {@code FeedbackButton} will
36
-         * display if defined.
37
-         */
38
-        _callStatsID: PropTypes.string,
39
-
40
-        /**
41
-         * The indicator which determines whether the local participant is a
42
-         * guest in the conference.
43
-         */
44
-        _isGuest: PropTypes.bool,
45
-
46
-        /**
47
-         * Handler dispatching toggle toolbar container.
48
-         */
49
-        _onSideToolbarContainerToggled: PropTypes.func,
50
-
51
-        /**
52
-         * Contains map of secondary toolbar buttons.
53
-         */
54
-        _secondaryToolbarButtons: PropTypes.instanceOf(Map),
55
-
56
-        /**
57
-         * Shows whether toolbox is visible.
58
-         */
59
-        _visible: PropTypes.bool
60
-    };
61
-
62
-    /**
63
-     * Register legacy UI listener.
64
-     *
65
-     * @returns {void}
66
-     */
67
-    componentDidMount(): void {
68
-        APP.UI.addListener(
69
-            UIEvents.SIDE_TOOLBAR_CONTAINER_TOGGLED,
70
-            this.props._onSideToolbarContainerToggled);
71
-    }
72
-
73
-    /**
74
-     * Unregisters legacy UI listener.
75
-     *
76
-     * @returns {void}
77
-     */
78
-    componentWillUnmount(): void {
79
-        APP.UI.removeListener(
80
-            UIEvents.SIDE_TOOLBAR_CONTAINER_TOGGLED,
81
-            this.props._onSideToolbarContainerToggled);
82
-    }
83
-
84
-    /**
85
-     * Renders secondary toolbar component.
86
-     *
87
-     * @returns {ReactElement}
88
-     */
89
-    render(): React$Element<*> | null {
90
-        const { _callStatsID, _secondaryToolbarButtons } = this.props;
91
-
92
-        // The number of buttons to show in the toolbar isn't fixed, it depends
93
-        // on the availability of features and configuration parameters. So
94
-        // there may be nothing to render.
95
-        if (_secondaryToolbarButtons.size === 0) {
96
-            return null;
97
-        }
98
-
99
-        const { secondaryToolbarClassName } = getToolbarClassNames(this.props);
100
-
101
-        return (
102
-            <Toolbar
103
-                className = { secondaryToolbarClassName }
104
-                toolbarButtons = { _secondaryToolbarButtons }
105
-                tooltipPosition = 'right'>
106
-                { _callStatsID
107
-                    ? <FeedbackButton tooltipPosition = 'right' /> : null }
108
-            </Toolbar>
109
-        );
110
-    }
111
-}
112
-
113
-/**
114
- * Maps some of Redux actions to component's props.
115
- *
116
- * @param {Function} dispatch - Redux action dispatcher.
117
- * @returns {{
118
- *     _onSideToolbarContainerToggled
119
- * }}
120
- * @private
121
- */
122
-function _mapDispatchToProps(dispatch: Function): Object {
123
-    return {
124
-
125
-        /**
126
-         * Dispatches an action signalling that side toolbar container is
127
-         * toggled.
128
-         *
129
-         * @param {string} containerId - Id of side toolbar container.
130
-         * @returns {Object} Dispatched action.
131
-         */
132
-        _onSideToolbarContainerToggled(containerId: string) {
133
-            dispatch(toggleSideToolbarContainer(containerId));
134
-        }
135
-    };
136
-}
137
-
138
-/**
139
- * Maps part of Redux state to component's props.
140
- *
141
- * @param {Object} state - Snapshot of Redux store.
142
- * @returns {{
143
- *     _isGuest: boolean,
144
- *     _secondaryToolbarButtons: Map,
145
- *     _visible: boolean
146
- * }}
147
- * @private
148
- */
149
-function _mapStateToProps(state: Object): Object {
150
-    const { isGuest } = state['features/base/jwt'];
151
-    const { secondaryToolbarButtons, visible } = state['features/toolbox'];
152
-    const { callStatsID } = state['features/base/config'];
153
-
154
-    return {
155
-        /**
156
-         * Application ID for callstats.io API.
157
-         */
158
-        _callStatsID: callStatsID,
159
-
160
-        /**
161
-         * The indicator which determines whether the local participant is a
162
-         * guest in the conference.
163
-         *
164
-         * @private
165
-         * @type {boolean}
166
-         */
167
-        _isGuest: isGuest,
168
-
169
-        /**
170
-         * Default toolbar buttons for secondary toolbar.
171
-         *
172
-         * @private
173
-         * @type {Map}
174
-         */
175
-        _secondaryToolbarButtons: secondaryToolbarButtons,
176
-
177
-        /**
178
-         * The indicator which determines whether the {@code SecondaryToolbar}
179
-         * is visible.
180
-         *
181
-         * @private
182
-         * @type {boolean}
183
-         */
184
-        _visible: visible
185
-    };
186
-}
187
-
188
-export default connect(_mapStateToProps, _mapDispatchToProps)(SecondaryToolbar);

+ 0
- 181
react/features/toolbox/components/Toolbar.web.js Visa fil

@@ -1,181 +0,0 @@
1
-// @flow
2
-
3
-import PropTypes from 'prop-types';
4
-import React, { Component } from 'react';
5
-import { connect } from 'react-redux';
6
-
7
-import { setToolbarHovered } from '../actions';
8
-
9
-import StatelessToolbar from './StatelessToolbar';
10
-import ToolbarButton from './ToolbarButton';
11
-
12
-/**
13
- * Implements a toolbar in React/Web. It is a strip that contains a set of
14
- * toolbar items such as buttons. Toolbar is commonly placed inside of a
15
- * Toolbox.
16
- *
17
- * @class Toolbar
18
- * @extends Component
19
- */
20
-class Toolbar extends Component<*> {
21
-    /**
22
-     * Base toolbar component's property types.
23
-     *
24
-     * @static
25
-     */
26
-    static propTypes = {
27
-        /**
28
-         * Children of current React component.
29
-         */
30
-        children: PropTypes.element,
31
-
32
-        /**
33
-         * Toolbar's class name.
34
-         */
35
-        className: PropTypes.string,
36
-
37
-        /**
38
-         * Used to dispatch an action when a button is clicked or on mouse
39
-         * out/in event.
40
-         */
41
-        dispatch: PropTypes.func,
42
-
43
-        /**
44
-         * Map with toolbar buttons.
45
-         */
46
-        toolbarButtons: PropTypes.instanceOf(Map),
47
-
48
-        /**
49
-         * Indicates the position of the tooltip.
50
-         */
51
-        tooltipPosition: PropTypes.oneOf([ 'bottom', 'left', 'right', 'top' ])
52
-    };
53
-
54
-    /**
55
-     * Constructor of Primary toolbar class.
56
-     *
57
-     * @param {Object} props - Object containing React component properties.
58
-     */
59
-    constructor(props: Object) {
60
-        super(props);
61
-
62
-        // Bind callbacks to preverse this.
63
-        this._onMouseOut = this._onMouseOut.bind(this);
64
-        this._onMouseOver = this._onMouseOver.bind(this);
65
-        this._renderToolbarButton = this._renderToolbarButton.bind(this);
66
-    }
67
-
68
-    /**
69
-     * Implements React's {@link Component#render()}.
70
-     *
71
-     * @inheritdoc
72
-     * @returns {ReactElement}
73
-     */
74
-    render(): React$Element<*> {
75
-        const props = {
76
-            className: this.props.className,
77
-            onMouseOut: this._onMouseOut,
78
-            onMouseOver: this._onMouseOver
79
-        };
80
-
81
-        return (
82
-            <StatelessToolbar { ...props }>
83
-                {
84
-                    [ ...this.props.toolbarButtons.entries() ]
85
-                        .map(this._renderToolbarButton)
86
-                }
87
-                {
88
-                    this.props.children
89
-                }
90
-            </StatelessToolbar>
91
-        );
92
-    }
93
-
94
-    _onMouseOut: () => void;
95
-
96
-    /**
97
-     * Dispatches an action signalling that toolbar is no being hovered.
98
-     *
99
-     * @protected
100
-     * @returns {void}
101
-     */
102
-    _onMouseOut() {
103
-        this.props.dispatch(setToolbarHovered(false));
104
-    }
105
-
106
-    _onMouseOver: () => void;
107
-
108
-    /**
109
-     * Dispatches an action signalling that toolbar is now being hovered.
110
-     *
111
-     * @protected
112
-     * @returns {void}
113
-     */
114
-    _onMouseOver() {
115
-        this.props.dispatch(setToolbarHovered(true));
116
-    }
117
-
118
-    _renderToolbarButton: (Array<*>) => React$Element<*>;
119
-
120
-    /**
121
-     * Renders toolbar button. Method is passed to map function.
122
-     *
123
-     * @param {Array} keyValuePair - Key value pair containing button and its
124
-     * key.
125
-     * @private
126
-     * @returns {ReactElement} A toolbar button.
127
-     */
128
-    _renderToolbarButton([ key, button ]): React$Element<*> {
129
-        const { tooltipPosition } = this.props;
130
-
131
-        if (button.component) {
132
-            return (
133
-                <button.component
134
-                    key = { key }
135
-                    toggled = { button.toggled }
136
-                    tooltipPosition = { tooltipPosition } />
137
-            );
138
-        }
139
-
140
-        const {
141
-            childComponent: ChildComponent,
142
-            onClick,
143
-            onMount,
144
-            onUnmount
145
-        } = button;
146
-        const onClickWithDispatch = (...args) =>
147
-            onClick && onClick(this.props.dispatch, ...args);
148
-
149
-        return (
150
-            <ToolbarButton
151
-                button = { button }
152
-                key = { key }
153
-
154
-                // TODO The following disables an eslint error alerting about a
155
-                // known potential/theoretical performance pernalty:
156
-                //
157
-                // A bind call or arrow function in a JSX prop will create a
158
-                // brand new function on every single render. This is bad for
159
-                // performance, as it will result in the garbage collector being
160
-                // invoked way more than is necessary. It may also cause
161
-                // unnecessary re-renders if a brand new function is passed as a
162
-                // prop to a component that uses reference equality check on the
163
-                // prop to determine if it should update.
164
-                //
165
-                // I'm not addressing the potential/theoretical performance
166
-                // penalty at the time of this writing because I don't know for
167
-                // a fact that it's a practical performance penalty in the case.
168
-                //
169
-                // eslint-disable-next-line react/jsx-no-bind
170
-                onClick = { onClickWithDispatch }
171
-                onMount = { onMount }
172
-                onUnmount = { onUnmount }
173
-                tooltipPosition = { tooltipPosition }>
174
-                { button.html || null }
175
-                { ChildComponent ? <ChildComponent /> : null }
176
-            </ToolbarButton>
177
-        );
178
-    }
179
-}
180
-
181
-export default connect()(Toolbar);

+ 1091
- 159
react/features/toolbox/components/Toolbox.web.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 0
- 0
react/features/toolbox/components/ToolboxV2.native.js Visa fil


+ 0
- 1169
react/features/toolbox/components/ToolboxV2.web.js
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 1
- 2
react/features/toolbox/components/index.js Visa fil

@@ -2,6 +2,5 @@ export { default as ToolbarButton } from './ToolbarButton';
2 2
 export { default as ToolbarButtonV2 } from './ToolbarButtonV2';
3 3
 export { default as ToolbarButtonWithDialog }
4 4
     from './ToolbarButtonWithDialog';
5
-export { default as Toolbox } from './Toolbox';
6 5
 export { default as ToolboxFilmstrip } from './ToolboxFilmstrip';
7
-export { default as ToolboxV2 } from './ToolboxV2';
6
+export { default as Toolbox } from './Toolbox';

+ 0
- 1
react/features/toolbox/defaultToolbarButtons.native.js Visa fil

@@ -1 +0,0 @@
1
-export default undefined;

+ 0
- 532
react/features/toolbox/defaultToolbarButtons.web.js Visa fil

@@ -1,532 +0,0 @@
1
-// @flow
2
-
3
-import React from 'react';
4
-
5
-import { setFullScreen } from '../toolbox';
6
-import {
7
-    ACTION_SHORTCUT_TRIGGERED as TRIGGERED,
8
-    AUDIO_MUTE,
9
-    VIDEO_MUTE,
10
-    createShortcutEvent,
11
-    createToolbarEvent,
12
-    sendAnalytics
13
-} from '../analytics';
14
-import {
15
-    getLocalParticipant,
16
-    participantUpdated
17
-} from '../base/participants';
18
-import { ParticipantCounter } from '../contact-list';
19
-import { openDeviceSelectionDialog } from '../device-selection';
20
-import { InfoDialogButton } from '../invite';
21
-import UIEvents from '../../../service/UI/UIEvents';
22
-import { VideoQualityButton } from '../video-quality';
23
-
24
-import ProfileButton from './components/ProfileButton';
25
-
26
-declare var APP: Object;
27
-declare var interfaceConfig: Object;
28
-
29
-/**
30
- * The cache of {@link getDefaultButtons()}.
31
- */
32
-let defaultButtons: Object;
33
-
34
-/**
35
- * Returns a map of all button descriptors and according properties.
36
- *
37
- * @returns {Object} - The maps of default button descriptors.
38
- */
39
-export default function getDefaultButtons() {
40
-    if (defaultButtons) {
41
-        return defaultButtons;
42
-    }
43
-
44
-    defaultButtons = {
45
-        /**
46
-         * The descriptor of the camera toolbar button.
47
-         */
48
-        camera: {
49
-            classNames: [ 'button', 'icon-camera' ],
50
-            enabled: true,
51
-            isDisplayed: () => true,
52
-            id: 'toolbar_button_camera',
53
-            onClick() {
54
-                // TODO: Why is this different from the code which handles
55
-                // a keyboard shortcut?
56
-                const newVideoMutedState = !APP.conference.isLocalVideoMuted();
57
-
58
-                // The 'enable' attribute in the event is set to true if the
59
-                // button click triggered a mute action, and set to false if it
60
-                // triggered an unmute action.
61
-                sendAnalytics(createToolbarEvent(
62
-                    VIDEO_MUTE,
63
-                    {
64
-                        enable: newVideoMutedState
65
-                    }));
66
-                APP.UI.emitEvent(UIEvents.VIDEO_MUTED, newVideoMutedState);
67
-            },
68
-            popups: [
69
-                {
70
-                    dataAttr: 'audioOnly.featureToggleDisabled',
71
-                    dataInterpolate: { feature: 'video mute' },
72
-                    id: 'unmuteWhileAudioOnly'
73
-                }
74
-            ],
75
-            shortcut: 'V',
76
-            shortcutAttr: 'toggleVideoPopover',
77
-            shortcutFunc() {
78
-                if (APP.conference.isAudioOnly()) {
79
-                    APP.UI.emitEvent(UIEvents.VIDEO_UNMUTING_WHILE_AUDIO_ONLY);
80
-
81
-                    return;
82
-                }
83
-
84
-                // The 'enable' attribute in the event is set to true if the
85
-                // shortcut triggered a mute action, and set to false if it
86
-                // triggered an unmute action.
87
-                sendAnalytics(createShortcutEvent(
88
-                    VIDEO_MUTE,
89
-                    TRIGGERED,
90
-                    { enable: !APP.conference.isLocalVideoMuted() }));
91
-                APP.conference.toggleVideoMuted();
92
-            },
93
-            shortcutDescription: 'keyboardShortcuts.videoMute',
94
-            tooltipKey: 'toolbar.videomute'
95
-        },
96
-
97
-        /**
98
-         * The descriptor of the chat toolbar button.
99
-         */
100
-        chat: {
101
-            classNames: [ 'button', 'icon-chat' ],
102
-            enabled: true,
103
-            html: <span className = 'badge-round'>
104
-                <span id = 'unreadMessages' /></span>,
105
-            id: 'toolbar_button_chat',
106
-            onClick() {
107
-                // The 'enable' attribute is set to true if the click resulted
108
-                // in the chat panel being shown, and to false if it was hidden.
109
-                sendAnalytics(createToolbarEvent(
110
-                    'toggle.chat',
111
-                    {
112
-                        enable: !APP.UI.isChatVisible()
113
-                    }));
114
-                APP.UI.emitEvent(UIEvents.TOGGLE_CHAT);
115
-            },
116
-            shortcut: 'C',
117
-            shortcutAttr: 'toggleChatPopover',
118
-            shortcutFunc() {
119
-                // The 'enable' attribute is set to true if the shortcut
120
-                // resulted in the chat panel being shown, and to false if it
121
-                // was hidden.
122
-                sendAnalytics(createShortcutEvent(
123
-                    'toggle.chat',
124
-                    {
125
-                        enable: !APP.UI.isChatVisible()
126
-                    }));
127
-                APP.UI.toggleChat();
128
-            },
129
-            shortcutDescription: 'keyboardShortcuts.toggleChat',
130
-            sideContainerId: 'chat_container',
131
-            tooltipKey: 'toolbar.chat'
132
-        },
133
-
134
-        /**
135
-         * The descriptor of the contact list toolbar button.
136
-         */
137
-        contacts: {
138
-            childComponent: ParticipantCounter,
139
-            classNames: [ 'button', 'icon-contactList' ],
140
-            enabled: true,
141
-            id: 'toolbar_contact_list',
142
-            onClick() {
143
-                // TODO: Include an 'enable' attribute which specifies whether
144
-                // the contacts panel was shown or hidden.
145
-                sendAnalytics(createToolbarEvent('contacts'));
146
-                APP.UI.emitEvent(UIEvents.TOGGLE_CONTACT_LIST);
147
-            },
148
-            sideContainerId: 'contacts_container',
149
-            tooltipKey: 'bottomtoolbar.contactlist'
150
-        },
151
-
152
-        /**
153
-         * The descriptor of the desktop sharing toolbar button.
154
-         */
155
-        desktop: {
156
-            classNames: [ 'button', 'icon-share-desktop' ],
157
-            enabled: true,
158
-            id: 'toolbar_button_desktopsharing',
159
-            onClick() {
160
-                // TODO: Why is the button clicked handled differently that
161
-                // a keyboard shortcut press (firing a TOGGLE_SCREENSHARING
162
-                // event vs. directly calling toggleScreenSharing())?
163
-                sendAnalytics(createToolbarEvent(
164
-                    'screen.sharing',
165
-                    {
166
-                        enable: !APP.conference.isSharingScreen
167
-                    }));
168
-                APP.UI.emitEvent(UIEvents.TOGGLE_SCREENSHARING);
169
-            },
170
-            popups: [
171
-                {
172
-                    dataAttr: 'audioOnly.featureToggleDisabled',
173
-                    dataInterpolate: { feature: 'screen sharing' },
174
-                    id: 'screenshareWhileAudioOnly'
175
-                }
176
-            ],
177
-            shortcut: 'D',
178
-            shortcutAttr: 'toggleDesktopSharingPopover',
179
-            shortcutFunc() {
180
-                // The 'enable' attribute is set to true if pressing the
181
-                // shortcut resulted in screen sharing being enabled, and false
182
-                // if it resulted in screen sharing being disabled.
183
-                sendAnalytics(createShortcutEvent(
184
-                    'toggle.screen.sharing',
185
-                    TRIGGERED,
186
-                    { enable: !APP.conference.isSharingScreen }));
187
-
188
-                // eslint-disable-next-line no-empty-function
189
-                APP.conference.toggleScreenSharing().catch(() => {});
190
-            },
191
-            shortcutDescription: 'keyboardShortcuts.toggleScreensharing',
192
-            tooltipKey: 'toolbar.sharescreen'
193
-        },
194
-
195
-        /**
196
-         * The descriptor of the device selection toolbar button.
197
-         */
198
-        fodeviceselection: {
199
-            classNames: [ 'button', 'icon-settings' ],
200
-            enabled: true,
201
-            isDisplayed() {
202
-                return interfaceConfig.filmStripOnly;
203
-            },
204
-            id: 'toolbar_button_fodeviceselection',
205
-            onClick(dispatch: Function) {
206
-                sendAnalytics(
207
-                    createToolbarEvent('filmstrip.only.device.selection'));
208
-
209
-                dispatch(openDeviceSelectionDialog());
210
-            },
211
-            sideContainerId: 'settings_container',
212
-            tooltipKey: 'toolbar.Settings'
213
-        },
214
-
215
-        /**
216
-         * The descriptor of the dialpad toolbar button.
217
-         */
218
-        dialpad: {
219
-            classNames: [ 'button', 'icon-dialpad' ],
220
-            enabled: true,
221
-
222
-            // TODO: remove it after UI.updateDTMFSupport fix
223
-            hidden: true,
224
-            id: 'toolbar_button_dialpad',
225
-            onClick() {
226
-                sendAnalytics(createToolbarEvent('dialpad'));
227
-            },
228
-            tooltipKey: 'toolbar.dialpad'
229
-        },
230
-
231
-        /**
232
-         * The descriptor of the etherpad toolbar button.
233
-         */
234
-        etherpad: {
235
-            classNames: [ 'button', 'icon-share-doc' ],
236
-            enabled: true,
237
-            hidden: true,
238
-            id: 'toolbar_button_etherpad',
239
-            onClick() {
240
-                // The 'enable' attribute is set to true if the click resulted
241
-                // in the etherpad panel being shown, or false it it was hidden.
242
-                sendAnalytics(createToolbarEvent(
243
-                    'toggle.etherpad',
244
-                    {
245
-                        enable: !APP.UI.isEtherpadVisible()
246
-                    }));
247
-                APP.UI.emitEvent(UIEvents.ETHERPAD_CLICKED);
248
-            },
249
-            tooltipKey: 'toolbar.etherpad'
250
-        },
251
-
252
-        /**
253
-         * The descriptor of the toolbar button which toggles full-screen mode.
254
-         */
255
-        fullscreen: {
256
-            classNames: [ 'button', 'icon-full-screen' ],
257
-            enabled: true,
258
-            id: 'toolbar_button_fullScreen',
259
-            onClick() {
260
-                const state = APP.store.getState();
261
-                const isFullScreen = Boolean(
262
-                    state['features/toolbox'].fullScreen);
263
-
264
-                // The 'enable' attribute is set to true if the action resulted
265
-                // in fullscreen mode being enabled.
266
-                sendAnalytics(createToolbarEvent(
267
-                    'toggle.fullscreen',
268
-                        {
269
-                            enable: !isFullScreen
270
-                        }));
271
-
272
-                APP.store.dispatch(setFullScreen(!isFullScreen));
273
-            },
274
-            shortcut: 'S',
275
-            shortcutAttr: 'toggleFullscreenPopover',
276
-            shortcutDescription: 'keyboardShortcuts.fullScreen',
277
-            shortcutFunc() {
278
-                const state = APP.store.getState();
279
-                const isFullScreen = Boolean(
280
-                    state['features/toolbox'].fullScreen);
281
-
282
-                // The 'enable' attribute is set to true if the action resulted
283
-                // in fullscreen mode being enabled.
284
-                sendAnalytics(createShortcutEvent(
285
-                    'toggle.fullscreen',
286
-                    {
287
-                        enable: !isFullScreen
288
-                    }));
289
-
290
-                APP.store.dispatch(setFullScreen(!isFullScreen));
291
-            },
292
-            tooltipKey: 'toolbar.fullscreen'
293
-        },
294
-
295
-        /**
296
-         * The descriptor of the toolbar button which hangs up the
297
-         * call/conference.
298
-         */
299
-        hangup: {
300
-            classNames: [ 'button', 'icon-hangup', 'button_hangup' ],
301
-            enabled: true,
302
-            isDisplayed: () => true,
303
-            id: 'toolbar_button_hangup',
304
-            onClick() {
305
-                sendAnalytics(createToolbarEvent('hangup'));
306
-                APP.UI.emitEvent(UIEvents.HANGUP);
307
-            },
308
-            tooltipKey: 'toolbar.hangup'
309
-        },
310
-
311
-        /**
312
-         * The descriptor of the toolbar button which opens a dialog for the
313
-         * conference URL and inviting others.
314
-         */
315
-        info: {
316
-            component: InfoDialogButton
317
-        },
318
-
319
-        /**
320
-         * The descriptor of the microphone toolbar button.
321
-         */
322
-        microphone: {
323
-            classNames: [ 'button', 'icon-microphone' ],
324
-            enabled: true,
325
-            isDisplayed: () => true,
326
-            id: 'toolbar_button_mute',
327
-            onClick() {
328
-                const sharedVideoManager = APP.UI.getSharedVideoManager();
329
-
330
-                // TODO: Clicking the mute button and pressing the mute shortcut
331
-                // could be handled in a uniform manner. The code below checks
332
-                // the mute status and fires the appropriate event (MUTED or
333
-                // UNMUTED), while the code which handles the keyboard shortcut
334
-                // calls toggleAudioMuted(). Also strangely the the user is
335
-                // only warned if they click the button (and not if they use
336
-                // the shortcut).
337
-                if (APP.conference.isLocalAudioMuted()) {
338
-                    // If there's a shared video with the volume "on" and we
339
-                    // aren't the video owner, we warn the user
340
-                    // that currently it's not possible to unmute.
341
-                    if (sharedVideoManager
342
-                        && sharedVideoManager.isSharedVideoVolumeOn()
343
-                        && !sharedVideoManager.isSharedVideoOwner()) {
344
-                        APP.UI.showCustomToolbarPopup(
345
-                            'microphone', 'unableToUnmutePopup', true, 5000);
346
-                    } else {
347
-                        sendAnalytics(createToolbarEvent(
348
-                            AUDIO_MUTE,
349
-                            { enable: false }));
350
-                        APP.UI.emitEvent(UIEvents.AUDIO_MUTED, false, true);
351
-                    }
352
-                } else {
353
-                    sendAnalytics(createToolbarEvent(
354
-                        AUDIO_MUTE,
355
-                        { enable: true }));
356
-                    APP.UI.emitEvent(UIEvents.AUDIO_MUTED, true, true);
357
-                }
358
-            },
359
-            popups: [
360
-                {
361
-                    dataAttr: 'toolbar.micMutedPopup',
362
-                    id: 'micMutedPopup'
363
-                },
364
-                {
365
-                    dataAttr: 'toolbar.unableToUnmutePopup',
366
-                    id: 'unableToUnmutePopup'
367
-                },
368
-                {
369
-                    dataAttr: 'toolbar.talkWhileMutedPopup',
370
-                    id: 'talkWhileMutedPopup'
371
-                }
372
-            ],
373
-            shortcut: 'M',
374
-            shortcutAttr: 'mutePopover',
375
-            shortcutFunc() {
376
-                // The 'enable' attribute in the event is set to true if the
377
-                // shortcut triggered a mute action, and set to false if it
378
-                // triggered an unmute action.
379
-                sendAnalytics(createShortcutEvent(
380
-                    AUDIO_MUTE,
381
-                    TRIGGERED,
382
-                    { enable: !APP.conference.isLocalAudioMuted() }));
383
-                APP.conference.toggleAudioMuted();
384
-            },
385
-            shortcutDescription: 'keyboardShortcuts.mute',
386
-            tooltipKey: 'toolbar.mute'
387
-        },
388
-
389
-        /**
390
-         * The descriptor of the profile toolbar button.
391
-         */
392
-        profile: {
393
-            component: ProfileButton,
394
-            sideContainerId: 'profile_container'
395
-        },
396
-
397
-        /**
398
-         * The descriptor of the "Raise hand" toolbar button.
399
-         */
400
-        raisehand: {
401
-            classNames: [ 'button', 'icon-raised-hand' ],
402
-            enabled: true,
403
-            id: 'toolbar_button_raisehand',
404
-            onClick() {
405
-                // TODO: reduce duplication with shortcutFunc below.
406
-                const localParticipant
407
-                    = getLocalParticipant(APP.store.getState());
408
-                const currentRaisedHand = localParticipant.raisedHand;
409
-
410
-                // The 'enable' attribute is set to true if the pressing of the
411
-                // shortcut resulted in the hand being raised, and to false
412
-                // if it resulted in the hand being 'lowered'.
413
-                sendAnalytics(createToolbarEvent(
414
-                    'raise.hand',
415
-                    { enable: !currentRaisedHand }));
416
-
417
-                APP.store.dispatch(participantUpdated({
418
-                    id: localParticipant.id,
419
-                    local: true,
420
-                    raisedHand: !currentRaisedHand
421
-                }));
422
-            },
423
-            shortcut: 'R',
424
-            shortcutAttr: 'raiseHandPopover',
425
-            shortcutDescription: 'keyboardShortcuts.raiseHand',
426
-            shortcutFunc() {
427
-                const localParticipant
428
-                    = getLocalParticipant(APP.store.getState());
429
-                const currentRaisedHand = localParticipant.raisedHand;
430
-
431
-                // The 'enable' attribute is set to true if the pressing of the
432
-                // shortcut resulted in the hand being raised, and to false
433
-                // if it resulted in the hand being 'lowered'.
434
-                sendAnalytics(createShortcutEvent(
435
-                    'toggle.raise.hand',
436
-                    TRIGGERED,
437
-                    { enable: !currentRaisedHand }));
438
-
439
-                APP.store.dispatch(participantUpdated({
440
-                    id: localParticipant.id,
441
-                    local: true,
442
-                    raisedHand: !currentRaisedHand
443
-                }));
444
-            },
445
-            tooltipKey: 'toolbar.raiseHand'
446
-        },
447
-
448
-        /**
449
-         * The descriptor of the recording toolbar button. Requires additional
450
-         * initialization in the recording module.
451
-         */
452
-        recording: {
453
-            classNames: [ 'button' ],
454
-            enabled: true,
455
-
456
-            // will be displayed once the recording functionality is detected
457
-            hidden: true,
458
-            id: 'toolbar_button_record',
459
-            tooltipKey: 'liveStreaming.buttonTooltip'
460
-        },
461
-
462
-        /**
463
-         * The descriptor of the settings toolbar button.
464
-         */
465
-        settings: {
466
-            classNames: [ 'button', 'icon-settings' ],
467
-            enabled: true,
468
-            id: 'toolbar_button_settings',
469
-            onClick() {
470
-                // TODO: Include an 'enable' attribute which specifies whether
471
-                // the settings panel was shown or hidden.
472
-                sendAnalytics(createToolbarEvent('settings'));
473
-                APP.UI.emitEvent(UIEvents.TOGGLE_SETTINGS);
474
-            },
475
-            sideContainerId: 'settings_container',
476
-            tooltipKey: 'toolbar.Settings'
477
-        },
478
-
479
-        /**
480
-         * The descriptor of the "Share YouTube video" toolbar button.
481
-         */
482
-        sharedvideo: {
483
-            classNames: [ 'button', 'icon-shared-video' ],
484
-            enabled: true,
485
-            id: 'toolbar_button_sharedvideo',
486
-            onClick() {
487
-                // The 'enable' attribute is set to true if the click resulted
488
-                // in the "start sharing video" dialog being shown, and false
489
-                // if it resulted in the "stop sharing video" dialog being
490
-                // shown.
491
-                sendAnalytics(createToolbarEvent(
492
-                    'shared.video.toggled',
493
-                    {
494
-                        enable: !APP.UI.isSharedVideoShown()
495
-                    }));
496
-                APP.UI.emitEvent(UIEvents.SHARED_VIDEO_CLICKED);
497
-            },
498
-            popups: [
499
-                {
500
-                    dataAttr: 'toolbar.sharedVideoMutedPopup',
501
-                    id: 'sharedVideoMutedPopup'
502
-                }
503
-            ],
504
-            tooltipKey: 'toolbar.sharedvideo'
505
-        },
506
-
507
-        videoquality: {
508
-            component: VideoQualityButton
509
-        }
510
-    };
511
-
512
-    Object.keys(defaultButtons).forEach(name => {
513
-        const button = defaultButtons[name];
514
-
515
-        if (!button.isDisplayed) {
516
-            button.isDisplayed = _isDisplayed;
517
-        }
518
-    });
519
-
520
-    return defaultButtons;
521
-}
522
-
523
-/**
524
- * The default implementation of the {@code isDisplayed} method of the toolbar
525
- * button definition returned by {@link getDefaultButtons()}.
526
- *
527
- * @returns {boolean} If the user intarface is full i.e. not filmstrip-only,
528
- * then {@code true}; otherwise, {@code false}.
529
- */
530
-function _isDisplayed() {
531
-    return !interfaceConfig.filmStripOnly;
532
-}

+ 0
- 106
react/features/toolbox/functions.web.js Visa fil

@@ -1,10 +1,5 @@
1 1
 // @flow
2 2
 
3
-import SideContainerToggler
4
-    from '../../../modules/UI/side_pannels/SideContainerToggler';
5
-
6
-import getDefaultButtons from './defaultToolbarButtons';
7
-
8 3
 declare var interfaceConfig: Object;
9 4
 
10 5
 export {
@@ -13,92 +8,6 @@ export {
13 8
     getButton
14 9
 } from './functions.native';
15 10
 
16
-/**
17
- * Returns an object which contains the default buttons for the primary and
18
- * secondary toolbars.
19
- *
20
- * @param {Object} buttonHandlers - Contains additional toolbox button
21
- * handlers.
22
- * @returns {Object}
23
- */
24
-export function getDefaultToolboxButtons(buttonHandlers: Object): Object {
25
-    let toolbarButtons = {
26
-        primaryToolbarButtons: new Map(),
27
-        secondaryToolbarButtons: new Map()
28
-    };
29
-
30
-    if (typeof interfaceConfig !== 'undefined'
31
-            && interfaceConfig.TOOLBAR_BUTTONS) {
32
-
33
-        toolbarButtons
34
-            = interfaceConfig.TOOLBAR_BUTTONS.reduce(
35
-                (acc, buttonName) => {
36
-                    const buttons = getDefaultButtons();
37
-                    let button = buttons ? buttons[buttonName] : null;
38
-                    const currentButtonHandlers = buttonHandlers[buttonName];
39
-
40
-                    if (button) {
41
-                        const place = _getToolbarButtonPlace(buttonName);
42
-
43
-                        button.buttonName = buttonName;
44
-
45
-                        if (currentButtonHandlers) {
46
-                            button = {
47
-                                ...button,
48
-                                ...currentButtonHandlers
49
-                            };
50
-                        }
51
-
52
-                        // If isDisplayed method is not defined, display the
53
-                        // button only for non-filmstripOnly mode
54
-                        if (button.isDisplayed()) {
55
-                            acc[place].set(buttonName, button);
56
-                        }
57
-                    }
58
-
59
-                    return acc;
60
-                },
61
-                toolbarButtons);
62
-    }
63
-
64
-    return toolbarButtons;
65
-}
66
-
67
-/**
68
- * Returns toolbar class names to add while rendering.
69
- *
70
- * @param {Object} props - Props object pass to React component.
71
- * @returns {Object}
72
- * @private
73
- */
74
-export function getToolbarClassNames(props: Object) {
75
-    const primaryToolbarClassNames = [
76
-        interfaceConfig.filmStripOnly
77
-            ? 'toolbar_filmstrip-only'
78
-            : 'toolbar_primary'
79
-    ];
80
-    const secondaryToolbarClassNames = [ 'toolbar_secondary' ];
81
-
82
-    if (props._visible) {
83
-        const slideInAnimation
84
-            = SideContainerToggler.isVisible ? 'slideInExtX' : 'slideInX';
85
-
86
-        primaryToolbarClassNames.push('fadeIn');
87
-        secondaryToolbarClassNames.push(slideInAnimation);
88
-    } else {
89
-        const slideOutAnimation
90
-            = SideContainerToggler.isVisible ? 'slideOutExtX' : 'slideOutX';
91
-
92
-        primaryToolbarClassNames.push('fadeOut');
93
-        secondaryToolbarClassNames.push(slideOutAnimation);
94
-    }
95
-
96
-    return {
97
-        primaryToolbarClassName: primaryToolbarClassNames.join(' '),
98
-        secondaryToolbarClassName: secondaryToolbarClassNames.join(' ')
99
-    };
100
-}
101
-
102 11
 /**
103 12
  * Helper for getting the height of the toolbox.
104 13
  *
@@ -122,18 +31,3 @@ export function isButtonEnabled(name: string) {
122 31
     return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1
123 32
             || interfaceConfig.MAIN_TOOLBAR_BUTTONS.indexOf(name) !== -1;
124 33
 }
125
-
126
-/**
127
- * Get place for toolbar button. Now it can be in the primary Toolbar or in the
128
- * secondary Toolbar.
129
- *
130
- * @param {string} btn - Button name.
131
- * @private
132
- * @returns {string}
133
- */
134
-function _getToolbarButtonPlace(btn) {
135
-    return (
136
-        interfaceConfig.MAIN_TOOLBAR_BUTTONS.includes(btn)
137
-            ? 'primaryToolbarButtons'
138
-            : 'secondaryToolbarButtons');
139
-}

+ 1
- 102
react/features/toolbox/middleware.js Visa fil

@@ -1,17 +1,9 @@
1 1
 // @flow
2 2
 
3
-import {
4
-    MEDIA_TYPE,
5
-    SET_AUDIO_AVAILABLE,
6
-    SET_VIDEO_AVAILABLE
7
-} from '../base/media';
8 3
 import { MiddlewareRegistry } from '../base/redux';
9
-import { isLocalTrackMuted, TRACK_UPDATED } from '../base/tracks';
10 4
 
11
-import { setToolbarButton, toggleFullScreen } from './actions';
12 5
 import {
13 6
     CLEAR_TOOLBOX_TIMEOUT,
14
-    FULL_SCREEN_CHANGED,
15 7
     SET_TOOLBOX_TIMEOUT,
16 8
     SET_FULL_SCREEN
17 9
 } from './actionTypes';
@@ -34,12 +26,6 @@ MiddlewareRegistry.register(store => next => action => {
34 26
         break;
35 27
     }
36 28
 
37
-    case FULL_SCREEN_CHANGED:
38
-        return _fullScreenChanged(store, next, action);
39
-
40
-    case SET_AUDIO_AVAILABLE:
41
-        return _setMediaAvailableOrMuted(store, next, action);
42
-
43 29
     case SET_FULL_SCREEN:
44 30
         return _setFullScreen(next, action);
45 31
 
@@ -48,102 +34,15 @@ MiddlewareRegistry.register(store => next => action => {
48 34
         const { handler, timeoutMS } = action;
49 35
 
50 36
         clearTimeout(timeoutID);
51
-        const newTimeoutId = setTimeout(handler, timeoutMS);
37
+        action.timeoutID = setTimeout(handler, timeoutMS);
52 38
 
53
-        action.timeoutID = newTimeoutId;
54 39
         break;
55 40
     }
56
-
57
-    case SET_VIDEO_AVAILABLE:
58
-        return _setMediaAvailableOrMuted(store, next, action);
59
-
60
-    case TRACK_UPDATED:
61
-        if (action.track.jitsiTrack.isLocal()) {
62
-            return _setMediaAvailableOrMuted(store, next, action);
63
-        }
64
-        break;
65 41
     }
66 42
 
67 43
     return next(action);
68 44
 });
69 45
 
70
-/**
71
- * Updates the the redux state with the current known state of full screen.
72
- *
73
- * @param {Store} store - The redux store in which the specified action is being
74
- * dispatched.
75
- * @param {Dispatch} next - The redux dispatch function to dispatch the
76
- * specified action to the specified store.
77
- * @param {Action} action - The redux action FULL_SCREEN_CHANGED which is being
78
- * dispatched in the specified store.
79
- * @private
80
- * @returns {Object} The value returned by {@code next(action)}.
81
- */
82
-function _fullScreenChanged({ dispatch }, next, action) {
83
-    if (typeof APP === 'object') {
84
-        dispatch(toggleFullScreen(action.fullScreen));
85
-    }
86
-
87
-    return next(action);
88
-}
89
-
90
-/**
91
- * Adjusts the state of toolbar's microphone or camera button.
92
- *
93
- * @param {Store} store - The redux store.
94
- * @param {Function} next - The redux function to continue dispatching the
95
- * specified {@code action} in the specified {@code store}.
96
- * @param {Object} action - {@code SET_AUDIO_AVAILABLE},
97
- * {@code SET_VIDEO_AVAILABLE}, or {@code TRACK_UPDATED}.
98
- * @returns {*}
99
- */
100
-function _setMediaAvailableOrMuted({ dispatch, getState }, next, action) {
101
-    const result = next(action);
102
-
103
-    let mediaType;
104
-
105
-    switch (action.type) {
106
-    case SET_AUDIO_AVAILABLE:
107
-        mediaType = MEDIA_TYPE.AUDIO;
108
-        break;
109
-
110
-    case SET_VIDEO_AVAILABLE:
111
-        mediaType = MEDIA_TYPE.VIDEO;
112
-        break;
113
-
114
-    case TRACK_UPDATED:
115
-        mediaType
116
-            = action.track.jitsiTrack.isAudioTrack()
117
-                ? MEDIA_TYPE.AUDIO
118
-                : MEDIA_TYPE.VIDEO;
119
-        break;
120
-
121
-    default:
122
-        throw new Error(`Unsupported action ${action}`);
123
-    }
124
-
125
-    const state = getState();
126
-    const { audio, video } = state['features/base/media'];
127
-    const { available } = mediaType === MEDIA_TYPE.AUDIO ? audio : video;
128
-    const i18nKey
129
-        = mediaType === MEDIA_TYPE.AUDIO
130
-            ? available ? 'mute' : 'micDisabled'
131
-            : available ? 'videomute' : 'cameraDisabled';
132
-    const tracks = state['features/base/tracks'];
133
-    const muted = isLocalTrackMuted(tracks, mediaType);
134
-
135
-    dispatch(
136
-        setToolbarButton(
137
-            mediaType === MEDIA_TYPE.AUDIO ? 'microphone' : 'camera',
138
-            {
139
-                enabled: available,
140
-                i18n: `[content]toolbar.${i18nKey}`,
141
-                toggled: available ? muted : true
142
-            }));
143
-
144
-    return result;
145
-}
146
-
147 46
 /**
148 47
  * Makes an external request to enter or exit full screen mode.
149 48
  *

+ 0
- 48
react/features/toolbox/reducer.js Visa fil

@@ -8,7 +8,6 @@ import {
8 8
     SET_DEFAULT_TOOLBOX_BUTTONS,
9 9
     SET_SUBJECT,
10 10
     SET_SUBJECT_SLIDE_IN,
11
-    SET_TOOLBAR_BUTTON,
12 11
     SET_TOOLBAR_HOVERED,
13 12
     SET_TOOLBOX_ALWAYS_VISIBLE,
14 13
     SET_TOOLBOX_ENABLED,
@@ -16,7 +15,6 @@ import {
16 15
     SET_TOOLBOX_TIMEOUT_MS,
17 16
     SET_TOOLBOX_VISIBLE
18 17
 } from './actionTypes';
19
-import getDefaultButtons from './defaultToolbarButtons';
20 18
 
21 19
 declare var interfaceConfig: Object;
22 20
 
@@ -161,9 +159,6 @@ ReducerRegistry.register(
161 159
                 subjectSlideIn: action.subjectSlideIn
162 160
             };
163 161
 
164
-        case SET_TOOLBAR_BUTTON:
165
-            return _setToolbarButton(state, action);
166
-
167 162
         case SET_TOOLBAR_HOVERED:
168 163
             return {
169 164
                 ...state,
@@ -204,46 +199,3 @@ ReducerRegistry.register(
204 199
 
205 200
         return state;
206 201
     });
207
-
208
-/**
209
- * Reduces the redux action {@code SET_TOOLBAR_BUTTON} in the feature toolbox.
210
- *
211
- * @param {Object} state - The redux state.
212
- * @param {Object} action - The redux action of type {@code SET_TOOLBAR_BUTTON}.
213
- * @param {Object} action.button - Object describing toolbar button.
214
- * @param {Object} action.buttonName - The name of the button.
215
- * @private
216
- * @returns {Object}
217
- */
218
-function _setToolbarButton(state, { button, buttonName }): Object {
219
-    // XXX getDefaultButtons, defaultToolbarButtons, SET_TOOLBAR_BUTTON are
220
-    // abstractions fully implemented on Web only.
221
-    const buttons = getDefaultButtons && getDefaultButtons();
222
-    const buttonDefinition = buttons && buttons[buttonName];
223
-
224
-    // We don't need to update if the button shouldn't be displayed
225
-    if (!buttonDefinition || !buttonDefinition.isDisplayed()) {
226
-        return state;
227
-    }
228
-
229
-    const { primaryToolbarButtons, secondaryToolbarButtons } = state;
230
-    let selectedButton = primaryToolbarButtons.get(buttonName);
231
-    let place = 'primaryToolbarButtons';
232
-
233
-    if (!selectedButton) {
234
-        selectedButton = secondaryToolbarButtons.get(buttonName);
235
-        place = 'secondaryToolbarButtons';
236
-    }
237
-
238
-    selectedButton = {
239
-        ...selectedButton,
240
-        ...button
241
-    };
242
-
243
-    const updatedToolbar = state[place].set(buttonName, selectedButton);
244
-
245
-    return {
246
-        ...state,
247
-        [place]: new Map(updatedToolbar)
248
-    };
249
-}

Laddar…
Avbryt
Spara