ref(isButtonEnable): UIUtil -> toolbox
This commit is contained in:
parent
025f7204d5
commit
fe59084979
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
},
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue