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

actions.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. import {
  4. SCREEN_SHARE_PARTICIPANTS_UPDATED,
  5. SET_TILE_VIEW
  6. } from './actionTypes';
  7. /**
  8. * Creates a (redux) action which signals that the list of known participants
  9. * with screen shares has changed.
  10. *
  11. * @param {string} participantIds - The participants which currently have active
  12. * screen share streams.
  13. * @returns {{
  14. * type: SCREEN_SHARE_PARTICIPANTS_UPDATED,
  15. * participantId: string
  16. * }}
  17. */
  18. export function setParticipantsWithScreenShare(participantIds: Array<string>) {
  19. return {
  20. type: SCREEN_SHARE_PARTICIPANTS_UPDATED,
  21. participantIds
  22. };
  23. }
  24. /**
  25. * Creates a (redux) action which signals to set the UI layout to be tiled view
  26. * or not.
  27. *
  28. * @param {boolean} enabled - Whether or not tile view should be shown.
  29. * @returns {{
  30. * type: SET_TILE_VIEW,
  31. * enabled: boolean
  32. * }}
  33. */
  34. export function setTileView(enabled: boolean) {
  35. return {
  36. type: SET_TILE_VIEW,
  37. enabled
  38. };
  39. }
  40. /**
  41. * Creates a (redux) action which signals either to exit tile view if currently
  42. * enabled or enter tile view if currently disabled.
  43. *
  44. * @returns {Function}
  45. */
  46. export function toggleTileView() {
  47. return (dispatch: Dispatch<any>, getState: Function) => {
  48. const { tileViewEnabled } = getState()['features/video-layout'];
  49. dispatch(setTileView(!tileViewEnabled));
  50. };
  51. }