[RN] Fix TypeError that getDefaultButtons is not a function
This commit is contained in:
parent
1834fc63d2
commit
c2ca345dec
|
@ -0,0 +1 @@
|
||||||
|
export default undefined;
|
|
@ -1,19 +1,12 @@
|
||||||
/* @flow */
|
// @flow
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import _ from 'lodash';
|
|
||||||
|
|
||||||
import { ParticipantCounter } from '../contact-list';
|
import { ParticipantCounter } from '../contact-list';
|
||||||
import { openDeviceSelectionDialog } from '../device-selection';
|
import { openDeviceSelectionDialog } from '../device-selection';
|
||||||
|
import { InfoDialogButton, openInviteDialog } from '../invite';
|
||||||
import {
|
|
||||||
InfoDialogButton,
|
|
||||||
openInviteDialog
|
|
||||||
} from '../invite';
|
|
||||||
|
|
||||||
import { VideoQualityButton } from '../video-quality';
|
|
||||||
|
|
||||||
import UIEvents from '../../../service/UI/UIEvents';
|
import UIEvents from '../../../service/UI/UIEvents';
|
||||||
|
import { VideoQualityButton } from '../video-quality';
|
||||||
|
|
||||||
import ProfileButton from './components/ProfileButton';
|
import ProfileButton from './components/ProfileButton';
|
||||||
|
|
||||||
|
@ -21,19 +14,22 @@ declare var APP: Object;
|
||||||
declare var interfaceConfig: Object;
|
declare var interfaceConfig: Object;
|
||||||
declare var JitsiMeetJS: 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 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() {
|
export default function getDefaultButtons() {
|
||||||
if (!_.isEmpty(buttons)) {
|
if (defaultButtons) {
|
||||||
return buttons;
|
return defaultButtons;
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons = {
|
defaultButtons = {
|
||||||
/**
|
/**
|
||||||
* The descriptor of the camera toolbar button.
|
* The descriptor of the camera toolbar button.
|
||||||
*/
|
*/
|
||||||
|
@ -400,15 +396,24 @@ function getDefaultButtons() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.keys(buttons).forEach(name => {
|
Object.keys(defaultButtons).forEach(name => {
|
||||||
const button = buttons[name];
|
const button = defaultButtons[name];
|
||||||
|
|
||||||
if (!button.isDisplayed) {
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* @flow */
|
// @flow
|
||||||
|
|
||||||
import { ReducerRegistry } from '../base/redux';
|
import { ReducerRegistry } from '../base/redux';
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ ReducerRegistry.register(
|
||||||
};
|
};
|
||||||
|
|
||||||
case SET_TOOLBAR_BUTTON:
|
case SET_TOOLBAR_BUTTON:
|
||||||
return _setButton(state, action);
|
return _setToolbarButton(state, action);
|
||||||
|
|
||||||
case SET_TOOLBAR_HOVERED:
|
case SET_TOOLBAR_HOVERED:
|
||||||
return {
|
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} state - The redux state.
|
||||||
* @param {Object} action - Dispatched action.
|
* @param {Object} action - The redux action of type {@code SET_TOOLBAR_BUTTON}.
|
||||||
* @param {Object} action.button - Object describing toolbar button.
|
* @param {Object} action.button - Object describing toolbar button.
|
||||||
* @param {Object} action.buttonName - The name of the button.
|
* @param {Object} action.buttonName - The name of the button.
|
||||||
* @private
|
* @private
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
function _setButton(state, { button, buttonName }): Object {
|
function _setToolbarButton(state, { button, buttonName }): Object {
|
||||||
const buttons = getDefaultButtons();
|
// XXX getDefaultButtons, defaultToolbarButtons, SET_TOOLBAR_BUTTON are
|
||||||
const buttonDefinition = buttons ? buttons[buttonName] : null;
|
// 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 displayed
|
// We don't need to update if the button shouldn't be displayed
|
||||||
if (!buttonDefinition || !buttonDefinition.isDisplayed()) {
|
if (!buttonDefinition || !buttonDefinition.isDisplayed()) {
|
||||||
return {
|
return state;
|
||||||
...state
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { primaryToolbarButtons, secondaryToolbarButtons } = state;
|
const { primaryToolbarButtons, secondaryToolbarButtons } = state;
|
||||||
|
|
Loading…
Reference in New Issue