Files
jitsi-meet/react/features/reactions/reducer.js
robertpin c7a91e1974 feat(reaction-sounds) Added sounds for reactions (#9775)
* Added sounds for reactions

* Updated reactions list

* Added reactions to sound settings

* Added support for multiple sounds

* Added feature flag for sounds

* Updated sound settings

Moved reactions toggle at the top of the list

* Added disable reaction sounds notification

* Added reaction button zoom for burst intensity

* Fixed raise hand sound

* Fixed register sounds for reactions

* Changed boo emoji

* Updated sounds

* Fixed lint errors

* Fixed reaction sounds file names

* Fix raise hand sound

Play sound only on raise hand not on lower hand

* Fixed types for sound constants

* Fixed type for raise hand sound constant
2021-08-23 12:57:56 +03:00

105 lines
2.2 KiB
JavaScript

// @flow
import { ReducerRegistry } from '../base/redux';
import {
TOGGLE_REACTIONS_VISIBLE,
SET_REACTION_QUEUE,
ADD_REACTION_BUFFER,
FLUSH_REACTION_BUFFER,
SHOW_SOUNDS_NOTIFICATION
} from './actionTypes';
/**
* Returns initial state for reactions' part of Redux store.
*
* @private
* @returns {{
* visible: boolean,
* message: string,
* timeoutID: number,
* queue: Array,
* notificationDisplayed: boolean
* }}
*/
function _getInitialState() {
return {
/**
* The indicator that determines whether the reactions menu is visible.
*
* @type {boolean}
*/
visible: false,
/**
* An array that contains the reactions buffer to be sent.
*
* @type {Array}
*/
buffer: [],
/**
* A number, non-zero value which identifies the timer created by a call
* to setTimeout().
*
* @type {number|null}
*/
timeoutID: null,
/**
* The array of reactions to animate
*
* @type {Array}
*/
queue: [],
/**
* Whether or not the disable reaction sounds notification was shown
*/
notificationDisplayed: false
};
}
ReducerRegistry.register(
'features/reactions',
(state: Object = _getInitialState(), action: Object) => {
switch (action.type) {
case TOGGLE_REACTIONS_VISIBLE:
return {
...state,
visible: !state.visible
};
case ADD_REACTION_BUFFER:
return {
...state,
buffer: action.buffer,
timeoutID: action.timeoutID
};
case FLUSH_REACTION_BUFFER:
return {
...state,
buffer: [],
timeoutID: null
};
case SET_REACTION_QUEUE: {
return {
...state,
queue: action.value
};
}
case SHOW_SOUNDS_NOTIFICATION: {
return {
...state,
notificationDisplayed: true
};
}
}
return state;
});