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

actions.js 1.5KB

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