Переглянути джерело

ref(isButtonEnable): UIUtil -> toolbox

j8
hristoterezov 8 роки тому
джерело
коміт
fe59084979

+ 5
- 2
conference.js Переглянути файл

@@ -64,7 +64,10 @@ import {
64 64
     mediaPermissionPromptVisibilityChanged,
65 65
     suspendDetected
66 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 72
 const { participantConnectionStatus } = JitsiMeetJS.constants;
70 73
 
@@ -714,7 +717,7 @@ export default {
714 717
                 this._createRoom(tracks);
715 718
                 APP.remoteControl.init();
716 719
 
717
-                if (UIUtil.isButtonEnabled('contacts')
720
+                if (isButtonEnabled('contacts')
718 721
                     && !interfaceConfig.filmStripOnly) {
719 722
                     APP.UI.ContactList = new ContactList(room);
720 723
                 }

+ 5
- 5
modules/UI/side_pannels/SidePanels.js Переглянути файл

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

+ 0
- 21
modules/UI/util/UIUtil.js Переглянути файл

@@ -226,17 +226,6 @@ const IndicatorFontSizes = {
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 230
      * Indicates if the setting section is enabled.
242 231
      *
@@ -322,16 +311,6 @@ const IndicatorFontSizes = {
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 314
     redirect(url) {
336 315
          window.location.href = url;
337 316
     },

+ 10
- 8
react/features/toolbox/actions.web.js Переглянути файл

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

+ 5
- 3
react/features/toolbox/components/ToolbarButton.web.js Переглянути файл

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

+ 13
- 0
react/features/toolbox/functions.web.js Переглянути файл

@@ -137,6 +137,19 @@ export function getToolbarClassNames(props: Object) {
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 154
  * Show custom popup/tooltip for a specified button.
142 155
  *

Завантаження…
Відмінити
Зберегти