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.

WelcomePage.native.js 4.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. import React from 'react';
  2. import { TextInput, TouchableHighlight, View } from 'react-native';
  3. import { connect } from 'react-redux';
  4. import { translate } from '../../base/i18n';
  5. import { MEDIA_TYPE } from '../../base/media';
  6. import { Link, Text } from '../../base/react';
  7. import { ColorPalette } from '../../base/styles';
  8. import { createDesiredLocalTracks } from '../../base/tracks';
  9. import { AbstractWelcomePage, _mapStateToProps } from './AbstractWelcomePage';
  10. import styles from './styles';
  11. /**
  12. * The URL at which the privacy policy is available to the user.
  13. */
  14. const PRIVACY_URL = 'https://jitsi.org/meet/privacy';
  15. /**
  16. * The URL at which the user may send feedback.
  17. */
  18. const SEND_FEEDBACK_URL = 'mailto:support@jitsi.org';
  19. /**
  20. * The URL at which the terms (of service/use) are available to the user.
  21. */
  22. const TERMS_URL = 'https://jitsi.org/meet/terms';
  23. /**
  24. * The native container rendering the welcome page.
  25. *
  26. * @extends AbstractWelcomePage
  27. */
  28. class WelcomePage extends AbstractWelcomePage {
  29. /**
  30. * WelcomePage component's property types.
  31. *
  32. * @static
  33. */
  34. static propTypes = AbstractWelcomePage.propTypes;
  35. /**
  36. * Creates a video track if not already available.
  37. *
  38. * @inheritdoc
  39. * @returns {void}
  40. */
  41. componentWillMount() {
  42. this.props.dispatch(createDesiredLocalTracks(MEDIA_TYPE.VIDEO));
  43. }
  44. /**
  45. * Renders a prompt for entering a room name.
  46. *
  47. * @returns {ReactElement}
  48. */
  49. render() {
  50. return (
  51. <View style = { styles.container }>
  52. {
  53. this._renderLocalVideo()
  54. }
  55. {
  56. this._renderLocalVideoOverlay()
  57. }
  58. </View>
  59. );
  60. }
  61. /**
  62. * Renders legal-related content such as Terms of service/use, Privacy
  63. * policy, etc.
  64. *
  65. * @private
  66. * @returns {ReactElement}
  67. */
  68. _renderLegalese() {
  69. const { t } = this.props;
  70. return (
  71. <View style = { styles.legaleseContainer }>
  72. <Link
  73. style = { styles.legaleseItem }
  74. url = { TERMS_URL }>
  75. { t('welcomepage.terms') }
  76. </Link>
  77. <Link
  78. style = { styles.legaleseItem }
  79. url = { PRIVACY_URL }>
  80. { t('welcomepage.privacy') }
  81. </Link>
  82. <Link
  83. style = { styles.legaleseItem }
  84. url = { SEND_FEEDBACK_URL }>
  85. { t('welcomepage.sendFeedback') }
  86. </Link>
  87. </View>
  88. );
  89. }
  90. /**
  91. * Renders a View over the local video. The latter is thought of as the
  92. * background (content) of this WelcomePage. The former is thought of as the
  93. * foreground (content) of this WelcomePage such as the room name input, the
  94. * button to initiate joining the specified room, etc.
  95. *
  96. * @private
  97. * @returns {ReactElement}
  98. */
  99. _renderLocalVideoOverlay() {
  100. const { t } = this.props;
  101. return (
  102. <View style = { styles.localVideoOverlay }>
  103. <View style = { styles.roomContainer }>
  104. <Text style = { styles.title }>
  105. { t('welcomepage.roomname') }
  106. </Text>
  107. <TextInput
  108. accessibilityLabel = { 'Input room name.' }
  109. autoCapitalize = 'none'
  110. autoComplete = { false }
  111. autoCorrect = { false }
  112. autoFocus = { false }
  113. onChangeText = { this._onRoomChange }
  114. placeholder = { t('welcomepage.roomnamePlaceHolder') }
  115. style = { styles.textInput }
  116. underlineColorAndroid = 'transparent'
  117. value = { this.state.room } />
  118. <TouchableHighlight
  119. accessibilityLabel = { 'Tap to Join.' }
  120. disabled = { this._isJoinDisabled() }
  121. onPress = { this._onJoin }
  122. style = { styles.button }
  123. underlayColor = { ColorPalette.white }>
  124. <Text style = { styles.buttonText }>
  125. { t('welcomepage.join') }
  126. </Text>
  127. </TouchableHighlight>
  128. </View>
  129. {
  130. this._renderLegalese()
  131. }
  132. </View>
  133. );
  134. }
  135. }
  136. export default translate(connect(_mapStateToProps)(WelcomePage));