Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
[RN] Fix TypeError that getDefaultButtons is not a function
Lyubo Marinovc2ca345dec7e
diff --git a/react/features/toolbox/defaultToolbarButtons.native.js b/react/features/toolbox/defaultToolbarButtons.native.jsindex e69de29bb2..f237ddf58e 100644--- a/react/features/toolbox/defaultToolbarButtons.native.js+++ b/react/features/toolbox/defaultToolbarButtons.native.js@@ -0,0 +1 @@+export default undefined;diff --git a/react/features/toolbox/defaultToolbarButtons.web.js b/react/features/toolbox/defaultToolbarButtons.web.jsindex 0a47d9d3e3..01973a9c00 100644--- a/react/features/toolbox/defaultToolbarButtons.web.js+++ b/react/features/toolbox/defaultToolbarButtons.web.js@@ -1,19 +1,12 @@-/* @flow */+// @flowimport React from 'react';-import _ from 'lodash';import { ParticipantCounter } from '../contact-list';import { openDeviceSelectionDialog } from '../device-selection';--import {- InfoDialogButton,- openInviteDialog-} from '../invite';--import { VideoQualityButton } from '../video-quality';-+import { InfoDialogButton, openInviteDialog } from '../invite';import UIEvents from '../../../service/UI/UIEvents';+import { VideoQualityButton } from '../video-quality';import ProfileButton from './components/ProfileButton';@@ -21,19 +14,22 @@ declare var APP: Object;declare var interfaceConfig: Object;declare var JitsiMeetJS: Object;-let buttons: Object = {};+/**+ * The cache of {@link getDefaultButtons()}.+ */+let defaultButtons: Object;/*** Returns a map of all button descriptors and according properties.*- * @returns {*} - The maps of default button descriptors.+ * @returns {Object} - The maps of default button descriptors.*/-function getDefaultButtons() {- if (!_.isEmpty(buttons)) {- return buttons;+export default function getDefaultButtons() {+ if (defaultButtons) {+ return defaultButtons;}- buttons = {+ defaultButtons = {/*** The descriptor of the camera toolbar button.*/@@ -400,15 +396,24 @@ function getDefaultButtons() {}};- Object.keys(buttons).forEach(name => {- const button = buttons[name];+ Object.keys(defaultButtons).forEach(name => {+ const button = defaultButtons[name];if (!button.isDisplayed) {- button.isDisplayed = () => !interfaceConfig.filmStripOnly;+ button.isDisplayed = _isDisplayed;}});- return buttons;+ return defaultButtons;}-export default getDefaultButtons;+/**+ * The default implementation of the {@code isDisplayed} method of the toolbar+ * button definition returned by {@link getDefaultButtons()}.+ *+ * @returns {boolean} If the user intarface is full i.e. not filmstrip-only,+ * then {@code true}; otherwise, {@code false}.+ */+function _isDisplayed() {+ return !interfaceConfig.filmStripOnly;+}diff --git a/react/features/toolbox/reducer.js b/react/features/toolbox/reducer.jsindex 8e69f2c1ad..51099494ff 100644--- a/react/features/toolbox/reducer.js+++ b/react/features/toolbox/reducer.js@@ -1,4 +1,4 @@-/* @flow */+// @flowimport { ReducerRegistry } from '../base/redux';@@ -155,7 +155,7 @@ ReducerRegistry.register(};case SET_TOOLBAR_BUTTON:- return _setButton(state, action);+ return _setToolbarButton(state, action);case SET_TOOLBAR_HOVERED:return {@@ -199,24 +199,24 @@ ReducerRegistry.register(});/**- * Sets new value of the button.+ * Reduces the redux action {@code SET_TOOLBAR_BUTTON} in the feature toolbox.*- * @param {Object} state - Redux state.- * @param {Object} action - Dispatched action.+ * @param {Object} state - The redux state.+ * @param {Object} action - The redux action of type {@code SET_TOOLBAR_BUTTON}.* @param {Object} action.button - Object describing toolbar button.* @param {Object} action.buttonName - The name of the button.* @private* @returns {Object}*/-function _setButton(state, { button, buttonName }): Object {- const buttons = getDefaultButtons();- const buttonDefinition = buttons ? buttons[buttonName] : null;+function _setToolbarButton(state, { button, buttonName }): Object {+ // XXX getDefaultButtons, defaultToolbarButtons, SET_TOOLBAR_BUTTON are+ // abstractions fully implemented on Web only.+ const buttons = getDefaultButtons && getDefaultButtons();+ const buttonDefinition = buttons && buttons[buttonName];// We don't need to update if the button shouldn't be displayedif (!buttonDefinition || !buttonDefinition.isDisplayed()) {- return {- ...state- };+ return state;}const { primaryToolbarButtons, secondaryToolbarButtons } = state;