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.

actions.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. import {
  4. SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
  5. SELECT_ENDPOINTS,
  6. SET_TILE_VIEW
  7. } from './actionTypes';
  8. import { shouldDisplayTileView } from './functions';
  9. /**
  10. * Creates a (redux) action which signals that a new set of remote endpoints need to be selected.
  11. *
  12. * @param {Array<string>} participantIds - The remote participants that are currently selected
  13. * for video forwarding from the bridge.
  14. * @returns {{
  15. * type: SELECT_ENDPOINTS,
  16. * particpantsIds: Array<string>
  17. * }}
  18. */
  19. export function selectEndpoints(participantIds: Array<string>) {
  20. return {
  21. type: SELECT_ENDPOINTS,
  22. participantIds
  23. };
  24. }
  25. /**
  26. * Creates a (redux) action which signals that the list of known remote participants
  27. * with screen shares has changed.
  28. *
  29. * @param {string} participantIds - The remote participants which currently have active
  30. * screen share streams.
  31. * @returns {{
  32. * type: SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
  33. * participantId: string
  34. * }}
  35. */
  36. export function setRemoteParticipantsWithScreenShare(participantIds: Array<string>) {
  37. return {
  38. type: SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
  39. participantIds
  40. };
  41. }
  42. /**
  43. * Creates a (redux) action which signals to set the UI layout to be tiled view
  44. * or not.
  45. *
  46. * @param {boolean} enabled - Whether or not tile view should be shown.
  47. * @returns {{
  48. * type: SET_TILE_VIEW,
  49. * enabled: ?boolean
  50. * }}
  51. */
  52. export function setTileView(enabled: ?boolean) {
  53. return {
  54. type: SET_TILE_VIEW,
  55. enabled
  56. };
  57. }
  58. /**
  59. * Creates a (redux) action which signals either to exit tile view if currently
  60. * enabled or enter tile view if currently disabled.
  61. *
  62. * @returns {Function}
  63. */
  64. export function toggleTileView() {
  65. return (dispatch: Dispatch<any>, getState: Function) => {
  66. const tileViewActive = shouldDisplayTileView(getState());
  67. dispatch(setTileView(!tileViewActive));
  68. };
  69. }