您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

actions.js 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. import {
  4. SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
  5. SET_TILE_VIEW,
  6. VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED
  7. } from './actionTypes';
  8. import { shouldDisplayTileView } from './functions';
  9. /**
  10. * Creates a (redux) action which signals that the list of known remote participants
  11. * with screen shares has changed.
  12. *
  13. * @param {string} participantIds - The remote participants which currently have active
  14. * screen share streams.
  15. * @returns {{
  16. * type: SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
  17. * participantId: string
  18. * }}
  19. */
  20. export function setRemoteParticipantsWithScreenShare(participantIds: Array<string>) {
  21. return {
  22. type: SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
  23. participantIds
  24. };
  25. }
  26. /**
  27. * Creates a (redux) action which signals that the list of known remote virtual screen share participant ids has
  28. * changed.
  29. *
  30. * @param {string} participantIds - The remote virtual screen share participants.
  31. * @returns {{
  32. * type: VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED,
  33. * participantIds: Array<string>
  34. * }}
  35. */
  36. export function virtualScreenshareParticipantsUpdated(participantIds: Array<string>) {
  37. return {
  38. type: VIRTUAL_SCREENSHARE_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. }