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

UnsupportedMobileBrowser.js 4.0KB

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