You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import debounce from 'lodash/debounce';
  2. import { NativeModules } from 'react-native';
  3. import { IParticipant } from '../../base/participants/types';
  4. import { readyToClose } from './actions';
  5. /**
  6. * Sends a specific event to the native counterpart of the External API. Native
  7. * apps may listen to such events via the mechanisms provided by the (native)
  8. * mobile Jitsi Meet SDK.
  9. *
  10. * @param {Object} store - The redux store.
  11. * @param {string} name - The name of the event to send.
  12. * @param {Object} data - The details/specifics of the event to send determined
  13. * by/associated with the specified {@code name}.
  14. * @returns {void}
  15. */
  16. export function sendEvent(store: Object, name: string, data: Object) {
  17. NativeModules.ExternalAPI.sendEvent(name, data);
  18. }
  19. /**
  20. * Debounced sending of `readyToClose`.
  21. */
  22. export const _sendReadyToClose = debounce(dispatch => {
  23. dispatch(readyToClose());
  24. }, 2500, { leading: true });
  25. /**
  26. * Returns a participant info object based on the passed participant object from redux.
  27. *
  28. * @param {Participant} participant - The participant object from the redux store.
  29. * @returns {Object} - The participant info object.
  30. */
  31. export function participantToParticipantInfo(participant: IParticipant) {
  32. return {
  33. isLocal: participant.local,
  34. email: participant.email,
  35. name: participant.name,
  36. participantId: participant.id,
  37. displayName: participant.displayName,
  38. avatarUrl: participant.avatarURL,
  39. role: participant.role
  40. };
  41. }