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.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /* @flow */
  2. import PropTypes from 'prop-types';
  3. import React, { Component } from 'react';
  4. import { translate, translateToHTML } from '../../base/i18n';
  5. import { Platform } from '../../base/react';
  6. import HideNotificationBarStyle from './HideNotificationBarStyle';
  7. declare var interfaceConfig: Object;
  8. /**
  9. * The namespace of the CSS styles of UnsupportedMobileBrowser.
  10. *
  11. * @private
  12. * @type {string}
  13. */
  14. const _SNS = 'unsupported-mobile-browser';
  15. /**
  16. * The namespace of the i18n/translation keys of UnsupportedMobileBrowser.
  17. *
  18. * @private
  19. * @type {string}
  20. */
  21. const _TNS = 'unsupportedBrowser';
  22. /**
  23. * The map of platforms to URLs at which the mobile app for the associated
  24. * platform is available for download.
  25. *
  26. * @private
  27. * @type {Array<string>}
  28. */
  29. const _URLS = {
  30. android: interfaceConfig.MOBILE_DOWNLOAD_LINK_ANDROID
  31. || 'https://play.google.com/store/apps/details?id=org.jitsi.meet',
  32. ios: interfaceConfig.MOBILE_DOWNLOAD_LINK_IOS
  33. || 'https://itunes.apple.com/us/app/jitsi-meet/id1165103905'
  34. };
  35. /**
  36. * React component representing mobile browser page.
  37. *
  38. * @class UnsupportedMobileBrowser
  39. */
  40. class UnsupportedMobileBrowser extends Component<*, *> {
  41. state: Object;
  42. /**
  43. * UnsupportedMobileBrowser component's property types.
  44. *
  45. * @static
  46. */
  47. static propTypes = {
  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. // If the user installed the app while this Component was displayed
  64. // (e.g. the user clicked the Download the App button), then we would
  65. // like to open the current URL in the mobile app. The only way to do it
  66. // appears to be a link with an app-specific scheme, not a Universal
  67. // Link.
  68. const appScheme = interfaceConfig.MOBILE_APP_SCHEME || 'org.jitsi.meet';
  69. const joinURL = `${appScheme}:${window.location.href}`;
  70. this.setState({
  71. joinURL
  72. });
  73. }
  74. /**
  75. * Implements React's {@link Component#render()}.
  76. *
  77. * @inheritdoc
  78. * @returns {ReactElement}
  79. */
  80. render() {
  81. const { t } = this.props;
  82. const openAppButtonClassName
  83. = `${_SNS}__button ${_SNS}__button_primary`;
  84. const appName
  85. = interfaceConfig.ADD_PEOPLE_APP_NAME || interfaceConfig.APP_NAME;
  86. return (
  87. <div className = { _SNS }>
  88. <div className = { `${_SNS}__body` }>
  89. <img
  90. className = { `${_SNS}__logo` }
  91. src = 'images/logo-blue.svg' />
  92. <p className = { `${_SNS}__text` }>
  93. {
  94. translateToHTML(
  95. t,
  96. `${_TNS}.appNotInstalled`,
  97. { app: appName })
  98. }
  99. </p>
  100. <a href = { this.state.joinURL }>
  101. <button className = { openAppButtonClassName }>
  102. { t(`${_TNS}.openApp`,
  103. { app: appName }) }
  104. </button>
  105. </a>
  106. <a href = { _URLS[Platform.OS] }>
  107. <button className = { `${_SNS}__button` }>
  108. { t(`${_TNS}.downloadApp`) }
  109. </button>
  110. </a>
  111. </div>
  112. <HideNotificationBarStyle />
  113. </div>
  114. );
  115. }
  116. }
  117. export default translate(UnsupportedMobileBrowser);