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.

functions.js 881B

123456789101112131415161718192021222324252627282930313233
  1. // @flow
  2. import { getOverlays } from './overlays';
  3. /**
  4. * Returns the overlay to be currently rendered.
  5. *
  6. * @param {Object} state - The Redux state.
  7. * @returns {?React$ComponentType<*>}
  8. */
  9. export function getOverlayToRender(state: Object) {
  10. for (const overlay of getOverlays()) {
  11. // react-i18n / react-redux wrap components and thus we cannot access
  12. // the wrapped component's static methods directly.
  13. const component = overlay.WrappedComponent || overlay;
  14. if (component.needsRender(state)) {
  15. return overlay;
  16. }
  17. }
  18. return undefined;
  19. }
  20. /**
  21. * Returns the visibility of the media permissions prompt.
  22. *
  23. * @param {Object} state - The Redux state.
  24. * @returns {boolean}
  25. */
  26. export function getMediaPermissionPromptVisibility(state: Object) {
  27. return state['features/overlay'].isMediaPermissionPromptVisible;
  28. }