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

160 lines
3.7 KiB

// @flow
9 years ago
import { ReducerRegistry } from '../base/redux';
import {
9 years ago
CLEAR_TOOLBOX_TIMEOUT,
FULL_SCREEN_CHANGED,
SET_OVERFLOW_MENU_VISIBLE,
9 years ago
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,
* enabled: boolean,
9 years ago
* hovered: boolean,
* overflowMenuVisible: boolean,
9 years ago
* 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,
/**
feat(recording): frontend logic can support live streaming and recording (#2952) * feat(recording): frontend logic can support live streaming and recording Instead of either live streaming or recording, now both can live together. The changes to facilitate such include the following: - Killing the state storing in Recording.js. Instead state is stored in the lib and updated in redux for labels to display the necessary state updates. - Creating a new container, Labels, for recording labels. Previously labels were manually created and positioned. The container can create a reasonable number of labels and only the container itself needs to be positioned with CSS. The VideoQualityLabel has been shoved into the container as well because it moves along with the recording labels. - The action for updating recording state has been modified to enable updating an array of recording sessions to support having multiple sessions. - Confirmation dialogs for stopping and starting a file recording session have been created, as they previously were jquery modals opened by Recording.js. - Toolbox.web displays live streaming and recording buttons based on configuration instead of recording availability. - VideoQualityLabel and RecordingLabel have been simplified to remove any positioning logic, as the Labels container handles such. - Previous recording state update logic has been moved into the RecordingLabel component. Each RecordingLabel is in charge of displaying state for a recording session. The display UX has been left alone. - Sipgw availability is no longer broadcast so remove logic depending on its state. Some moving around of code was necessary to get around linting errors about the existing code being too deeply nested (even though I didn't touch it). * work around lib-jitsi-meet circular dependency issues * refactor labels to use html base * pass in translation keys to video quality label * add video quality classnames for torture tests * break up, rearrange recorder session update listener * add comment about disabling startup resize animation * rename session to sessionData * chore(deps): update to latest lib for recording changes
8 years ago
* The indicator which determines whether the Toolbox is enabled.
*
* @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,
/**
* The indicator which determines whether the OverflowMenu is visible.
*
* @type {boolean}
*/
overflowMenuVisible: false,
9 years ago
/**
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_OVERFLOW_MENU_VISIBLE:
return {
...state,
overflowMenuVisible: action.visible
};
9 years ago
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;
});