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

UnsupportedMobileBrowser.js 4.6KB

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