您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Entryway.js 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import PropTypes from 'prop-types';
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import BlankPage from './BlankPage';
  5. import WelcomePage from './WelcomePage';
  6. /**
  7. * A React <tt>Component</tt> which is rendered when there is no (valid) room
  8. * (name) i.e. it is the opposite of <tt>Conference</tt>. Generally and
  9. * historically, it is <tt>WelcomePage</tt>. However, Jitsi Meet SDK for Android
  10. * and iOS allows the use of the (JavaScript) app without <tt>WelcomePage</tt>
  11. * and it needs to display something between conferences.
  12. */
  13. class Entryway extends Component {
  14. /**
  15. * <tt>Entryway</tt>'s React <tt>Component</tt> prop types.
  16. */
  17. static propTypes = {
  18. /**
  19. * The indicator which determines whether <tt>WelcomePage</tt> is (to
  20. * be) rendered.
  21. *
  22. * @private
  23. */
  24. _welcomePageEnabled: PropTypes.bool
  25. };
  26. /**
  27. * Implements React's {@link Component#render()}.
  28. *
  29. * @inheritdoc
  30. * @returns {ReactElement}
  31. */
  32. render() {
  33. return (
  34. this.props._welcomePageEnabled ? <WelcomePage /> : <BlankPage />
  35. );
  36. }
  37. }
  38. /**
  39. * Maps (parts of) the redux state to the associated Entryway's props.
  40. *
  41. * @param {Object} state - The redux state.
  42. * @private
  43. * @returns {{
  44. * _welcomePageEnabled: boolean
  45. * }}
  46. */
  47. function _mapStateToProps(state) {
  48. let welcomePageEnabled;
  49. if (navigator.product === 'ReactNative') {
  50. // We introduced the welcomePageEnabled prop on App in Jitsi Meet SDK
  51. // for Android and iOS. There isn't a strong reason not to introduce it
  52. // on Web but there're a few considerations to be taken before I go
  53. // there among which:
  54. // - Enabling/disabling the Welcome page on Web historically
  55. // automatically redirects to a random room and that does not make sense
  56. // on mobile (right now).
  57. const { app } = state['features/app'];
  58. welcomePageEnabled = Boolean(app && app.props.welcomePageEnabled);
  59. } else {
  60. welcomePageEnabled = true;
  61. }
  62. return {
  63. _welcomePageEnabled: welcomePageEnabled
  64. };
  65. }
  66. export default connect(_mapStateToProps)(Entryway);