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.

UnsupportedMobileBrowser.js 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. * @private
  9. */
  10. const _URLS = {
  11. android: 'https://play.google.com/store/apps/details?id=org.jitsi.meet',
  12. ios: 'https://itunes.apple.com/us/app/jitsi-meet/id1165103905'
  13. };
  14. /**
  15. * React component representing mobile browser page.
  16. *
  17. * @class UnsupportedMobileBrowser
  18. */
  19. class UnsupportedMobileBrowser extends Component {
  20. /**
  21. * UnsupportedMobileBrowser component's property types.
  22. *
  23. * @static
  24. */
  25. static propTypes = {
  26. /**
  27. * The name of the conference room to be joined upon clicking the
  28. * respective button.
  29. *
  30. * @private
  31. * @type {string}
  32. */
  33. _room: React.PropTypes.string
  34. }
  35. /**
  36. * Initializes the text and URL of the `Start a conference` / `Join the
  37. * conversation` button which takes the user to the mobile app.
  38. *
  39. * @inheritdoc
  40. */
  41. componentWillMount() {
  42. const joinText
  43. = this.props._room ? 'Join the conversation' : 'Start a conference';
  44. // If the user installed the app while this Component was displayed
  45. // (e.g. the user clicked the Download the App button), then we would
  46. // like to open the current URL in the mobile app. The only way to do it
  47. // appears to be a link with an app-specific scheme, not a Universal
  48. // Link.
  49. const joinURL = `org.jitsi.meet:${window.location.href}`;
  50. this.setState({
  51. joinText,
  52. joinURL
  53. });
  54. }
  55. /**
  56. * Implements React's {@link Component#render()}.
  57. *
  58. * @inheritdoc
  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. <a href = { this.state.joinURL }>
  85. <button className = { `${ns}__button` }>
  86. {
  87. this.state.joinText
  88. }
  89. </button>
  90. </a>
  91. </div>
  92. {
  93. this._renderStyle()
  94. }
  95. </div>
  96. );
  97. }
  98. /**
  99. * Renders an HTML style element with CSS specific to
  100. * this UnsupportedMobileBrowser.
  101. *
  102. * @private
  103. * @returns {ReactElement}
  104. */
  105. _renderStyle() {
  106. // Temasys provide lib-jitsi-meet/modules/RTC/adapter.screenshare.js
  107. // which detects whether the browser supports WebRTC. If the browser
  108. // does not support WebRTC, it displays an alert in the form of a yellow
  109. // bar at the top of the page. The alert notifies the user that the
  110. // browser does not support WebRTC and, if Temasys provide a plugin for
  111. // the browser, the alert contains a button to initiate installing the
  112. // browser. When Temasys do not provide a plugin for the browser, we do
  113. // not want the alert on the unsupported-browser page because the
  114. // notification about the lack of WebRTC support is the whole point of
  115. // the unsupported-browser page.
  116. return (
  117. <style type = 'text/css'>
  118. {
  119. 'iframe[name="adapterjs-alert"] { display: none; }'
  120. }
  121. </style>
  122. );
  123. }
  124. }
  125. /**
  126. * Maps (parts of) the Redux state to the associated UnsupportedMobileBrowser's
  127. * props.
  128. *
  129. * @param {Object} state - Redux state.
  130. * @private
  131. * @returns {{
  132. * _room: string
  133. * }}
  134. */
  135. function _mapStateToProps(state) {
  136. return {
  137. /**
  138. * The name of the conference room to be joined upon clicking the
  139. * respective button.
  140. *
  141. * @private
  142. * @type {string}
  143. */
  144. _room: state['features/base/conference'].room
  145. };
  146. }
  147. export default connect(_mapStateToProps)(UnsupportedMobileBrowser);