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

DeepLinkingMobilePage.js 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 { HideNotificationBarStyle, Platform } from '../../base/react';
  7. import { DialInSummary } from '../../invite';
  8. import { _TNS } from '../constants';
  9. import { generateDeepLinkingURL } from '../functions';
  10. declare var interfaceConfig: Object;
  11. /**
  12. * The namespace of the CSS styles of DeepLinkingMobilePage.
  13. *
  14. * @private
  15. * @type {string}
  16. */
  17. const _SNS = 'deep-linking-mobile';
  18. /**
  19. * The map of platforms to URLs at which the mobile app for the associated
  20. * platform is available for download.
  21. *
  22. * @private
  23. * @type {Array<string>}
  24. */
  25. const _URLS = {
  26. android: interfaceConfig.MOBILE_DOWNLOAD_LINK_ANDROID
  27. || 'https://play.google.com/store/apps/details?id=org.jitsi.meet',
  28. ios: interfaceConfig.MOBILE_DOWNLOAD_LINK_IOS
  29. || 'https://itunes.apple.com/us/app/jitsi-meet/id1165103905'
  30. };
  31. /**
  32. * React component representing mobile browser page.
  33. *
  34. * @class DeepLinkingMobilePage
  35. */
  36. class DeepLinkingMobilePage extends Component<*, *> {
  37. state: Object;
  38. /**
  39. * DeepLinkingMobilePage component's property types.
  40. *
  41. * @static
  42. */
  43. static propTypes = {
  44. /**
  45. * The name of the conference attempting to being joined.
  46. */
  47. _room: PropTypes.string,
  48. /**
  49. * The function to translate human-readable text.
  50. *
  51. * @public
  52. * @type {Function}
  53. */
  54. t: PropTypes.func
  55. };
  56. /**
  57. * Initializes the text and URL of the `Start a conference` / `Join the
  58. * conversation` button which takes the user to the mobile app.
  59. *
  60. * @inheritdoc
  61. */
  62. componentWillMount() {
  63. this.setState({
  64. joinURL: generateDeepLinkingURL()
  65. });
  66. }
  67. /**
  68. * Implements React's {@link Component#render()}.
  69. *
  70. * @inheritdoc
  71. * @returns {ReactElement}
  72. */
  73. render() {
  74. const { _room, t } = this.props;
  75. const { NATIVE_APP_NAME, SHOW_DEEP_LINKING_IMAGE } = interfaceConfig;
  76. const downloadButtonClassName
  77. = `${_SNS}__button ${_SNS}__button_primary`;
  78. return (
  79. <div className = { _SNS }>
  80. <div className = 'header'>
  81. <img
  82. className = 'logo'
  83. src = '../images/logo-deep-linking.png' />
  84. </div>
  85. <div className = { `${_SNS}__body` }>
  86. {
  87. SHOW_DEEP_LINKING_IMAGE
  88. ? <img
  89. className = 'image'
  90. src = '../images/deep-linking-image.png' />
  91. : null
  92. }
  93. <p className = { `${_SNS}__text` }>
  94. {
  95. translateToHTML(
  96. t,
  97. `${_TNS}.appNotInstalled`,
  98. { app: NATIVE_APP_NAME })
  99. }
  100. </p>
  101. <a href = { _URLS[Platform.OS] }>
  102. <button className = { downloadButtonClassName }>
  103. { t(`${_TNS}.downloadApp`) }
  104. </button>
  105. </a>
  106. <a
  107. className = { `${_SNS}__href` }
  108. href = { this.state.joinURL }>
  109. {/* <button className = { `${_SNS}__button` }> */}
  110. { t(`${_TNS}.openApp`) }
  111. {/* </button> */}
  112. </a>
  113. <DialInSummary
  114. className = 'deep-linking-dial-in'
  115. clickableNumbers = { true }
  116. room = { _room } />
  117. </div>
  118. <HideNotificationBarStyle />
  119. </div>
  120. );
  121. }
  122. }
  123. /**
  124. * Maps (parts of) the Redux state to the associated props for the
  125. * {@code DeepLinkingMobilePage} component.
  126. *
  127. * @param {Object} state - The Redux state.
  128. * @private
  129. * @returns {{
  130. * _room: string
  131. * }}
  132. */
  133. function _mapStateToProps(state) {
  134. return {
  135. _room: state['features/base/conference'].room
  136. };
  137. }
  138. export default translate(connect(_mapStateToProps)(DeepLinkingMobilePage));