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 3.9KB

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