Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

ref(isButtonEnable): UIUtil -> toolbox

hristoterezovfe5908497982
diff --git a/conference.js b/conference.js
index 4b95f9e439..2c29778f96 100644
--- a/conference.js
+++ b/conference.js
@@ -64,7 +64,10 @@ import {
mediaPermissionPromptVisibilityChanged,
suspendDetected
} from './react/features/overlay';
-import { showDesktopSharingButton } from './react/features/toolbox';
+import {
+ isButtonEnabled,
+ showDesktopSharingButton
+} from './react/features/toolbox';
const { participantConnectionStatus } = JitsiMeetJS.constants;
@@ -714,7 +717,7 @@ export default {
this._createRoom(tracks);
APP.remoteControl.init();
- if (UIUtil.isButtonEnabled('contacts')
+ if (isButtonEnabled('contacts')
&& !interfaceConfig.filmStripOnly) {
APP.UI.ContactList = new ContactList(room);
}
diff --git a/modules/UI/side_pannels/SidePanels.js b/modules/UI/side_pannels/SidePanels.js
index 222b33d633..316c7713f3 100644
--- a/modules/UI/side_pannels/SidePanels.js
+++ b/modules/UI/side_pannels/SidePanels.js
@@ -2,27 +2,27 @@ import Chat from './chat/Chat';
import SettingsMenu from './settings/SettingsMenu';
import Profile from './profile/Profile';
import ContactListView from './contactlist/ContactListView';
-import UIUtil from '../util/UIUtil';
+import { isButtonEnabled } from '../../../react/features/toolbox';
const SidePanels = {
init (eventEmitter) {
// Initialize chat
- if (UIUtil.isButtonEnabled('chat')) {
+ if (isButtonEnabled('chat')) {
Chat.init(eventEmitter);
}
// Initialize settings
- if (UIUtil.isButtonEnabled('settings')) {
+ if (isButtonEnabled('settings')) {
SettingsMenu.init(eventEmitter);
}
// Initialize profile
- if (UIUtil.isButtonEnabled('profile')) {
+ if (isButtonEnabled('profile')) {
Profile.init(eventEmitter);
}
// Initialize contact list view
- if (UIUtil.isButtonEnabled('contacts')) {
+ if (isButtonEnabled('contacts')) {
ContactListView.init();
}
}
diff --git a/modules/UI/util/UIUtil.js b/modules/UI/util/UIUtil.js
index 6af9f024f9..4beda5e3ef 100644
--- a/modules/UI/util/UIUtil.js
+++ b/modules/UI/util/UIUtil.js
@@ -226,17 +226,6 @@ const IndicatorFontSizes = {
}
},
- /**
- * Indicates if a toolbar button is enabled.
- * @param name the name of the setting section as defined in
- * interface_config.js and Toolbar.js
- * @returns {boolean} {true} to indicate that the given toolbar button
- * is enabled, {false} - otherwise
- */
- isButtonEnabled(name) {
- return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1
- || interfaceConfig.MAIN_TOOLBAR_BUTTONS.indexOf(name) !== -1;
- },
/**
* Indicates if the setting section is enabled.
*
@@ -322,16 +311,6 @@ const IndicatorFontSizes = {
}
},
- hideDisabledButtons(mappings) {
- var selector = Object.keys(mappings)
- .map(function (buttonName) {
- return UIUtil.isButtonEnabled(buttonName)
- ? null : "#" + mappings[buttonName].id; })
- .filter(function (item) { return item; })
- .join(',');
- $(selector).hide();
- },
-
redirect(url) {
window.location.href = url;
},
diff --git a/react/features/toolbox/actions.web.js b/react/features/toolbox/actions.web.js
index 18b53b232d..6b226f0f84 100644
--- a/react/features/toolbox/actions.web.js
+++ b/react/features/toolbox/actions.web.js
@@ -18,7 +18,10 @@ import {
toggleToolbarButton
} from './actions.native';
import { SET_DEFAULT_TOOLBOX_BUTTONS } from './actionTypes';
-import { getDefaultToolboxButtons } from './functions';
+import {
+ getDefaultToolboxButtons,
+ isButtonEnabled
+} from './functions';
declare var $: Function;
declare var APP: Object;
@@ -37,7 +40,7 @@ export function checkAutoEnableDesktopSharing(): Function {
return () => {
// XXX Should use dispatcher to toggle screensharing but screensharing
// hasn't been React-ified yet.
- if (UIUtil.isButtonEnabled('desktop')
+ if (isButtonEnabled('desktop')
&& config.autoEnableDesktopSharing) {
APP.UI.eventEmitter.emit(UIEvents.TOGGLE_SCREENSHARING);
}
@@ -241,7 +244,7 @@ export function showDesktopSharingButton(): Function {
= disabledTooltipText
&& APP.conference.isDesktopSharingDisabledByConfig;
const visible
- = UIUtil.isButtonEnabled(buttonName)
+ = isButtonEnabled(buttonName)
&& (APP.conference.isDesktopSharingEnabled || showTooltip);
const newState = {
@@ -264,7 +267,7 @@ export function showDialPadButton(show: boolean): Function {
return (dispatch: Dispatch<*>) => {
const buttonName = 'dialpad';
- if (show && UIUtil.isButtonEnabled(buttonName)) {
+ if (show && isButtonEnabled(buttonName)) {
dispatch(setToolbarButton(buttonName, {
hidden: false
}));
@@ -296,7 +299,7 @@ export function showSharedVideoButton(): Function {
return (dispatch: Dispatch<*>) => {
const buttonName = 'sharedvideo';
- if (UIUtil.isButtonEnabled(buttonName)
+ if (isButtonEnabled(buttonName)
&& !config.disableThirdPartyRequests) {
dispatch(setToolbarButton(buttonName, {
hidden: false
@@ -318,7 +321,7 @@ export function showDialOutButton(show: boolean): Function {
if (show
&& APP.conference.sipGatewayEnabled()
- && UIUtil.isButtonEnabled(buttonName)
+ && isButtonEnabled(buttonName)
&& (!config.enableUserRolesBasedOnToken
|| !getState()['features/jwt'].isGuest)) {
dispatch(setToolbarButton(buttonName, {
@@ -372,10 +375,9 @@ export function toggleSideToolbarContainer(containerId: string): Function {
const { secondaryToolbarButtons } = getState()['features/toolbox'];
for (const key of secondaryToolbarButtons.keys()) {
- const isButtonEnabled = UIUtil.isButtonEnabled(key);
const button = secondaryToolbarButtons.get(key);
- if (isButtonEnabled
+ if (isButtonEnabled(key)
&& button.sideContainerId
&& button.sideContainerId === containerId) {
dispatch(toggleToolbarButton(key));
diff --git a/react/features/toolbox/components/ToolbarButton.web.js b/react/features/toolbox/components/ToolbarButton.web.js
index a3496b364d..e639c82df1 100644
--- a/react/features/toolbox/components/ToolbarButton.web.js
+++ b/react/features/toolbox/components/ToolbarButton.web.js
@@ -7,10 +7,12 @@ import { translate } from '../../base/i18n';
import UIUtil from '../../../../modules/UI/util/UIUtil';
import AbstractToolbarButton from './AbstractToolbarButton';
-import { getButtonAttributesByProps } from '../functions';
+import {
+ getButtonAttributesByProps,
+ isButtonEnabled
+} from '../functions';
declare var APP: Object;
-declare var interfaceConfig: Object;
/**
* Represents a button in Toolbar on React.
@@ -208,7 +210,7 @@ class ToolbarButton extends AbstractToolbarButton {
const { button, tooltipPosition } = this.props;
const name = button.buttonName;
- if (UIUtil.isButtonEnabled(name)) {
+ if (isButtonEnabled(name)) {
if (!button.unclickable) {
if (button.tooltipText) {
diff --git a/react/features/toolbox/functions.web.js b/react/features/toolbox/functions.web.js
index 7128af1847..354e8a598c 100644
--- a/react/features/toolbox/functions.web.js
+++ b/react/features/toolbox/functions.web.js
@@ -137,6 +137,19 @@ export function getToolbarClassNames(props: Object) {
};
}
+/**
+ * Indicates if a toolbar button is enabled.
+ *
+ * @param {string} name - The name of the setting section as defined in
+ * interface_config.js.
+ * @returns {boolean} - True to indicate that the given toolbar button
+ * is enabled, false - otherwise.
+ */
+export function isButtonEnabled(name) {
+ return interfaceConfig.TOOLBAR_BUTTONS.indexOf(name) !== -1
+ || interfaceConfig.MAIN_TOOLBAR_BUTTONS.indexOf(name) !== -1;
+}
+
/**
* Show custom popup/tooltip for a specified button.
*