2018-07-17 17:31:12 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import {
|
|
|
|
ENDPOINT_MESSAGE_RECEIVED,
|
|
|
|
REMOVE_TRANSCRIPT_MESSAGE,
|
2018-08-22 17:49:58 +00:00
|
|
|
TOGGLE_REQUESTING_SUBTITLES,
|
2022-04-20 08:43:18 +00:00
|
|
|
SET_REQUESTING_SUBTITLES,
|
2022-08-31 15:57:31 +00:00
|
|
|
UPDATE_TRANSCRIPT_MESSAGE,
|
|
|
|
UPDATE_TRANSLATION_LANGUAGE
|
2018-07-17 17:31:12 +00:00
|
|
|
} from './actionTypes';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Signals that a participant sent an endpoint message on the data channel.
|
|
|
|
*
|
|
|
|
* @param {Object} participant - The participant details sending the message.
|
|
|
|
* @param {Object} json - The json carried by the endpoint message.
|
|
|
|
* @returns {{
|
|
|
|
* type: ENDPOINT_MESSAGE_RECEIVED,
|
|
|
|
* participant: Object,
|
|
|
|
* json: Object
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function endpointMessageReceived(participant: Object, json: Object) {
|
|
|
|
return {
|
|
|
|
type: ENDPOINT_MESSAGE_RECEIVED,
|
|
|
|
participant,
|
|
|
|
json
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Signals that a transcript has to be removed from the state.
|
|
|
|
*
|
|
|
|
* @param {string} transcriptMessageID - The message_id to be removed.
|
|
|
|
* @returns {{
|
|
|
|
* type: REMOVE_TRANSCRIPT_MESSAGE,
|
|
|
|
* transcriptMessageID: string,
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function removeTranscriptMessage(transcriptMessageID: string) {
|
|
|
|
return {
|
|
|
|
type: REMOVE_TRANSCRIPT_MESSAGE,
|
|
|
|
transcriptMessageID
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-08-06 09:24:37 +00:00
|
|
|
* Signals that a transcript with the given message_id to be added or updated
|
2018-07-17 17:31:12 +00:00
|
|
|
* is received.
|
|
|
|
*
|
|
|
|
* @param {string} transcriptMessageID -The transcript message_id to be updated.
|
|
|
|
* @param {Object} newTranscriptMessage - The updated transcript message.
|
|
|
|
* @returns {{
|
|
|
|
* type: UPDATE_TRANSCRIPT_MESSAGE,
|
|
|
|
* transcriptMessageID: string,
|
|
|
|
* newTranscriptMessage: Object
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function updateTranscriptMessage(transcriptMessageID: string,
|
|
|
|
newTranscriptMessage: Object) {
|
|
|
|
return {
|
|
|
|
type: UPDATE_TRANSCRIPT_MESSAGE,
|
|
|
|
transcriptMessageID,
|
|
|
|
newTranscriptMessage
|
|
|
|
};
|
|
|
|
}
|
2018-08-22 17:49:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Signals that the local user has toggled the ClosedCaption button.
|
|
|
|
*
|
|
|
|
* @returns {{
|
|
|
|
* type: TOGGLE_REQUESTING_SUBTITLES
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function toggleRequestingSubtitles() {
|
|
|
|
return {
|
|
|
|
type: TOGGLE_REQUESTING_SUBTITLES
|
|
|
|
};
|
|
|
|
}
|
2022-04-20 08:43:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Signals that the local user has enabled or disabled the subtitles.
|
|
|
|
*
|
|
|
|
* @param {boolean} enabled - The new state of the subtitles.
|
|
|
|
* @returns {{
|
|
|
|
* type: SET_REQUESTING_SUBTITLES,
|
|
|
|
* enabled: boolean
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function setRequestingSubtitles(enabled: boolean) {
|
|
|
|
return {
|
|
|
|
type: SET_REQUESTING_SUBTITLES,
|
|
|
|
enabled
|
|
|
|
};
|
|
|
|
}
|
2022-08-31 15:57:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Signals that the local user has selected language for the translation.
|
|
|
|
*
|
|
|
|
* @param {boolean} value - The selected language for translation.
|
|
|
|
* @returns {{
|
|
|
|
* type: UPDATE_TRANSLATION_LANGUAGE
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function updateTranslationLanguage(value) {
|
|
|
|
return {
|
|
|
|
type: UPDATE_TRANSLATION_LANGUAGE,
|
|
|
|
value
|
|
|
|
};
|
|
|
|
}
|