2020-06-12 10:15:16 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import { openDialog } from '../base/dialog';
|
|
|
|
|
2021-03-03 14:37:38 +00:00
|
|
|
import { SET_SHARED_VIDEO_STATUS, TOGGLE_SHARED_VIDEO } from './actionTypes';
|
|
|
|
import { SharedVideoDialog } from './components/native';
|
2020-06-12 10:15:16 +00:00
|
|
|
|
|
|
|
/**
|
2021-03-03 14:37:38 +00:00
|
|
|
* Updates the current known status of the shared video.
|
2020-06-12 10:15:16 +00:00
|
|
|
*
|
2021-03-03 14:37:38 +00:00
|
|
|
* @param {string} videoId - The id of the video to be shared.
|
|
|
|
* @param {string} status - The current status of the video being shared.
|
|
|
|
* @param {number} time - The current position of the video being shared.
|
|
|
|
* @param {string} ownerId - The participantId of the user sharing the video.
|
2020-06-12 10:15:16 +00:00
|
|
|
* @returns {{
|
|
|
|
* type: SET_SHARED_VIDEO_STATUS,
|
|
|
|
* ownerId: string,
|
|
|
|
* status: string,
|
|
|
|
* time: number,
|
|
|
|
* videoId: string
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function setSharedVideoStatus(videoId: string, status: string, time: number, ownerId: string) {
|
|
|
|
return {
|
|
|
|
type: SET_SHARED_VIDEO_STATUS,
|
|
|
|
ownerId,
|
|
|
|
status,
|
|
|
|
time,
|
|
|
|
videoId
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-03-03 14:37:38 +00:00
|
|
|
* Starts the flow for starting or stopping a shared video.
|
2020-06-12 10:15:16 +00:00
|
|
|
*
|
|
|
|
* @returns {{
|
|
|
|
* type: TOGGLE_SHARED_VIDEO
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
export function toggleSharedVideo() {
|
|
|
|
return {
|
2021-03-03 14:37:38 +00:00
|
|
|
type: TOGGLE_SHARED_VIDEO
|
2020-06-12 10:15:16 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2021-03-03 14:37:38 +00:00
|
|
|
* Displays the prompt for entering the video link.
|
2020-06-12 10:15:16 +00:00
|
|
|
*
|
|
|
|
* @param {Function} onPostSubmit - The function to be invoked when a valid link is entered.
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
2021-03-03 14:37:38 +00:00
|
|
|
export function showSharedVideoDialog(onPostSubmit: ?Function) {
|
|
|
|
return openDialog(SharedVideoDialog, { onPostSubmit });
|
2020-06-12 10:15:16 +00:00
|
|
|
}
|