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

UnsupportedMobileBrowser.js 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import { translate, translateToHTML } from '../../base/i18n';
  5. import { Platform } from '../../base/react';
  6. import HideNotificationBarStyle from './HideNotificationBarStyle';
  7. /**
  8. * The namespace of the CSS styles of UnsupportedMobileBrowser.
  9. *
  10. * @private
  11. * @type {string}
  12. */
  13. const _SNS = 'unsupported-mobile-browser';
  14. /**
  15. * The namespace of the i18n/translation keys of UnsupportedMobileBrowser.
  16. *
  17. * @private
  18. * @type {string}
  19. */
  20. const _TNS = 'unsupportedBrowser';
  21. /**
  22. * The map of platforms to URLs at which the mobile app for the associated
  23. * platform is available for download.
  24. *
  25. * @private
  26. * @type {Array<string>}
  27. */
  28. const _URLS = {
  29. android: 'https://play.google.com/store/apps/details?id=org.jitsi.meet',
  30. ios: 'https://itunes.apple.com/us/app/jitsi-meet/id1165103905'
  31. };
  32. /**
  33. * React component representing mobile browser page.
  34. *
  35. * @class UnsupportedMobileBrowser
  36. */
  37. class UnsupportedMobileBrowser extends Component {
  38. state: Object;
  39. /**
  40. * UnsupportedMobileBrowser component's property types.
  41. *
  42. * @static
  43. */
  44. static propTypes = {
  45. /**
  46. * The name of the conference room to be joined upon clicking the
  47. * respective button.
  48. *
  49. * @private
  50. * @type {string}
  51. */
  52. _room: React.PropTypes.string,
  53. /**
  54. * The function to translate human-readable text.
  55. *
  56. * @public
  57. * @type {Function}
  58. */
  59. t: React.PropTypes.func
  60. };
  61. /**
  62. * Initializes the text and URL of the `Start a conference` / `Join the
  63. * conversation` button which takes the user to the mobile app.
  64. *
  65. * @inheritdoc
  66. */
  67. componentWillMount() {
  68. const joinText
  69. = this.props._room ? 'joinConversation' : 'startConference';
  70. // If the user installed the app while this Component was displayed
  71. // (e.g. the user clicked the Download the App button), then we would
  72. // like to open the current URL in the mobile app. The only way to do it
  73. // appears to be a link with an app-specific scheme, not a Universal
  74. // Link.
  75. const joinURL = `org.jitsi.meet:${window.location.href}`;
  76. this.setState({
  77. joinText,
  78. joinURL
  79. });
  80. }
  81. /**
  82. * Implements React's {@link Component#render()}.
  83. *
  84. * @inheritdoc
  85. * @returns {ReactElement}
  86. */
  87. render() {
  88. const { t } = this.props;
  89. const downloadButtonClassName
  90. = `${_SNS}__button ${_SNS}__button_primary`;
  91. return (
  92. <div className = { _SNS }>
  93. <div className = { `${_SNS}__body` }>
  94. <img
  95. className = { `${_SNS}__logo` }
  96. src = 'images/logo-blue.svg' />
  97. <p className = { `${_SNS}__text` }>
  98. {
  99. translateToHTML(
  100. t,
  101. `${_TNS}.appNotInstalled`,
  102. { postProcess: 'resolveAppName' })
  103. }
  104. </p>
  105. <a href = { _URLS[Platform.OS] }>
  106. <button className = { downloadButtonClassName }>
  107. { t(`${_TNS}.downloadApp`) }
  108. </button>
  109. </a>
  110. <p className = { `${_SNS}__text ${_SNS}__text_small` }>
  111. { translateToHTML(t, `${_TNS}.appInstalled`) }
  112. </p>
  113. <a href = { this.state.joinURL }>
  114. <button className = { `${_SNS}__button` }>
  115. { t(`${_TNS}.${this.state.joinText}`) }
  116. </button>
  117. </a>
  118. </div>
  119. <HideNotificationBarStyle />
  120. </div>
  121. );
  122. }
  123. }
  124. /**
  125. * Maps (parts of) the Redux state to the associated UnsupportedMobileBrowser's
  126. * props.
  127. *
  128. * @param {Object} state - Redux state.
  129. * @private
  130. * @returns {{
  131. * _room: string
  132. * }}
  133. */
  134. function _mapStateToProps(state) {
  135. return {
  136. /**
  137. * The name of the conference room to be joined upon clicking the
  138. * respective button.
  139. *
  140. * @private
  141. * @type {string}
  142. */
  143. _room: state['features/base/conference'].room
  144. };
  145. }
  146. export default translate(connect(_mapStateToProps)(UnsupportedMobileBrowser));