|
|
|
@ -1,11 +1,11 @@ |
|
|
|
|
// @flow
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
|
ADD_REACTIONS_MESSAGE, |
|
|
|
|
CLEAR_REACTIONS_MESSAGE, |
|
|
|
|
PUSH_REACTION, |
|
|
|
|
SEND_REACTION, |
|
|
|
|
SET_REACTIONS_MESSAGE, |
|
|
|
|
ADD_REACTION_BUFFER, |
|
|
|
|
ADD_REACTION_MESSAGE, |
|
|
|
|
FLUSH_REACTION_BUFFER, |
|
|
|
|
PUSH_REACTIONS, |
|
|
|
|
SEND_REACTIONS, |
|
|
|
|
SET_REACTION_QUEUE |
|
|
|
|
} from './actionTypes'; |
|
|
|
|
import { type ReactionEmojiProps } from './constants'; |
|
|
|
@ -23,86 +23,92 @@ export function setReactionQueue(value: Array<ReactionEmojiProps>) { |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Appends the reactions message to the chat and resets the state. |
|
|
|
|
* Removes a reaction from the queue. |
|
|
|
|
* |
|
|
|
|
* @param {number} uid - Id of the reaction to be removed. |
|
|
|
|
* @returns {void} |
|
|
|
|
*/ |
|
|
|
|
export function flushReactionsToChat() { |
|
|
|
|
return { |
|
|
|
|
type: CLEAR_REACTIONS_MESSAGE |
|
|
|
|
export function removeReaction(uid: number) { |
|
|
|
|
return (dispatch: Function, getState: Function) => { |
|
|
|
|
const queue = getState()['features/reactions'].queue; |
|
|
|
|
|
|
|
|
|
dispatch(setReactionQueue(queue.filter(reaction => reaction.uid !== uid))); |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Adds a new reaction to the reactions message. |
|
|
|
|
* Sends the reactions buffer to everyone in the conference. |
|
|
|
|
* |
|
|
|
|
* @param {boolean} value - The new reaction. |
|
|
|
|
* @returns {Object} |
|
|
|
|
* @returns {{ |
|
|
|
|
* type: SEND_REACTION |
|
|
|
|
* }} |
|
|
|
|
*/ |
|
|
|
|
export function addReactionsMessage(value: string) { |
|
|
|
|
export function sendReactions() { |
|
|
|
|
return { |
|
|
|
|
type: SET_REACTIONS_MESSAGE, |
|
|
|
|
reaction: value |
|
|
|
|
type: SEND_REACTIONS |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Adds a new reaction to the reactions message. |
|
|
|
|
* Adds a reaction to the local buffer. |
|
|
|
|
* |
|
|
|
|
* @param {boolean} value - Reaction to be added to queue. |
|
|
|
|
* @returns {Object} |
|
|
|
|
* @param {string} reaction - The reaction to be added. |
|
|
|
|
* @returns {{ |
|
|
|
|
* type: ADD_REACTION_BUFFER, |
|
|
|
|
* reaction: string |
|
|
|
|
* }} |
|
|
|
|
*/ |
|
|
|
|
export function pushReaction(value: string) { |
|
|
|
|
export function addReactionToBuffer(reaction: string) { |
|
|
|
|
return { |
|
|
|
|
type: PUSH_REACTION, |
|
|
|
|
reaction: value |
|
|
|
|
type: ADD_REACTION_BUFFER, |
|
|
|
|
reaction |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Removes a reaction from the queue. |
|
|
|
|
* Clears the reaction buffer. |
|
|
|
|
* |
|
|
|
|
* @param {number} uid - Id of the reaction to be removed. |
|
|
|
|
* @returns {void} |
|
|
|
|
* @returns {{ |
|
|
|
|
* type: FLUSH_REACTION_BUFFER |
|
|
|
|
* }} |
|
|
|
|
*/ |
|
|
|
|
export function removeReaction(uid: number) { |
|
|
|
|
return (dispatch: Function, getState: Function) => { |
|
|
|
|
const queue = getState()['features/reactions'].queue; |
|
|
|
|
|
|
|
|
|
dispatch(setReactionQueue(queue.filter(reaction => reaction.uid !== uid))); |
|
|
|
|
export function flushReactionBuffer() { |
|
|
|
|
return { |
|
|
|
|
type: FLUSH_REACTION_BUFFER |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Sends a reaction message to everyone in the conference. |
|
|
|
|
* Adds a reaction message to the chat. |
|
|
|
|
* |
|
|
|
|
* @param {string} reaction - The reaction to send out. |
|
|
|
|
* @param {string} message - The reaction message. |
|
|
|
|
* @returns {{ |
|
|
|
|
* type: SEND_REACTION, |
|
|
|
|
* reaction: string |
|
|
|
|
* type: ADD_REACTION_MESSAGE, |
|
|
|
|
* message: string |
|
|
|
|
* }} |
|
|
|
|
*/ |
|
|
|
|
export function sendReaction(reaction: string) { |
|
|
|
|
export function addReactionsToChat(message: string) { |
|
|
|
|
return { |
|
|
|
|
type: SEND_REACTION, |
|
|
|
|
reaction |
|
|
|
|
type: ADD_REACTION_MESSAGE, |
|
|
|
|
message |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Adds a reactions message to the chat. |
|
|
|
|
* Adds reactions to the animation queue. |
|
|
|
|
* |
|
|
|
|
* @param {string} message - The reactions message to add to chat. |
|
|
|
|
* @param {Array} reactions - The reactions to be animated. |
|
|
|
|
* @returns {{ |
|
|
|
|
* type: ADD_REACTIONS_MESSAGE, |
|
|
|
|
* message: string |
|
|
|
|
* type: PUSH_REACTIONS, |
|
|
|
|
* reactions: Array |
|
|
|
|
* }} |
|
|
|
|
*/ |
|
|
|
|
export function addReactionsMessageToChat(message: string) { |
|
|
|
|
export function pushReactions(reactions: Array<string>) { |
|
|
|
|
return { |
|
|
|
|
type: ADD_REACTIONS_MESSAGE, |
|
|
|
|
message |
|
|
|
|
type: PUSH_REACTIONS, |
|
|
|
|
reactions |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|