Browse Source

ref(isButtonEnable): UIUtil -> toolbox

j8
hristoterezov 8 years ago
parent
commit
fe59084979

+ 5
- 2
conference.js View File

64
     mediaPermissionPromptVisibilityChanged,
64
     mediaPermissionPromptVisibilityChanged,
65
     suspendDetected
65
     suspendDetected
66
 } from './react/features/overlay';
66
 } from './react/features/overlay';
67
-import { showDesktopSharingButton } from './react/features/toolbox';
67
+import {
68
+    isButtonEnabled,
69
+    showDesktopSharingButton
70
+} from './react/features/toolbox';
68
 
71
 
69
 const { participantConnectionStatus } = JitsiMeetJS.constants;
72
 const { participantConnectionStatus } = JitsiMeetJS.constants;
70
 
73
 
714
                 this._createRoom(tracks);
717
                 this._createRoom(tracks);
715
                 APP.remoteControl.init();
718
                 APP.remoteControl.init();
716
 
719
 
717
-                if (UIUtil.isButtonEnabled('contacts')
720
+                if (isButtonEnabled('contacts')
718
                     && !interfaceConfig.filmStripOnly) {
721
                     && !interfaceConfig.filmStripOnly) {
719
                     APP.UI.ContactList = new ContactList(room);
722
                     APP.UI.ContactList = new ContactList(room);
720
                 }
723
                 }

+ 5
- 5
modules/UI/side_pannels/SidePanels.js View File

2
 import SettingsMenu from './settings/SettingsMenu';
2
 import SettingsMenu from './settings/SettingsMenu';
3
 import Profile from './profile/Profile';
3
 import Profile from './profile/Profile';
4
 import ContactListView from './contactlist/ContactListView';
4
 import ContactListView from './contactlist/ContactListView';
5
-import UIUtil from '../util/UIUtil';
5
+import { isButtonEnabled } from '../../../react/features/toolbox';
6
 
6
 
7
 const SidePanels = {
7
 const SidePanels = {
8
     init (eventEmitter) {
8
     init (eventEmitter) {
9
         // Initialize chat
9
         // Initialize chat
10
-        if (UIUtil.isButtonEnabled('chat')) {
10
+        if (isButtonEnabled('chat')) {
11
             Chat.init(eventEmitter);
11
             Chat.init(eventEmitter);
12
         }
12
         }
13
 
13
 
14
         // Initialize settings
14
         // Initialize settings
15
-        if (UIUtil.isButtonEnabled('settings')) {
15
+        if (isButtonEnabled('settings')) {
16
             SettingsMenu.init(eventEmitter);
16
             SettingsMenu.init(eventEmitter);
17
         }
17
         }
18
 
18
 
19
         // Initialize profile
19
         // Initialize profile
20
-        if (UIUtil.isButtonEnabled('profile')) {
20
+        if (isButtonEnabled('profile')) {
21
             Profile.init(eventEmitter);
21
             Profile.init(eventEmitter);
22
         }
22
         }
23
 
23
 
24
         // Initialize contact list view
24
         // Initialize contact list view
25
-        if (UIUtil.isButtonEnabled('contacts')) {
25
+        if (isButtonEnabled('contacts')) {
26
             ContactListView.init();
26
             ContactListView.init();
27
         }
27
         }
28
     }
28
     }

+ 0
- 21
modules/UI/util/UIUtil.js View File

226
         }
226
         }
227
     },
227
     },
228
 
228
 
229
-    /**
230
-     * Indicates if a toolbar button is enabled.
231
-     * @param name the name of the setting section as defined in
232
-     * interface_config.js and Toolbar.js
233
-     * @returns {boolean} {true} to indicate that the given toolbar button
234
-     * is enabled, {false} - otherwise
235
-     */
236
-    isButtonEnabled(name) {
237
-        return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1
238
-                || interfaceConfig.MAIN_TOOLBAR_BUTTONS.indexOf(name) !== -1;
239
-    },
240
     /**
229
     /**
241
      * Indicates if the setting section is enabled.
230
      * Indicates if the setting section is enabled.
242
      *
231
      *
322
         }
311
         }
323
     },
312
     },
324
 
313
 
325
-    hideDisabledButtons(mappings) {
326
-        var selector = Object.keys(mappings)
327
-          .map(function (buttonName) {
328
-                return UIUtil.isButtonEnabled(buttonName)
329
-                    ? null : "#" + mappings[buttonName].id; })
330
-          .filter(function (item) { return item; })
331
-          .join(',');
332
-        $(selector).hide();
333
-    },
334
-
335
     redirect(url) {
314
     redirect(url) {
336
          window.location.href = url;
315
          window.location.href = url;
337
     },
316
     },

+ 10
- 8
react/features/toolbox/actions.web.js View File

18
     toggleToolbarButton
18
     toggleToolbarButton
19
 } from './actions.native';
19
 } from './actions.native';
20
 import { SET_DEFAULT_TOOLBOX_BUTTONS } from './actionTypes';
20
 import { SET_DEFAULT_TOOLBOX_BUTTONS } from './actionTypes';
21
-import { getDefaultToolboxButtons } from './functions';
21
+import {
22
+    getDefaultToolboxButtons,
23
+    isButtonEnabled
24
+} from './functions';
22
 
25
 
23
 declare var $: Function;
26
 declare var $: Function;
24
 declare var APP: Object;
27
 declare var APP: Object;
37
     return () => {
40
     return () => {
38
         // XXX Should use dispatcher to toggle screensharing but screensharing
41
         // XXX Should use dispatcher to toggle screensharing but screensharing
39
         // hasn't been React-ified yet.
42
         // hasn't been React-ified yet.
40
-        if (UIUtil.isButtonEnabled('desktop')
43
+        if (isButtonEnabled('desktop')
41
                 && config.autoEnableDesktopSharing) {
44
                 && config.autoEnableDesktopSharing) {
42
             APP.UI.eventEmitter.emit(UIEvents.TOGGLE_SCREENSHARING);
45
             APP.UI.eventEmitter.emit(UIEvents.TOGGLE_SCREENSHARING);
43
         }
46
         }
241
             = disabledTooltipText
244
             = disabledTooltipText
242
                 && APP.conference.isDesktopSharingDisabledByConfig;
245
                 && APP.conference.isDesktopSharingDisabledByConfig;
243
         const visible
246
         const visible
244
-            = UIUtil.isButtonEnabled(buttonName)
247
+            = isButtonEnabled(buttonName)
245
                 && (APP.conference.isDesktopSharingEnabled || showTooltip);
248
                 && (APP.conference.isDesktopSharingEnabled || showTooltip);
246
 
249
 
247
         const newState = {
250
         const newState = {
264
     return (dispatch: Dispatch<*>) => {
267
     return (dispatch: Dispatch<*>) => {
265
         const buttonName = 'dialpad';
268
         const buttonName = 'dialpad';
266
 
269
 
267
-        if (show && UIUtil.isButtonEnabled(buttonName)) {
270
+        if (show && isButtonEnabled(buttonName)) {
268
             dispatch(setToolbarButton(buttonName, {
271
             dispatch(setToolbarButton(buttonName, {
269
                 hidden: false
272
                 hidden: false
270
             }));
273
             }));
296
     return (dispatch: Dispatch<*>) => {
299
     return (dispatch: Dispatch<*>) => {
297
         const buttonName = 'sharedvideo';
300
         const buttonName = 'sharedvideo';
298
 
301
 
299
-        if (UIUtil.isButtonEnabled(buttonName)
302
+        if (isButtonEnabled(buttonName)
300
                 && !config.disableThirdPartyRequests) {
303
                 && !config.disableThirdPartyRequests) {
301
             dispatch(setToolbarButton(buttonName, {
304
             dispatch(setToolbarButton(buttonName, {
302
                 hidden: false
305
                 hidden: false
318
 
321
 
319
         if (show
322
         if (show
320
                 && APP.conference.sipGatewayEnabled()
323
                 && APP.conference.sipGatewayEnabled()
321
-                && UIUtil.isButtonEnabled(buttonName)
324
+                && isButtonEnabled(buttonName)
322
                 && (!config.enableUserRolesBasedOnToken
325
                 && (!config.enableUserRolesBasedOnToken
323
                     || !getState()['features/jwt'].isGuest)) {
326
                     || !getState()['features/jwt'].isGuest)) {
324
             dispatch(setToolbarButton(buttonName, {
327
             dispatch(setToolbarButton(buttonName, {
372
         const { secondaryToolbarButtons } = getState()['features/toolbox'];
375
         const { secondaryToolbarButtons } = getState()['features/toolbox'];
373
 
376
 
374
         for (const key of secondaryToolbarButtons.keys()) {
377
         for (const key of secondaryToolbarButtons.keys()) {
375
-            const isButtonEnabled = UIUtil.isButtonEnabled(key);
376
             const button = secondaryToolbarButtons.get(key);
378
             const button = secondaryToolbarButtons.get(key);
377
 
379
 
378
-            if (isButtonEnabled
380
+            if (isButtonEnabled(key)
379
                     && button.sideContainerId
381
                     && button.sideContainerId
380
                     && button.sideContainerId === containerId) {
382
                     && button.sideContainerId === containerId) {
381
                 dispatch(toggleToolbarButton(key));
383
                 dispatch(toggleToolbarButton(key));

+ 5
- 3
react/features/toolbox/components/ToolbarButton.web.js View File

7
 import UIUtil from '../../../../modules/UI/util/UIUtil';
7
 import UIUtil from '../../../../modules/UI/util/UIUtil';
8
 
8
 
9
 import AbstractToolbarButton from './AbstractToolbarButton';
9
 import AbstractToolbarButton from './AbstractToolbarButton';
10
-import { getButtonAttributesByProps } from '../functions';
10
+import {
11
+    getButtonAttributesByProps,
12
+    isButtonEnabled
13
+} from '../functions';
11
 
14
 
12
 declare var APP: Object;
15
 declare var APP: Object;
13
-declare var interfaceConfig: Object;
14
 
16
 
15
 /**
17
 /**
16
  * Represents a button in Toolbar on React.
18
  * Represents a button in Toolbar on React.
208
         const { button, tooltipPosition } = this.props;
210
         const { button, tooltipPosition } = this.props;
209
         const name = button.buttonName;
211
         const name = button.buttonName;
210
 
212
 
211
-        if (UIUtil.isButtonEnabled(name)) {
213
+        if (isButtonEnabled(name)) {
212
 
214
 
213
             if (!button.unclickable) {
215
             if (!button.unclickable) {
214
                 if (button.tooltipText) {
216
                 if (button.tooltipText) {

+ 13
- 0
react/features/toolbox/functions.web.js View File

137
     };
137
     };
138
 }
138
 }
139
 
139
 
140
+/**
141
+ * Indicates if a toolbar button is enabled.
142
+ *
143
+ * @param {string} name - The name of the setting section as defined in
144
+ * interface_config.js.
145
+ * @returns {boolean} - True to indicate that the given toolbar button
146
+ * is enabled, false - otherwise.
147
+ */
148
+export function isButtonEnabled(name) {
149
+    return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1
150
+            || interfaceConfig.MAIN_TOOLBAR_BUTTONS.indexOf(name) !== -1;
151
+}
152
+
140
 /**
153
 /**
141
  * Show custom popup/tooltip for a specified button.
154
  * Show custom popup/tooltip for a specified button.
142
  *
155
  *

Loading…
Cancel
Save