2016-10-05 14:36:59 +00:00
|
|
|
import React from 'react';
|
2017-06-05 18:00:02 +00:00
|
|
|
import { TextInput, TouchableHighlight, View } from 'react-native';
|
2016-10-05 14:36:59 +00:00
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
2017-12-14 17:02:32 +00:00
|
|
|
import { AppSettings } from '../../app-settings';
|
|
|
|
import { Icon } from '../../base/font-icons';
|
2017-03-01 02:55:12 +00:00
|
|
|
import { translate } from '../../base/i18n';
|
2017-08-17 13:50:49 +00:00
|
|
|
import { MEDIA_TYPE } from '../../base/media';
|
2017-09-14 09:46:35 +00:00
|
|
|
import { Link, LoadingIndicator, Text } from '../../base/react';
|
2016-11-29 20:04:56 +00:00
|
|
|
import { ColorPalette } from '../../base/styles';
|
2017-09-05 21:27:12 +00:00
|
|
|
import { createDesiredLocalTracks } from '../../base/tracks';
|
2017-12-13 10:35:42 +00:00
|
|
|
import { RecentList } from '../../recent-list';
|
2016-10-05 14:36:59 +00:00
|
|
|
|
2017-12-20 00:49:36 +00:00
|
|
|
import { AbstractWelcomePage, _mapStateToProps } from './AbstractWelcomePage';
|
|
|
|
import LocalVideoTrackUnderlay from './LocalVideoTrackUnderlay';
|
|
|
|
import styles, { PLACEHOLDER_TEXT_COLOR } from './styles';
|
|
|
|
|
2016-11-29 20:04:56 +00:00
|
|
|
/**
|
2016-12-11 23:41:14 +00:00
|
|
|
* The URL at which the privacy policy is available to the user.
|
2016-11-29 20:04:56 +00:00
|
|
|
*/
|
2016-12-11 23:41:14 +00:00
|
|
|
const PRIVACY_URL = 'https://jitsi.org/meet/privacy';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The URL at which the user may send feedback.
|
|
|
|
*/
|
|
|
|
const SEND_FEEDBACK_URL = 'mailto:support@jitsi.org';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The URL at which the terms (of service/use) are available to the user.
|
|
|
|
*/
|
|
|
|
const TERMS_URL = 'https://jitsi.org/meet/terms';
|
2016-11-29 20:04:56 +00:00
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
/**
|
|
|
|
* The native container rendering the welcome page.
|
|
|
|
*
|
|
|
|
* @extends AbstractWelcomePage
|
|
|
|
*/
|
|
|
|
class WelcomePage extends AbstractWelcomePage {
|
2016-12-01 01:52:39 +00:00
|
|
|
/**
|
|
|
|
* WelcomePage component's property types.
|
|
|
|
*
|
|
|
|
* @static
|
|
|
|
*/
|
2017-08-17 13:50:49 +00:00
|
|
|
static propTypes = AbstractWelcomePage.propTypes;
|
|
|
|
|
|
|
|
/**
|
2017-09-14 09:46:35 +00:00
|
|
|
* Implements React's {@link Component#componentWillMount()}. Invoked
|
|
|
|
* immediately before mounting occurs. Creates a local video track if none
|
|
|
|
* is available.
|
2017-08-17 13:50:49 +00:00
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
componentWillMount() {
|
2017-09-14 09:46:35 +00:00
|
|
|
super.componentWillMount();
|
|
|
|
|
2017-09-05 21:27:12 +00:00
|
|
|
this.props.dispatch(createDesiredLocalTracks(MEDIA_TYPE.VIDEO));
|
2017-08-17 13:50:49 +00:00
|
|
|
}
|
2016-12-01 01:52:39 +00:00
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
/**
|
2017-09-14 09:46:35 +00:00
|
|
|
* Implements React's {@link Component#render()}. Renders a prompt for
|
|
|
|
* entering a room name.
|
2016-10-05 14:36:59 +00:00
|
|
|
*
|
2017-09-14 09:46:35 +00:00
|
|
|
* @inheritdoc
|
2016-10-05 14:36:59 +00:00
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2017-09-05 22:45:20 +00:00
|
|
|
const { t } = this.props;
|
|
|
|
|
2016-10-05 14:36:59 +00:00
|
|
|
return (
|
2017-09-05 22:45:20 +00:00
|
|
|
<LocalVideoTrackUnderlay style = { styles.welcomePage }>
|
|
|
|
<View style = { styles.roomContainer }>
|
|
|
|
<TextInput
|
|
|
|
accessibilityLabel = { 'Input room name.' }
|
|
|
|
autoCapitalize = 'none'
|
|
|
|
autoComplete = { false }
|
|
|
|
autoCorrect = { false }
|
|
|
|
autoFocus = { false }
|
|
|
|
onChangeText = { this._onRoomChange }
|
2018-01-15 10:56:03 +00:00
|
|
|
onSubmitEditing = { this._onJoin }
|
2017-12-13 10:35:42 +00:00
|
|
|
placeholder = { t('welcomepage.roomname') }
|
|
|
|
placeholderTextColor = { PLACEHOLDER_TEXT_COLOR }
|
2018-01-15 10:56:03 +00:00
|
|
|
returnKeyType = { 'go' }
|
2017-09-05 22:45:20 +00:00
|
|
|
style = { styles.textInput }
|
|
|
|
underlineColorAndroid = 'transparent'
|
|
|
|
value = { this.state.room } />
|
2017-12-14 17:02:32 +00:00
|
|
|
<View style = { styles.buttonRow }>
|
|
|
|
<TouchableHighlight
|
|
|
|
accessibilityLabel = { 'Tap for Settings.' }
|
|
|
|
onPress = { this._onSettingsOpen }
|
|
|
|
style = { [ styles.button, styles.settingsButton ] }
|
|
|
|
underlayColor = { ColorPalette.white }>
|
|
|
|
<Icon
|
|
|
|
name = 'settings'
|
|
|
|
style = { styles.settingsIcon } />
|
|
|
|
</TouchableHighlight>
|
|
|
|
{
|
|
|
|
this._renderJoinButton()
|
|
|
|
}
|
|
|
|
</View>
|
2017-12-13 10:35:42 +00:00
|
|
|
<RecentList />
|
2017-09-05 22:45:20 +00:00
|
|
|
</View>
|
2017-12-14 17:02:32 +00:00
|
|
|
<AppSettings />
|
2016-11-29 20:04:56 +00:00
|
|
|
{
|
2017-09-05 22:45:20 +00:00
|
|
|
this._renderLegalese()
|
2016-11-29 20:04:56 +00:00
|
|
|
}
|
2017-09-05 22:45:20 +00:00
|
|
|
</LocalVideoTrackUnderlay>
|
2016-11-29 20:04:56 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-09-14 09:46:35 +00:00
|
|
|
/**
|
|
|
|
* Renders the join button.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
_renderJoinButton() {
|
|
|
|
let children;
|
|
|
|
|
|
|
|
/* eslint-disable no-extra-parens */
|
|
|
|
|
|
|
|
if (this.state.joining) {
|
|
|
|
// TouchableHighlight is picky about what its children can be, so
|
|
|
|
// wrap it in a native component, i.e. View to avoid having to
|
|
|
|
// modify non-native children.
|
|
|
|
children = (
|
|
|
|
<View>
|
2017-09-22 20:07:06 +00:00
|
|
|
<LoadingIndicator color = { styles.buttonText.color } />
|
2017-09-14 09:46:35 +00:00
|
|
|
</View>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
children = (
|
|
|
|
<Text style = { styles.buttonText }>
|
|
|
|
{ this.props.t('welcomepage.join') }
|
|
|
|
</Text>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* eslint-enable no-extra-parens */
|
|
|
|
|
|
|
|
return (
|
|
|
|
<TouchableHighlight
|
|
|
|
accessibilityLabel = { 'Tap to Join.' }
|
|
|
|
disabled = { this._isJoinDisabled() }
|
|
|
|
onPress = { this._onJoin }
|
2017-12-14 17:02:32 +00:00
|
|
|
style = { [ styles.button, styles.joinButton ] }
|
2017-09-14 09:46:35 +00:00
|
|
|
underlayColor = { ColorPalette.white }>
|
|
|
|
{
|
|
|
|
children
|
|
|
|
}
|
|
|
|
</TouchableHighlight>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-12-11 23:41:14 +00:00
|
|
|
/**
|
|
|
|
* Renders legal-related content such as Terms of service/use, Privacy
|
|
|
|
* policy, etc.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
_renderLegalese() {
|
2017-02-23 16:56:25 +00:00
|
|
|
const { t } = this.props;
|
|
|
|
|
2016-12-11 23:41:14 +00:00
|
|
|
return (
|
|
|
|
<View style = { styles.legaleseContainer }>
|
|
|
|
<Link
|
|
|
|
style = { styles.legaleseItem }
|
|
|
|
url = { TERMS_URL }>
|
2017-02-23 16:56:25 +00:00
|
|
|
{ t('welcomepage.terms') }
|
2016-12-11 23:41:14 +00:00
|
|
|
</Link>
|
|
|
|
<Link
|
|
|
|
style = { styles.legaleseItem }
|
|
|
|
url = { PRIVACY_URL }>
|
2017-02-23 16:56:25 +00:00
|
|
|
{ t('welcomepage.privacy') }
|
2016-12-11 23:41:14 +00:00
|
|
|
</Link>
|
|
|
|
<Link
|
|
|
|
style = { styles.legaleseItem }
|
|
|
|
url = { SEND_FEEDBACK_URL }>
|
2017-02-23 16:56:25 +00:00
|
|
|
{ t('welcomepage.sendFeedback') }
|
2016-12-11 23:41:14 +00:00
|
|
|
</Link>
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
2016-10-05 14:36:59 +00:00
|
|
|
}
|
|
|
|
|
2017-02-23 16:56:25 +00:00
|
|
|
export default translate(connect(_mapStateToProps)(WelcomePage));
|