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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import { Platform } from '../../base/react';
  5. /**
  6. * The map of platforms to URLs at which the mobile app for the associated
  7. * platform is available for download.
  8. *
  9. * @private
  10. */
  11. const _URLS = {
  12. android: 'https://play.google.com/store/apps/details?id=org.jitsi.meet',
  13. ios: 'https://itunes.apple.com/us/app/jitsi-meet/id1165103905'
  14. };
  15. /**
  16. * React component representing mobile browser page.
  17. *
  18. * @class UnsupportedMobileBrowser
  19. */
  20. class UnsupportedMobileBrowser extends Component {
  21. state: Object;
  22. /**
  23. * UnsupportedMobileBrowser component's property types.
  24. *
  25. * @static
  26. */
  27. static propTypes = {
  28. /**
  29. * The name of the conference room to be joined upon clicking the
  30. * respective button.
  31. *
  32. * @private
  33. * @type {string}
  34. */
  35. _room: React.PropTypes.string
  36. }
  37. /**
  38. * Initializes the text and URL of the `Start a conference` / `Join the
  39. * conversation` button which takes the user to the mobile app.
  40. *
  41. * @inheritdoc
  42. */
  43. componentWillMount() {
  44. const joinText
  45. = this.props._room ? 'Join the conversation' : 'Start a conference';
  46. // If the user installed the app while this Component was displayed
  47. // (e.g. the user clicked the Download the App button), then we would
  48. // like to open the current URL in the mobile app. The only way to do it
  49. // appears to be a link with an app-specific scheme, not a Universal
  50. // Link.
  51. const joinURL = `org.jitsi.meet:${window.location.href}`;
  52. this.setState({
  53. joinText,
  54. joinURL
  55. });
  56. }
  57. /**
  58. * Implements React's {@link Component#render()}.
  59. *
  60. * @inheritdoc
  61. * @returns {ReactElement}
  62. */
  63. render() {
  64. const ns = 'unsupported-mobile-browser';
  65. const downloadButtonClassName = `${ns}__button ${ns}__button_primary`;
  66. return (
  67. <div className = { ns }>
  68. <div className = { `${ns}__body` }>
  69. <img
  70. className = { `${ns}__logo` }
  71. src = 'images/logo-blue.svg' />
  72. <p className = { `${ns}__text` }>
  73. You need <strong>Jitsi Meet</strong> to join a
  74. conversation on your mobile
  75. </p>
  76. <a href = { _URLS[Platform.OS] }>
  77. <button className = { downloadButtonClassName }>
  78. Download the App
  79. </button>
  80. </a>
  81. <p className = { `${ns}__text ${ns}__text_small` }>
  82. or if you already have it
  83. <br />
  84. <strong>then</strong>
  85. </p>
  86. <a href = { this.state.joinURL }>
  87. <button className = { `${ns}__button` }>
  88. {
  89. this.state.joinText
  90. }
  91. </button>
  92. </a>
  93. </div>
  94. {
  95. this._renderStyle()
  96. }
  97. </div>
  98. );
  99. }
  100. /**
  101. * Renders an HTML style element with CSS specific to
  102. * this UnsupportedMobileBrowser.
  103. *
  104. * @private
  105. * @returns {ReactElement}
  106. */
  107. _renderStyle() {
  108. // Temasys provide lib-jitsi-meet/modules/RTC/adapter.screenshare.js
  109. // which detects whether the browser supports WebRTC. If the browser
  110. // does not support WebRTC, it displays an alert in the form of a yellow
  111. // bar at the top of the page. The alert notifies the user that the
  112. // browser does not support WebRTC and, if Temasys provide a plugin for
  113. // the browser, the alert contains a button to initiate installing the
  114. // browser. When Temasys do not provide a plugin for the browser, we do
  115. // not want the alert on the unsupported-browser page because the
  116. // notification about the lack of WebRTC support is the whole point of
  117. // the unsupported-browser page.
  118. return (
  119. <style type = 'text/css'>
  120. {
  121. 'iframe[name="adapterjs-alert"] { display: none; }'
  122. }
  123. </style>
  124. );
  125. }
  126. }
  127. /**
  128. * Maps (parts of) the Redux state to the associated UnsupportedMobileBrowser's
  129. * props.
  130. *
  131. * @param {Object} state - Redux state.
  132. * @private
  133. * @returns {{
  134. * _room: string
  135. * }}
  136. */
  137. function _mapStateToProps(state) {
  138. return {
  139. /**
  140. * The name of the conference room to be joined upon clicking the
  141. * respective button.
  142. *
  143. * @private
  144. * @type {string}
  145. */
  146. _room: state['features/base/conference'].room
  147. };
  148. }
  149. export default connect(_mapStateToProps)(UnsupportedMobileBrowser);