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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 { createLocalTracksA } 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. const { dispatch, _localVideoTrack } = this.props;
  43. (typeof _localVideoTrack === 'undefined')
  44. && dispatch(createLocalTracksA({ devices: [ MEDIA_TYPE.VIDEO ] }));
  45. }
  46. /**
  47. * Renders a prompt for entering a room name.
  48. *
  49. * @returns {ReactElement}
  50. */
  51. render() {
  52. return (
  53. <View style = { styles.container }>
  54. {
  55. this._renderLocalVideo()
  56. }
  57. {
  58. this._renderLocalVideoOverlay()
  59. }
  60. </View>
  61. );
  62. }
  63. /**
  64. * Renders legal-related content such as Terms of service/use, Privacy
  65. * policy, etc.
  66. *
  67. * @private
  68. * @returns {ReactElement}
  69. */
  70. _renderLegalese() {
  71. const { t } = this.props;
  72. return (
  73. <View style = { styles.legaleseContainer }>
  74. <Link
  75. style = { styles.legaleseItem }
  76. url = { TERMS_URL }>
  77. { t('welcomepage.terms') }
  78. </Link>
  79. <Link
  80. style = { styles.legaleseItem }
  81. url = { PRIVACY_URL }>
  82. { t('welcomepage.privacy') }
  83. </Link>
  84. <Link
  85. style = { styles.legaleseItem }
  86. url = { SEND_FEEDBACK_URL }>
  87. { t('welcomepage.sendFeedback') }
  88. </Link>
  89. </View>
  90. );
  91. }
  92. /**
  93. * Renders a View over the local video. The latter is thought of as the
  94. * background (content) of this WelcomePage. The former is thought of as the
  95. * foreground (content) of this WelcomePage such as the room name input, the
  96. * button to initiate joining the specified room, etc.
  97. *
  98. * @private
  99. * @returns {ReactElement}
  100. */
  101. _renderLocalVideoOverlay() {
  102. const { t } = this.props;
  103. return (
  104. <View style = { styles.localVideoOverlay }>
  105. <View style = { styles.roomContainer }>
  106. <Text style = { styles.title }>
  107. { t('welcomepage.roomname') }
  108. </Text>
  109. <TextInput
  110. accessibilityLabel = { 'Input room name.' }
  111. autoCapitalize = 'none'
  112. autoComplete = { false }
  113. autoCorrect = { false }
  114. autoFocus = { false }
  115. onChangeText = { this._onRoomChange }
  116. placeholder = { t('welcomepage.roomnamePlaceHolder') }
  117. style = { styles.textInput }
  118. underlineColorAndroid = 'transparent'
  119. value = { this.state.room } />
  120. <TouchableHighlight
  121. accessibilityLabel = { 'Tap to Join.' }
  122. disabled = { this._isJoinDisabled() }
  123. onPress = { this._onJoin }
  124. style = { styles.button }
  125. underlayColor = { ColorPalette.white }>
  126. <Text style = { styles.buttonText }>
  127. { t('welcomepage.join') }
  128. </Text>
  129. </TouchableHighlight>
  130. </View>
  131. {
  132. this._renderLegalese()
  133. }
  134. </View>
  135. );
  136. }
  137. }
  138. export default translate(connect(_mapStateToProps)(WelcomePage));