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.

AbstractUserMediaPermissionsOverlay.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* @flow */
  2. import { Component } from 'react';
  3. /**
  4. * The type of the React {@code Component} props of
  5. * {@link AbstractUserMediaPermissionsOverlay}.
  6. */
  7. type Props = {
  8. /**
  9. * The browser which is used currently. The text is different for every
  10. * browser.
  11. */
  12. browser: string,
  13. /**
  14. * The function to translate human-readable text.
  15. */
  16. t: Function
  17. };
  18. /**
  19. * Implements a React {@link Component} for overlay with guidance how to proceed
  20. * with gUM prompt.
  21. */
  22. export default class AbstractUserMediaPermissionsOverlay
  23. extends Component<Props> {
  24. /**
  25. * Determines whether this overlay needs to be rendered (according to a
  26. * specific redux state). Called by {@link OverlayContainer}.
  27. *
  28. * @param {Object} state - The redux state.
  29. * @returns {boolean} - If this overlay needs to be rendered, {@code true};
  30. * {@code false}, otherwise.
  31. */
  32. static needsRender(state: Object) {
  33. return state['features/overlay'].isMediaPermissionPromptVisible;
  34. }
  35. }
  36. /**
  37. * Maps (parts of) the redux state to the associated component's props.
  38. *
  39. * @param {Object} state - The redux state.
  40. * @protected
  41. * @returns {{
  42. * browser: string
  43. * }}
  44. */
  45. export function abstractMapStateToProps(state: Object) {
  46. const { browser } = state['features/overlay'];
  47. return {
  48. browser
  49. };
  50. }