Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

functions.ts 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import { IReduxState } from '../app/types';
  2. import { IStateful } from '../base/app/types';
  3. import { getParticipantById, getParticipantCount, getParticipantCountWithFake } from '../base/participants/functions';
  4. import { toState } from '../base/redux/functions';
  5. import { MAX_MODE_LIMIT, MAX_MODE_THRESHOLD } from './constants';
  6. /**
  7. * Gets the value of a specific React {@code Component} prop of the currently
  8. * mounted {@link App}.
  9. *
  10. * @param {IStateful} stateful - The redux store or {@code getState}
  11. * function.
  12. * @param {string} propName - The name of the React {@code Component} prop of
  13. * the currently mounted {@code App} to get.
  14. * @returns {*} The value of the specified React {@code Component} prop of the
  15. * currently mounted {@code App}.
  16. */
  17. export function doesEveryoneSupportE2EE(stateful: IStateful) {
  18. const state = toState(stateful);
  19. const { numberOfParticipantsNotSupportingE2EE } = state['features/base/participants'];
  20. const { e2eeSupported } = state['features/base/conference'];
  21. const participantCount = getParticipantCountWithFake(state);
  22. if (participantCount === 1) {
  23. // This will happen if we are alone.
  24. return e2eeSupported;
  25. }
  26. return numberOfParticipantsNotSupportingE2EE === 0;
  27. }
  28. /**
  29. * Returns true is the number of participants is larger than {@code MAX_MODE_LIMIT}.
  30. *
  31. * @param {Function|Object} stateful - The redux store or {@code getState}
  32. * function.
  33. * @returns {boolean}.
  34. */
  35. export function isMaxModeReached(stateful: IStateful) {
  36. const participantCount = getParticipantCount(toState(stateful));
  37. return participantCount >= MAX_MODE_LIMIT;
  38. }
  39. /**
  40. * Returns true is the number of participants is larger than {@code MAX_MODE_LIMIT + MAX_MODE_THREHOLD}.
  41. *
  42. * @param {Function|Object} stateful - The redux store or {@code getState}
  43. * function.
  44. * @returns {boolean}.
  45. */
  46. export function isMaxModeThresholdReached(stateful: IStateful) {
  47. const participantCount = getParticipantCount(toState(stateful));
  48. return participantCount >= MAX_MODE_LIMIT + MAX_MODE_THRESHOLD;
  49. }
  50. /**
  51. * Returns whether e2ee is enabled by the backend.
  52. *
  53. * @param {Object} state - The redux state.
  54. * @param {string} pId - The participant id.
  55. * @returns {boolean}
  56. */
  57. export function displayVerification(state: IReduxState, pId: string) {
  58. const { conference } = state['features/base/conference'];
  59. const participant = getParticipantById(state, pId);
  60. return Boolean(conference?.isE2EEEnabled()
  61. && participant?.e2eeVerificationAvailable
  62. && participant?.e2eeVerified === undefined);
  63. }