Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jitsi-meet/react/features/toolbox/reducer.js

202 lines
4.7 KiB

// @flow
9 years ago
import { ReducerRegistry } from '../base/redux';
import {
9 years ago
CLEAR_TOOLBOX_TIMEOUT,
FULL_SCREEN_CHANGED,
SET_DEFAULT_TOOLBOX_BUTTONS,
9 years ago
SET_SUBJECT,
SET_SUBJECT_SLIDE_IN,
SET_TOOLBAR_HOVERED,
SET_TOOLBOX_ALWAYS_VISIBLE,
SET_TOOLBOX_ENABLED,
9 years ago
SET_TOOLBOX_TIMEOUT,
SET_TOOLBOX_TIMEOUT_MS,
SET_TOOLBOX_VISIBLE
9 years ago
} from './actionTypes';
declare var interfaceConfig: Object;
/**
9 years ago
* Returns initial state for toolbox's part of Redux store.
9 years ago
*
9 years ago
* @private
9 years ago
* @returns {{
9 years ago
* alwaysVisible: boolean,
* hovered: boolean,
9 years ago
* primaryToolbarButtons: Map,
9 years ago
* secondaryToolbarButtons: Map,
* subject: string,
* subjectSlideIn: boolean,
* timeoutID: number,
* timeoutMS: number,
* visible: boolean
9 years ago
* }}
*/
function _getInitialState() {
9 years ago
// Default toolbox timeout for mobile app.
let timeoutMS = 5000;
9 years ago
if (typeof interfaceConfig !== 'undefined'
&& interfaceConfig.INITIAL_TOOLBAR_TIMEOUT) {
9 years ago
timeoutMS = interfaceConfig.INITIAL_TOOLBAR_TIMEOUT;
9 years ago
}
return {
/**
9 years ago
* The indicator which determines whether the Toolbox should always be
* visible.
9 years ago
*
* @type {boolean}
*/
alwaysVisible: false,
/**
* The indicator which determines whether the Toolbox is enabled. For
* example, modules/UI/recording/Recording.js disables the Toolbox.
*
* @type {boolean}
*/
enabled: true,
9 years ago
/**
9 years ago
* The indicator which determines whether a Toolbar in the Toolbox is
* hovered.
9 years ago
*
* @type {boolean}
*/
hovered: false,
/**
* A Map of the default buttons of the PrimaryToolbar.
*
* @type {Map}
*/
primaryToolbarButtons: new Map(),
/**
* A Map of the default buttons of the SecondaryToolbar.
*
* @type {Map}
*/
secondaryToolbarButtons: new Map(),
9 years ago
/**
9 years ago
* The text of the conference subject.
9 years ago
*
* @type {string}
*/
subject: '',
/**
9 years ago
* The indicator which determines whether the subject is sliding in.
9 years ago
*
* @type {boolean}
*/
subjectSlideIn: false,
/**
9 years ago
* A number, non-zero value which identifies the timer created by a call
* to setTimeout() with timeoutMS.
9 years ago
*
* @type {number|null}
*/
9 years ago
timeoutID: null,
9 years ago
/**
9 years ago
* The delay in milliseconds before timeoutID executes (after its
* initialization).
9 years ago
*
* @type {number}
*/
9 years ago
timeoutMS,
9 years ago
/**
9 years ago
* The indicator which determines whether the Toolbox is visible.
9 years ago
*
* @type {boolean}
*/
visible: false
};
}
ReducerRegistry.register(
9 years ago
'features/toolbox',
9 years ago
(state: Object = _getInitialState(), action: Object) => {
switch (action.type) {
9 years ago
case CLEAR_TOOLBOX_TIMEOUT:
9 years ago
return {
...state,
9 years ago
timeoutID: undefined
9 years ago
};
case FULL_SCREEN_CHANGED:
return {
...state,
fullScreen: action.fullScreen
};
case SET_DEFAULT_TOOLBOX_BUTTONS: {
const { primaryToolbarButtons, secondaryToolbarButtons } = action;
return {
...state,
primaryToolbarButtons,
secondaryToolbarButtons
};
}
9 years ago
case SET_SUBJECT:
return {
...state,
subject: action.subject
};
case SET_SUBJECT_SLIDE_IN:
return {
...state,
subjectSlideIn: action.subjectSlideIn
};
case SET_TOOLBAR_HOVERED:
return {
...state,
hovered: action.hovered
};
case SET_TOOLBOX_ALWAYS_VISIBLE:
return {
...state,
alwaysVisible: action.alwaysVisible
};
case SET_TOOLBOX_ENABLED:
return {
...state,
enabled: action.enabled
};
9 years ago
case SET_TOOLBOX_TIMEOUT:
9 years ago
return {
...state,
9 years ago
timeoutID: action.timeoutID,
timeoutMS: action.timeoutMS
9 years ago
};
9 years ago
case SET_TOOLBOX_TIMEOUT_MS:
9 years ago
return {
...state,
9 years ago
timeoutMS: action.timeoutMS
9 years ago
};
9 years ago
case SET_TOOLBOX_VISIBLE:
9 years ago
return {
...state,
visible: action.visible
};
}
return state;
});