選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

functions.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { getParticipantCount } from '../base/participants/functions';
  2. import { toState } from '../base/redux';
  3. import { MAX_MODE_LIMIT, MAX_MODE_THRESHOLD } from './constants';
  4. /**
  5. * Gets the value of a specific React {@code Component} prop of the currently
  6. * mounted {@link App}.
  7. *
  8. * @param {Function|Object} stateful - The redux store or {@code getState}
  9. * function.
  10. * @param {string} propName - The name of the React {@code Component} prop of
  11. * the currently mounted {@code App} to get.
  12. * @returns {*} The value of the specified React {@code Component} prop of the
  13. * currently mounted {@code App}.
  14. */
  15. export function doesEveryoneSupportE2EE(stateful) {
  16. const state = toState(stateful);
  17. const { everyoneSupportE2EE } = state['features/e2ee'];
  18. const { e2eeSupported } = state['features/base/conference'];
  19. const participantCount = getParticipantCount(state);
  20. if (typeof everyoneSupportE2EE === 'undefined' && participantCount === 1) {
  21. // This will happen if we are alone.
  22. return e2eeSupported;
  23. }
  24. return everyoneSupportE2EE;
  25. }
  26. /**
  27. * Returns true is the number of participants is larger than {@code MAX_MODE_LIMIT}.
  28. *
  29. * @param {Function|Object} stateful - The redux store or {@code getState}
  30. * function.
  31. * @returns {boolean}.
  32. */
  33. export function isMaxModeReached(stateful) {
  34. const participantCount = getParticipantCount(toState(stateful));
  35. return participantCount >= MAX_MODE_LIMIT;
  36. }
  37. /**
  38. * Returns true is the number of participants is larger than {@code MAX_MODE_LIMIT + MAX_MODE_THREHOLD}.
  39. *
  40. * @param {Function|Object} stateful - The redux store or {@code getState}
  41. * function.
  42. * @returns {boolean}.
  43. */
  44. export function isMaxModeThresholdReached(stateful) {
  45. const participantCount = getParticipantCount(toState(stateful));
  46. return participantCount >= MAX_MODE_LIMIT + MAX_MODE_THRESHOLD;
  47. }