Removes redux compose utility function

This commit is contained in:
yanas 2017-05-31 17:14:58 -05:00 committed by Lyubo Marinov
parent a4a13bed84
commit a59e691ba8
2 changed files with 10 additions and 22 deletions

View File

@ -54,9 +54,4 @@ declare module 'redux' {
declare function combineReducers<O: Object, A>(reducers: O): CombinedReducer<$ObjMap<O, <S>(r: Reducer<S, any>) => S>, A>;
declare function compose<S, A>(...fns: Array<StoreEnhancer<S, A>>): Function;
// Utility function in Redux that can be used for function composition
// e.g. bar(foo(baz)) is equivalent to compose(bar, foo)(baz).
declare function compose(...fns: Array<Function>): Function;
}

View File

@ -1,12 +1,10 @@
/* @flow */
import { compose } from 'redux';
import Recording from '../../../modules/UI/recording/Recording';
import SideContainerToggler
from '../../../modules/UI/side_pannels/SideContainerToggler';
import UIEvents from '../../../service/UI/UIEvents';
import UIUtil from '../../../modules/UI/util/UIUtil';
import UIEvents from '../../../service/UI/UIEvents';
import {
changeLocalRaiseHand,
@ -19,7 +17,6 @@ import {
toggleFullScreen,
toggleToolbarButton
} from './actions.native';
import { SET_DEFAULT_TOOLBOX_BUTTONS } from './actionTypes';
import { getDefaultToolboxButtons } from './functions';
@ -40,7 +37,6 @@ export function checkAutoEnableDesktopSharing(): Function {
return () => {
// XXX Should use dispatcher to toggle screensharing but screensharing
// hasn't been React-ified yet.
if (UIUtil.isButtonEnabled('desktop')
&& config.autoEnableDesktopSharing) {
APP.UI.eventEmitter.emit(UIEvents.TOGGLE_SCREENSHARING);
@ -60,8 +56,7 @@ export function dockToolbox(dock: boolean): Function {
return;
}
const state = getState();
const { timeoutMS, visible } = state['features/toolbox'];
const { timeoutMS, visible } = getState()['features/toolbox'];
if (dock) {
// First make sure the toolbox is shown.
@ -89,10 +84,10 @@ export function dockToolbox(dock: boolean): Function {
* @private
*/
function _getButtonHandlers(dispatch, getState) {
const { isGuest } = getState()['features/jwt'];
const localRaiseHandHandler = compose(dispatch, changeLocalRaiseHand);
const toggleFullScreenHandler = compose(dispatch, toggleFullScreen);
const localRaiseHandHandler
= (...args) => dispatch(changeLocalRaiseHand(...args));
const toggleFullScreenHandler
= (...args) => dispatch(toggleFullScreen(...args));
return {
/**
@ -127,7 +122,7 @@ function _getButtonHandlers(dispatch, getState) {
*/
profile: {
onMount: () =>
isGuest
getState()['features/jwt']
|| dispatch(setProfileButtonUnclickable(true))
},
@ -154,8 +149,7 @@ function _getButtonHandlers(dispatch, getState) {
*/
recording: {
onMount: () =>
config.enableRecording
&& dispatch(showRecordingButton())
config.enableRecording && dispatch(showRecordingButton())
}
};
}
@ -366,8 +360,7 @@ export function showToolbox(timeout: number = 0): Object {
*/
export function toggleSideToolbarContainer(containerId: string): Function {
return (dispatch: Dispatch, getState: Function) => {
const state = getState();
const { secondaryToolbarButtons } = state['features/toolbox'];
const { secondaryToolbarButtons } = getState()['features/toolbox'];
for (const key of secondaryToolbarButtons.keys()) {
const isButtonEnabled = UIUtil.isButtonEnabled(key);