Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

subscriber.js 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // @flow
  2. import { getLocalParticipant } from '../base/participants';
  3. import { StateListenerRegistry } from '../base/redux';
  4. import { appendSuffix } from '../display-name';
  5. import { shouldDisplayTileView } from '../video-layout';
  6. declare var APP: Object;
  7. /**
  8. * StateListenerRegistry provides a reliable way of detecting changes to
  9. * preferred layout state and dispatching additional actions.
  10. */
  11. StateListenerRegistry.register(
  12. /* selector */ state => shouldDisplayTileView(state),
  13. /* listener */ displayTileView => {
  14. APP.API.notifyTileViewChanged(displayTileView);
  15. });
  16. StateListenerRegistry.register(
  17. /* selector */ state => state['features/base/settings'].displayName,
  18. /* listener */ (displayName, store) => {
  19. const localParticipant = getLocalParticipant(store.getState());
  20. const { defaultLocalDisplayName } = store.getState()['features/base/config'];
  21. // Initial setting of the display name happens on app
  22. // initialization, before the local participant is ready. The initial
  23. // settings is not desired to be fired anyways, only changes.
  24. if (localParticipant) {
  25. const { id } = localParticipant;
  26. APP.API.notifyDisplayNameChanged(id, {
  27. displayName,
  28. formattedDisplayName: appendSuffix(
  29. displayName,
  30. defaultLocalDisplayName
  31. )
  32. });
  33. }
  34. });
  35. StateListenerRegistry.register(
  36. /* selector */ state => state['features/base/settings'].email,
  37. /* listener */ (email, store) => {
  38. const localParticipant = getLocalParticipant(store.getState());
  39. // Initial setting of the email happens on app
  40. // initialization, before the local participant is ready. The initial
  41. // settings is not desired to be fired anyways, only changes.
  42. if (localParticipant) {
  43. const { id } = localParticipant;
  44. APP.API.notifyEmailChanged(id, {
  45. email
  46. });
  47. }
  48. });
  49. /**
  50. * Updates the on stage participant value.
  51. */
  52. StateListenerRegistry.register(
  53. /* selector */ state => state['features/large-video'].participantId,
  54. /* listener */ participantId => {
  55. APP.API.notifyOnStageParticipantChanged(participantId);
  56. }
  57. );