mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
Configures what buttons can be visible inside Toolbox and OverflowMenu, based on priority and config overrides, just like web does.
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { OVERWRITE_CONFIG, SET_CONFIG, UPDATE_CONFIG } from '../base/config/actionTypes';
|
|
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
|
|
import { I_AM_VISITOR_MODE } from '../visitors/actionTypes';
|
|
|
|
import { SET_TOOLBAR_BUTTONS } from './actionTypes';
|
|
import { setMainToolbarThresholds } from './actions.native';
|
|
import { NATIVE_THRESHOLDS, NATIVE_TOOLBAR_BUTTONS } from './constants';
|
|
import { getToolbarButtons } from './functions.native';
|
|
|
|
|
|
/**
|
|
* Middleware which intercepts Toolbox actions to handle changes to the
|
|
* visibility timeout of the Toolbox.
|
|
*
|
|
* @param {Store} store - The redux store.
|
|
* @returns {Function}
|
|
*/
|
|
|
|
MiddlewareRegistry.register(store => next => action => {
|
|
switch (action.type) {
|
|
|
|
case UPDATE_CONFIG:
|
|
case OVERWRITE_CONFIG:
|
|
case I_AM_VISITOR_MODE:
|
|
case SET_CONFIG: {
|
|
const result = next(action);
|
|
const { dispatch } = store;
|
|
const state = store.getState();
|
|
|
|
const toolbarButtons = getToolbarButtons(state, NATIVE_TOOLBAR_BUTTONS);
|
|
|
|
if (action.type !== I_AM_VISITOR_MODE) {
|
|
dispatch(setMainToolbarThresholds(NATIVE_THRESHOLDS));
|
|
}
|
|
|
|
dispatch({
|
|
type: SET_TOOLBAR_BUTTONS,
|
|
toolbarButtons
|
|
});
|
|
|
|
return result;
|
|
}
|
|
}
|
|
|
|
return next(action);
|
|
});
|