Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

UnsupportedMobileBrowser.js 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. import React, { Component } from 'react';
  2. import { connect } from 'react-redux';
  3. import { Platform } from '../../base/react';
  4. /**
  5. * The map of platforms to URLs at which the mobile app for the associated
  6. * platform is available for download.
  7. */
  8. const URLS = {
  9. android: 'https://play.google.com/store/apps/details?id=org.jitsi.meet',
  10. ios: 'https://itunes.apple.com/us/app/jitsi-meet/id1165103905'
  11. };
  12. /**
  13. * React component representing mobile browser page.
  14. *
  15. * @class UnsupportedMobileBrowser
  16. */
  17. class UnsupportedMobileBrowser extends Component {
  18. /**
  19. * Mobile browser page component's property types.
  20. *
  21. * @static
  22. */
  23. static propTypes = {
  24. /**
  25. * The name of the conference room to be joined upon clicking the
  26. * respective button.
  27. *
  28. * @private
  29. * @type {string}
  30. */
  31. _room: React.PropTypes.string
  32. }
  33. /**
  34. * Constructor of UnsupportedMobileBrowser component.
  35. *
  36. * @param {Object} props - The read-only React Component props with which
  37. * the new instance is to be initialized.
  38. */
  39. constructor(props) {
  40. super(props);
  41. // Bind methods
  42. this._onJoinClick = this._onJoinClick.bind(this);
  43. }
  44. /**
  45. * React lifecycle method triggered before component will mount.
  46. *
  47. * @returns {void}
  48. */
  49. componentWillMount() {
  50. const joinButtonText
  51. = this.props._room ? 'Join the conversation' : 'Start a conference';
  52. this.setState({
  53. joinButtonText
  54. });
  55. }
  56. /**
  57. * Renders component.
  58. *
  59. * @returns {ReactElement}
  60. */
  61. render() {
  62. const ns = 'unsupported-mobile-browser';
  63. const downloadButtonClassName = `${ns}__button ${ns}__button_primary`;
  64. return (
  65. <div className = { ns }>
  66. <div className = { `${ns}__body` }>
  67. <img
  68. className = { `${ns}__logo` }
  69. src = '/images/logo-blue.svg' />
  70. <p className = { `${ns}__text` }>
  71. You need <strong>Jitsi Meet</strong> to join a
  72. conversation on your mobile
  73. </p>
  74. <a href = { URLS[Platform.OS] }>
  75. <button className = { downloadButtonClassName }>
  76. Download the App
  77. </button>
  78. </a>
  79. <p className = { `${ns}__text ${ns}__text_small` }>
  80. or if you already have it
  81. <br />
  82. <strong>then</strong>
  83. </p>
  84. <button
  85. className = { `${ns}__button` }
  86. onClick = { this._onJoinClick }>
  87. {
  88. this.state.joinButtonText
  89. }
  90. </button>
  91. </div>
  92. </div>
  93. );
  94. }
  95. /**
  96. * Handles clicks on the button that joins the local participant in a
  97. * conference.
  98. *
  99. * @private
  100. * @returns {void}
  101. */
  102. _onJoinClick() {
  103. // If the user installed the app while this Component was displayed
  104. // (e.g. the user clicked the Download the App button), then we would
  105. // like to open the current URL in the mobile app.
  106. // TODO The only way to do it appears to be a link with an app-specific
  107. // scheme, not a Universal Link.
  108. }
  109. }
  110. /**
  111. * Maps (parts of) the Redux state to the associated UnsupportedMobileBrowser's
  112. * props.
  113. *
  114. * @param {Object} state - Redux state.
  115. * @private
  116. * @returns {{
  117. * _room: string
  118. * }}
  119. */
  120. function _mapStateToProps(state) {
  121. return {
  122. /**
  123. * The name of the conference room to be joined upon clicking the
  124. * respective button.
  125. *
  126. * @private
  127. * @type {string}
  128. */
  129. _room: state['features/base/conference'].room
  130. };
  131. }
  132. export default connect(_mapStateToProps)(UnsupportedMobileBrowser);