Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

actions.js 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // @flow
  2. import type { Dispatch } from 'redux';
  3. import {
  4. FAKE_SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
  5. SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
  6. SET_TILE_VIEW
  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 fake screen share participant ids has changed.
  28. *
  29. * @param {string} participantIds - The remote fake screen share participants.
  30. * @returns {{
  31. * type: FAKE_SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
  32. * participantIds: Array<string>
  33. * }}
  34. */
  35. export function fakeScreenshareParticipantsUpdated(participantIds: Array<string>) {
  36. return {
  37. type: FAKE_SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
  38. participantIds
  39. };
  40. }
  41. /**
  42. * Creates a (redux) action which signals to set the UI layout to be tiled view
  43. * or not.
  44. *
  45. * @param {boolean} enabled - Whether or not tile view should be shown.
  46. * @returns {{
  47. * type: SET_TILE_VIEW,
  48. * enabled: ?boolean
  49. * }}
  50. */
  51. export function setTileView(enabled: ?boolean) {
  52. return {
  53. type: SET_TILE_VIEW,
  54. enabled
  55. };
  56. }
  57. /**
  58. * Creates a (redux) action which signals either to exit tile view if currently
  59. * enabled or enter tile view if currently disabled.
  60. *
  61. * @returns {Function}
  62. */
  63. export function toggleTileView() {
  64. return (dispatch: Dispatch<any>, getState: Function) => {
  65. const tileViewActive = shouldDisplayTileView(getState());
  66. dispatch(setTileView(!tileViewActive));
  67. };
  68. }