2022-09-01 12:05:14 +00:00
|
|
|
/* eslint-disable lines-around-comment */
|
2018-02-26 16:14:46 +00:00
|
|
|
|
2022-07-28 07:28:29 +00:00
|
|
|
import { Link } from '@react-navigation/native';
|
2022-09-01 12:05:14 +00:00
|
|
|
import _ from 'lodash';
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { WithTranslation } from 'react-i18next';
|
2021-11-11 14:32:56 +00:00
|
|
|
import {
|
|
|
|
Alert,
|
|
|
|
NativeModules,
|
2021-11-26 11:54:42 +00:00
|
|
|
Platform,
|
2022-08-29 08:18:38 +00:00
|
|
|
Text,
|
|
|
|
View
|
2021-11-11 14:32:56 +00:00
|
|
|
} from 'react-native';
|
2022-07-28 07:28:29 +00:00
|
|
|
import {
|
|
|
|
Divider,
|
2022-09-01 12:05:14 +00:00
|
|
|
TextInput
|
2022-07-28 07:28:29 +00:00
|
|
|
} from 'react-native-paper';
|
|
|
|
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
|
|
|
import { getDefaultURL } from '../../../app/functions';
|
2022-09-05 11:24:13 +00:00
|
|
|
import { IState } from '../../../app/types';
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2022-07-28 07:28:29 +00:00
|
|
|
import { Avatar } from '../../../base/avatar';
|
2022-09-01 12:05:14 +00:00
|
|
|
import { translate } from '../../../base/i18n/functions';
|
|
|
|
// @ts-ignore
|
2022-07-28 07:28:29 +00:00
|
|
|
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
|
2022-09-01 12:05:14 +00:00
|
|
|
import { getLocalParticipant } from '../../../base/participants/functions';
|
|
|
|
import { connect } from '../../../base/redux/functions';
|
2022-10-11 10:47:54 +00:00
|
|
|
import { updateSettings } from '../../../base/settings/actions';
|
2022-09-01 12:05:14 +00:00
|
|
|
import BaseThemeNative from '../../../base/ui/components/BaseTheme.native';
|
2022-08-24 09:46:22 +00:00
|
|
|
import Switch from '../../../base/ui/components/native/Switch';
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2022-07-28 07:28:29 +00:00
|
|
|
import { screen } from '../../../mobile/navigation/routes';
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2022-07-28 07:28:29 +00:00
|
|
|
import { AVATAR_SIZE } from '../../../welcome/components/styles';
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2022-09-27 07:10:28 +00:00
|
|
|
import { isServerURLChangeEnabled, normalizeUserInputURL } from '../../functions';
|
2020-04-06 15:21:50 +00:00
|
|
|
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2018-02-26 16:14:46 +00:00
|
|
|
import FormRow from './FormRow';
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2021-05-11 08:01:45 +00:00
|
|
|
import FormSectionAccordion from './FormSectionAccordion';
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2022-08-29 08:18:38 +00:00
|
|
|
import styles, { PLACEHOLDER_COLOR, PLACEHOLDER_TEXT_COLOR } from './styles';
|
2022-07-28 07:28:29 +00:00
|
|
|
|
2019-04-02 08:03:01 +00:00
|
|
|
/**
|
|
|
|
* Application information module.
|
|
|
|
*/
|
|
|
|
const { AppInfo } = NativeModules;
|
|
|
|
|
2022-07-28 07:28:29 +00:00
|
|
|
|
2022-09-01 12:05:14 +00:00
|
|
|
interface State {
|
2019-10-18 14:30:59 +00:00
|
|
|
|
2020-03-25 10:10:13 +00:00
|
|
|
/**
|
|
|
|
* State variable for the disable call integration switch.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
disableCallIntegration: boolean;
|
2020-03-25 10:10:13 +00:00
|
|
|
|
2022-09-01 12:05:14 +00:00
|
|
|
/**
|
|
|
|
* State variable for the disable crash reporting switch.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
disableCrashReporting: boolean;
|
2022-09-01 12:05:14 +00:00
|
|
|
|
2020-03-25 10:10:13 +00:00
|
|
|
/**
|
|
|
|
* State variable for the disable p2p switch.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
disableP2P: boolean;
|
2020-03-25 10:10:13 +00:00
|
|
|
|
2020-05-07 21:05:48 +00:00
|
|
|
/**
|
2022-09-01 12:05:14 +00:00
|
|
|
* Whether the self view is disabled or not.
|
2020-05-07 21:05:48 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
disableSelfView: boolean;
|
2020-05-07 21:05:48 +00:00
|
|
|
|
2020-03-25 10:10:13 +00:00
|
|
|
/**
|
|
|
|
* State variable for the display name field.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
displayName: string;
|
2020-03-25 10:10:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* State variable for the email field.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
email: string;
|
2020-03-25 10:10:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* State variable for the server URL field.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
serverURL: string;
|
2020-03-25 10:10:13 +00:00
|
|
|
|
2022-10-06 11:29:39 +00:00
|
|
|
/**
|
|
|
|
* State variable for start car mode.
|
|
|
|
*/
|
|
|
|
startCarMode: boolean;
|
|
|
|
|
2020-03-25 10:10:13 +00:00
|
|
|
/**
|
|
|
|
* State variable for the start with audio muted switch.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
startWithAudioMuted: boolean;
|
2020-03-25 10:10:13 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* State variable for the start with video muted switch.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
startWithVideoMuted: boolean;
|
2019-10-18 14:30:59 +00:00
|
|
|
}
|
|
|
|
|
2020-06-26 09:47:48 +00:00
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of
|
|
|
|
* {@link SettingsView}.
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
interface Props extends WithTranslation {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The ID of the local participant.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_localParticipantId: string;
|
2022-09-01 12:05:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The default URL for when there is no custom URL set in the settings.
|
|
|
|
*
|
|
|
|
* @protected
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_serverURL: string;
|
2020-06-26 09:47:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Flag indicating if URL can be changed by user.
|
|
|
|
*
|
|
|
|
* @protected
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_serverURLChangeEnabled: boolean;
|
2021-05-11 08:01:45 +00:00
|
|
|
|
2022-07-28 07:28:29 +00:00
|
|
|
/**
|
2022-09-01 12:05:14 +00:00
|
|
|
* The current settings object.
|
2022-07-28 07:28:29 +00:00
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
_settings: {
|
|
|
|
disableCallIntegration: boolean;
|
|
|
|
disableCrashReporting: boolean;
|
|
|
|
disableP2P: boolean;
|
|
|
|
disableSelfView: boolean;
|
|
|
|
displayName: string;
|
|
|
|
email: string;
|
|
|
|
serverURL: string;
|
2022-10-06 11:29:39 +00:00
|
|
|
startCarMode: boolean;
|
2022-09-01 12:05:14 +00:00
|
|
|
startWithAudioMuted: boolean;
|
|
|
|
startWithVideoMuted: boolean;
|
2022-09-08 09:52:36 +00:00
|
|
|
};
|
2022-07-28 07:28:29 +00:00
|
|
|
|
|
|
|
/**
|
2022-09-01 12:05:14 +00:00
|
|
|
* Whether {@link SettingsView} is visible.
|
|
|
|
*
|
|
|
|
* @protected
|
2022-07-28 07:28:29 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
_visible: boolean;
|
2022-07-28 07:28:29 +00:00
|
|
|
|
2021-11-11 14:32:56 +00:00
|
|
|
/**
|
2022-09-01 12:05:14 +00:00
|
|
|
* Redux store dispatch function.
|
2021-11-11 14:32:56 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
dispatch: Function;
|
2021-11-11 14:32:56 +00:00
|
|
|
|
2022-07-28 07:28:29 +00:00
|
|
|
/**
|
2022-09-01 12:05:14 +00:00
|
|
|
* Default prop for navigating between screen components(React Navigation).
|
2022-07-28 07:28:29 +00:00
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
navigation: Object;
|
2020-06-26 09:47:48 +00:00
|
|
|
}
|
|
|
|
|
2018-02-26 16:14:46 +00:00
|
|
|
/**
|
|
|
|
* The native container rendering the app settings page.
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
class SettingsView extends Component<Props, State> {
|
2018-02-26 16:14:46 +00:00
|
|
|
_urlField: Object;
|
|
|
|
|
|
|
|
/**
|
2022-07-28 07:28:29 +00:00
|
|
|
*
|
2018-02-26 16:14:46 +00:00
|
|
|
* Initializes a new {@code SettingsView} instance.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
constructor(props: Props) {
|
2018-02-26 16:14:46 +00:00
|
|
|
super(props);
|
2022-09-01 12:05:14 +00:00
|
|
|
|
2020-03-25 10:10:13 +00:00
|
|
|
const {
|
|
|
|
disableCallIntegration,
|
2020-05-07 21:05:48 +00:00
|
|
|
disableCrashReporting,
|
2020-03-25 10:10:13 +00:00
|
|
|
disableP2P,
|
2022-09-01 12:05:14 +00:00
|
|
|
disableSelfView,
|
2020-03-25 10:10:13 +00:00
|
|
|
displayName,
|
|
|
|
email,
|
|
|
|
serverURL,
|
2022-10-06 11:29:39 +00:00
|
|
|
startCarMode,
|
2020-03-25 10:10:13 +00:00
|
|
|
startWithAudioMuted,
|
|
|
|
startWithVideoMuted
|
|
|
|
} = props._settings || {};
|
2018-02-26 16:14:46 +00:00
|
|
|
|
2019-10-18 14:30:59 +00:00
|
|
|
this.state = {
|
2020-03-25 10:10:13 +00:00
|
|
|
disableCallIntegration,
|
2020-05-07 21:05:48 +00:00
|
|
|
disableCrashReporting,
|
2020-03-25 10:10:13 +00:00
|
|
|
disableP2P,
|
2022-09-01 12:05:14 +00:00
|
|
|
disableSelfView,
|
2020-03-25 10:10:13 +00:00
|
|
|
displayName,
|
|
|
|
email,
|
|
|
|
serverURL,
|
2022-10-06 11:29:39 +00:00
|
|
|
startCarMode,
|
2020-03-25 10:10:13 +00:00
|
|
|
startWithAudioMuted,
|
|
|
|
startWithVideoMuted
|
2019-10-18 14:30:59 +00:00
|
|
|
};
|
|
|
|
|
2018-02-26 16:14:46 +00:00
|
|
|
// Bind event handlers so they are only bound once per instance.
|
|
|
|
this._onBlurServerURL = this._onBlurServerURL.bind(this);
|
2022-09-01 12:05:14 +00:00
|
|
|
this._onChangeDisplayName = this._onChangeDisplayName.bind(this);
|
|
|
|
this._onChangeEmail = this._onChangeEmail.bind(this);
|
|
|
|
this._onChangeServerURL = this._onChangeServerURL.bind(this);
|
2020-04-06 15:21:50 +00:00
|
|
|
this._onClose = this._onClose.bind(this);
|
2019-10-18 14:30:59 +00:00
|
|
|
this._onDisableCallIntegration = this._onDisableCallIntegration.bind(this);
|
2020-05-07 21:05:48 +00:00
|
|
|
this._onDisableCrashReporting = this._onDisableCrashReporting.bind(this);
|
2019-10-18 14:30:59 +00:00
|
|
|
this._onDisableP2P = this._onDisableP2P.bind(this);
|
2022-09-01 12:05:14 +00:00
|
|
|
this._onDisableSelfView = this._onDisableSelfView.bind(this);
|
|
|
|
this._onStartAudioMutedChange
|
|
|
|
= this._onStartAudioMutedChange.bind(this);
|
2022-10-06 11:29:39 +00:00
|
|
|
this._onStartCarmodeInLowBandwidthMode
|
|
|
|
= this._onStartCarmodeInLowBandwidthMode.bind(this);
|
2022-09-01 12:05:14 +00:00
|
|
|
this._onStartVideoMutedChange
|
|
|
|
= this._onStartVideoMutedChange.bind(this);
|
2018-02-26 16:14:46 +00:00
|
|
|
this._setURLFieldReference = this._setURLFieldReference.bind(this);
|
|
|
|
this._showURLAlert = this._showURLAlert.bind(this);
|
|
|
|
}
|
|
|
|
|
2022-09-01 12:05:14 +00:00
|
|
|
/**
|
|
|
|
* Updates and syncs settings.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
componentDidUpdate(prevProps: Props) {
|
|
|
|
const { _settings } = this.props;
|
|
|
|
|
|
|
|
if (!_.isEqual(prevProps._settings, _settings)) {
|
|
|
|
// @ts-ignore
|
|
|
|
// eslint-disable-next-line react/no-did-update-set-state
|
|
|
|
this.setState(_settings);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-26 16:14:46 +00:00
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}, renders the settings page.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2021-05-11 08:01:45 +00:00
|
|
|
const {
|
|
|
|
disableCallIntegration,
|
|
|
|
disableCrashReporting,
|
|
|
|
disableP2P,
|
2022-09-01 12:05:14 +00:00
|
|
|
disableSelfView,
|
2021-05-11 08:01:45 +00:00
|
|
|
displayName,
|
|
|
|
email,
|
|
|
|
serverURL,
|
2022-10-06 11:29:39 +00:00
|
|
|
startCarMode,
|
2021-05-11 08:01:45 +00:00
|
|
|
startWithAudioMuted,
|
|
|
|
startWithVideoMuted
|
|
|
|
} = this.state;
|
2022-09-01 12:05:14 +00:00
|
|
|
|
|
|
|
const { t } = this.props;
|
2020-04-06 15:21:50 +00:00
|
|
|
|
2022-02-21 14:06:02 +00:00
|
|
|
const textInputTheme = {
|
|
|
|
colors: {
|
2022-09-01 12:05:14 +00:00
|
|
|
background: BaseThemeNative.palette.ui01,
|
|
|
|
placeholder: BaseThemeNative.palette.text01,
|
2022-08-29 08:18:38 +00:00
|
|
|
primary: PLACEHOLDER_COLOR,
|
2022-02-21 14:06:02 +00:00
|
|
|
underlineColor: 'transparent',
|
2022-09-01 12:05:14 +00:00
|
|
|
text: BaseThemeNative.palette.text01
|
2022-02-21 14:06:02 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-02-26 16:14:46 +00:00
|
|
|
return (
|
2021-11-11 14:32:56 +00:00
|
|
|
<JitsiScreen
|
2022-07-28 07:28:29 +00:00
|
|
|
safeAreaInsets = { [ 'bottom', 'left', 'right' ] }
|
2022-10-06 13:52:45 +00:00
|
|
|
scrollEnabled = { true }
|
2021-11-11 14:32:56 +00:00
|
|
|
style = { styles.settingsViewContainer }>
|
2022-10-06 13:52:45 +00:00
|
|
|
<View style = { styles.avatarContainer }>
|
|
|
|
<Avatar
|
|
|
|
participantId = { this.props._localParticipantId }
|
|
|
|
size = { AVATAR_SIZE } />
|
|
|
|
</View>
|
|
|
|
<FormSectionAccordion
|
|
|
|
label = 'settingsView.profileSection'>
|
|
|
|
<TextInput
|
|
|
|
autoCorrect = { false }
|
|
|
|
label = { t('settingsView.displayName') }
|
|
|
|
mode = 'outlined'
|
|
|
|
onChangeText = { this._onChangeDisplayName }
|
|
|
|
placeholder = { t('settingsView.displayNamePlaceholderText') }
|
|
|
|
placeholderTextColor = { PLACEHOLDER_TEXT_COLOR }
|
|
|
|
spellCheck = { false }
|
|
|
|
style = { styles.textInputContainer }
|
|
|
|
textContentType = { 'name' } // iOS only
|
|
|
|
theme = { textInputTheme }
|
|
|
|
value = { displayName } />
|
|
|
|
<Divider style = { styles.fieldSeparator } />
|
|
|
|
<TextInput
|
|
|
|
autoCapitalize = 'none'
|
|
|
|
autoCorrect = { false }
|
|
|
|
keyboardType = { 'email-address' }
|
|
|
|
label = { t('settingsView.email') }
|
|
|
|
mode = 'outlined'
|
|
|
|
onChangeText = { this._onChangeEmail }
|
|
|
|
placeholder = 'email@example.com'
|
|
|
|
placeholderTextColor = { PLACEHOLDER_TEXT_COLOR }
|
|
|
|
spellCheck = { false }
|
|
|
|
style = { styles.textInputContainer }
|
|
|
|
textContentType = { 'emailAddress' } // iOS only
|
|
|
|
theme = { textInputTheme }
|
|
|
|
value = { email } />
|
|
|
|
</FormSectionAccordion>
|
|
|
|
<FormSectionAccordion
|
|
|
|
label = 'settingsView.conferenceSection'>
|
|
|
|
<TextInput
|
|
|
|
autoCapitalize = 'none'
|
|
|
|
autoCorrect = { false }
|
|
|
|
editable = { this.props._serverURLChangeEnabled }
|
|
|
|
keyboardType = { 'url' }
|
|
|
|
label = { t('settingsView.serverURL') }
|
|
|
|
mode = 'outlined'
|
|
|
|
onBlur = { this._onBlurServerURL }
|
|
|
|
onChangeText = { this._onChangeServerURL }
|
|
|
|
placeholder = { this.props._serverURL }
|
|
|
|
placeholderTextColor = { PLACEHOLDER_TEXT_COLOR }
|
|
|
|
spellCheck = { false }
|
|
|
|
style = { styles.textInputContainer }
|
|
|
|
textContentType = { 'URL' } // iOS only
|
|
|
|
theme = { textInputTheme }
|
|
|
|
value = { serverURL } />
|
|
|
|
<Divider style = { styles.fieldSeparator } />
|
|
|
|
<FormRow label = 'settingsView.startCarModeInLowBandwidthMode'>
|
|
|
|
<Switch
|
|
|
|
checked = { startCarMode }
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2022-10-06 13:52:45 +00:00
|
|
|
onChange = { this._onStartCarmodeInLowBandwidthMode } />
|
|
|
|
</FormRow>
|
|
|
|
<Divider style = { styles.fieldSeparator } />
|
|
|
|
<FormRow
|
|
|
|
label = 'settingsView.startWithAudioMuted'>
|
|
|
|
<Switch
|
|
|
|
checked = { startWithAudioMuted }
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2022-10-06 13:52:45 +00:00
|
|
|
onChange = { this._onStartAudioMutedChange } />
|
|
|
|
</FormRow>
|
|
|
|
<Divider style = { styles.fieldSeparator } />
|
|
|
|
<FormRow label = 'settingsView.startWithVideoMuted'>
|
|
|
|
<Switch
|
|
|
|
checked = { startWithVideoMuted }
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2022-10-06 13:52:45 +00:00
|
|
|
onChange = { this._onStartVideoMutedChange } />
|
|
|
|
</FormRow>
|
|
|
|
<Divider style = { styles.fieldSeparator } />
|
|
|
|
<FormRow label = 'videothumbnail.hideSelfView'>
|
|
|
|
<Switch
|
|
|
|
checked = { disableSelfView }
|
|
|
|
// @ts-ignore
|
|
|
|
onChange = { this._onDisableSelfView } />
|
|
|
|
</FormRow>
|
|
|
|
</FormSectionAccordion>
|
|
|
|
<FormSectionAccordion
|
|
|
|
label = 'settingsView.links'>
|
|
|
|
<Link
|
|
|
|
style = { styles.sectionLink }
|
|
|
|
// @ts-ignore
|
|
|
|
to = {{ screen: screen.settings.links.help }}>
|
|
|
|
{ t('settingsView.help') }
|
|
|
|
</Link>
|
|
|
|
<Divider style = { styles.fieldSeparator } />
|
|
|
|
<Link
|
|
|
|
style = { styles.sectionLink }
|
|
|
|
// @ts-ignore
|
|
|
|
to = {{ screen: screen.settings.links.terms }}>
|
|
|
|
{ t('settingsView.terms') }
|
|
|
|
</Link>
|
|
|
|
<Divider style = { styles.fieldSeparator } />
|
|
|
|
<Link
|
|
|
|
style = { styles.sectionLink }
|
|
|
|
// @ts-ignore
|
|
|
|
to = {{ screen: screen.settings.links.privacy }}>
|
|
|
|
{ t('settingsView.privacy') }
|
|
|
|
</Link>
|
|
|
|
</FormSectionAccordion>
|
|
|
|
<FormSectionAccordion
|
|
|
|
label = 'settingsView.buildInfoSection'>
|
|
|
|
<FormRow
|
|
|
|
label = 'settingsView.version'>
|
|
|
|
<Text style = { styles.text }>
|
|
|
|
{`${AppInfo.version} build ${AppInfo.buildNumber}`}
|
|
|
|
</Text>
|
|
|
|
</FormRow>
|
|
|
|
</FormSectionAccordion>
|
|
|
|
<FormSectionAccordion
|
|
|
|
label = 'settingsView.advanced'>
|
|
|
|
{ Platform.OS === 'android' && (
|
|
|
|
<>
|
2021-05-11 08:01:45 +00:00
|
|
|
<FormRow
|
2022-10-06 13:52:45 +00:00
|
|
|
label = 'settingsView.disableCallIntegration'>
|
2021-05-11 08:01:45 +00:00
|
|
|
<Switch
|
2022-10-06 13:52:45 +00:00
|
|
|
checked = { disableCallIntegration }
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2022-10-06 13:52:45 +00:00
|
|
|
onChange = { this._onDisableCallIntegration } />
|
2021-05-11 08:01:45 +00:00
|
|
|
</FormRow>
|
2022-10-06 13:52:45 +00:00
|
|
|
<Divider style = { styles.fieldSeparator } />
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
<FormRow
|
|
|
|
label = 'settingsView.disableP2P'>
|
|
|
|
<Switch
|
|
|
|
checked = { disableP2P }
|
|
|
|
// @ts-ignore
|
|
|
|
onChange = { this._onDisableP2P } />
|
|
|
|
</FormRow>
|
|
|
|
<Divider style = { styles.fieldSeparator } />
|
|
|
|
{AppInfo.GOOGLE_SERVICES_ENABLED && (
|
|
|
|
<FormRow
|
|
|
|
fieldSeparator = { true }
|
|
|
|
label = 'settingsView.disableCrashReporting'>
|
|
|
|
<Switch
|
|
|
|
checked = { disableCrashReporting }
|
|
|
|
// @ts-ignore
|
|
|
|
onChange = { this._onDisableCrashReporting } />
|
|
|
|
</FormRow>
|
|
|
|
)}
|
|
|
|
</FormSectionAccordion>
|
2021-11-11 14:32:56 +00:00
|
|
|
</JitsiScreen>
|
2018-02-26 16:14:46 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handler the server URL lose focus event. Here we validate the server URL
|
|
|
|
* and update it to the normalized version, or show an error if incorrect.
|
|
|
|
*
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onBlurServerURL() {
|
|
|
|
this._processServerURL(false /* hideOnSuccess */);
|
|
|
|
}
|
|
|
|
|
2020-03-25 10:10:13 +00:00
|
|
|
/**
|
2022-09-01 12:05:14 +00:00
|
|
|
* Handles the display name field value change.
|
2020-03-25 10:10:13 +00:00
|
|
|
*
|
2022-09-01 12:05:14 +00:00
|
|
|
* @param {string} displayName - The value typed in the name field.
|
|
|
|
* @protected
|
2020-03-25 10:10:13 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
_onChangeDisplayName(displayName: string) {
|
2020-03-25 10:10:13 +00:00
|
|
|
this.setState({
|
|
|
|
displayName
|
|
|
|
});
|
2022-09-01 12:05:14 +00:00
|
|
|
|
|
|
|
this._updateSettings({
|
|
|
|
displayName
|
|
|
|
});
|
2020-03-25 10:10:13 +00:00
|
|
|
}
|
2018-02-26 16:14:46 +00:00
|
|
|
|
2020-03-25 10:10:13 +00:00
|
|
|
/**
|
2022-09-01 12:05:14 +00:00
|
|
|
* Handles the email field value change.
|
2020-03-25 10:10:13 +00:00
|
|
|
*
|
2022-09-01 12:05:14 +00:00
|
|
|
* @param {string} email - The value typed in the email field.
|
|
|
|
* @protected
|
2020-03-25 10:10:13 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
_onChangeEmail(email: string) {
|
2020-03-25 10:10:13 +00:00
|
|
|
this.setState({
|
|
|
|
email
|
|
|
|
});
|
2022-09-01 12:05:14 +00:00
|
|
|
|
|
|
|
this._updateSettings({
|
|
|
|
email
|
|
|
|
});
|
2020-03-25 10:10:13 +00:00
|
|
|
}
|
2018-02-26 16:14:46 +00:00
|
|
|
|
2020-03-25 10:10:13 +00:00
|
|
|
/**
|
2022-09-01 12:05:14 +00:00
|
|
|
* Handles the server name field value change.
|
2020-03-25 10:10:13 +00:00
|
|
|
*
|
2022-09-01 12:05:14 +00:00
|
|
|
* @param {string} serverURL - The server URL typed in the server field.
|
|
|
|
* @protected
|
2020-03-25 10:10:13 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
_onChangeServerURL(serverURL: string) {
|
2020-03-25 10:10:13 +00:00
|
|
|
this.setState({
|
|
|
|
serverURL
|
|
|
|
});
|
2018-02-26 16:14:46 +00:00
|
|
|
|
2022-09-01 12:05:14 +00:00
|
|
|
this._updateSettings({
|
|
|
|
serverURL
|
|
|
|
});
|
|
|
|
}
|
2019-10-18 14:30:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles the disable call integration change event.
|
|
|
|
*
|
2020-03-25 10:10:13 +00:00
|
|
|
* @param {boolean} disableCallIntegration - The new value
|
2019-10-18 14:30:59 +00:00
|
|
|
* option.
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
_onDisableCallIntegration(disableCallIntegration: boolean) {
|
|
|
|
this.setState({
|
2020-03-25 10:10:13 +00:00
|
|
|
disableCallIntegration
|
|
|
|
});
|
2022-09-01 12:05:14 +00:00
|
|
|
|
|
|
|
this._updateSettings({
|
2020-03-25 10:10:13 +00:00
|
|
|
disableCallIntegration
|
2019-10-18 14:30:59 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles the disable P2P change event.
|
|
|
|
*
|
2020-03-25 10:10:13 +00:00
|
|
|
* @param {boolean} disableP2P - The new value
|
2019-10-18 14:30:59 +00:00
|
|
|
* option.
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
_onDisableP2P(disableP2P: boolean) {
|
|
|
|
this.setState({
|
2020-03-25 10:10:13 +00:00
|
|
|
disableP2P
|
|
|
|
});
|
2022-09-01 12:05:14 +00:00
|
|
|
|
|
|
|
this._updateSettings({
|
2020-03-25 10:10:13 +00:00
|
|
|
disableP2P
|
2019-10-18 14:30:59 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-09-01 12:05:14 +00:00
|
|
|
/** .
|
|
|
|
* Handles the disable self view change event.
|
|
|
|
*
|
|
|
|
* @param {boolean} disableSelfView - The new value.
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onDisableSelfView(disableSelfView: boolean) {
|
|
|
|
this.setState({
|
|
|
|
disableSelfView
|
|
|
|
});
|
|
|
|
|
|
|
|
this._updateSettings({
|
|
|
|
disableSelfView
|
|
|
|
});
|
|
|
|
}
|
2020-05-07 21:05:48 +00:00
|
|
|
|
2022-10-06 11:29:39 +00:00
|
|
|
/** .
|
|
|
|
* Handles car mode in low bandwidth mode.
|
|
|
|
*
|
|
|
|
* @param {boolean} startCarMode - The new value.
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_onStartCarmodeInLowBandwidthMode(startCarMode: boolean) {
|
|
|
|
this.setState({
|
|
|
|
startCarMode
|
|
|
|
});
|
|
|
|
|
|
|
|
this._updateSettings({
|
|
|
|
startCarMode
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-05-07 21:05:48 +00:00
|
|
|
/**
|
|
|
|
* Handles the disable crash reporting change event.
|
|
|
|
*
|
|
|
|
* @param {boolean} disableCrashReporting - The new value
|
|
|
|
* option.
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
_onDisableCrashReporting(disableCrashReporting: boolean) {
|
2020-05-07 21:05:48 +00:00
|
|
|
if (disableCrashReporting) {
|
|
|
|
this._showCrashReportingDisableAlert();
|
|
|
|
} else {
|
|
|
|
this._disableCrashReporting(disableCrashReporting);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-26 16:14:46 +00:00
|
|
|
/**
|
2020-04-06 15:21:50 +00:00
|
|
|
* Callback to be invoked on closing the modal. Also invokes normalizeUserInputURL to validate
|
2018-02-26 16:14:46 +00:00
|
|
|
* the URL entered by the user.
|
|
|
|
*
|
2020-04-06 15:21:50 +00:00
|
|
|
* @returns {boolean} - True if the modal can be closed.
|
2018-02-26 16:14:46 +00:00
|
|
|
*/
|
2020-04-06 15:21:50 +00:00
|
|
|
_onClose() {
|
|
|
|
return this._processServerURL(true /* hideOnSuccess */);
|
2018-02-26 16:14:46 +00:00
|
|
|
}
|
|
|
|
|
2020-03-25 10:10:13 +00:00
|
|
|
/**
|
2022-09-01 12:05:14 +00:00
|
|
|
* Handles the start audio muted change event.
|
2020-03-25 10:10:13 +00:00
|
|
|
*
|
2022-09-01 12:05:14 +00:00
|
|
|
* @param {boolean} startWithAudioMuted - The new value for the start audio muted
|
|
|
|
* option.
|
|
|
|
* @protected
|
2020-03-25 10:10:13 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
_onStartAudioMutedChange(startWithAudioMuted: boolean) {
|
2020-03-25 10:10:13 +00:00
|
|
|
this.setState({
|
|
|
|
startWithAudioMuted
|
|
|
|
});
|
2022-09-01 12:05:14 +00:00
|
|
|
|
|
|
|
this._updateSettings({
|
|
|
|
startWithAudioMuted
|
|
|
|
});
|
2020-03-25 10:10:13 +00:00
|
|
|
}
|
2018-02-26 16:14:46 +00:00
|
|
|
|
2020-03-25 10:10:13 +00:00
|
|
|
/**
|
2022-09-01 12:05:14 +00:00
|
|
|
* Handles the start video muted change event.
|
2020-03-25 10:10:13 +00:00
|
|
|
*
|
2022-09-01 12:05:14 +00:00
|
|
|
* @param {boolean} startWithVideoMuted - The new value for the start video muted
|
|
|
|
* option.
|
|
|
|
* @protected
|
2020-03-25 10:10:13 +00:00
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
_onStartVideoMutedChange(startWithVideoMuted: boolean) {
|
2020-03-25 10:10:13 +00:00
|
|
|
this.setState({
|
|
|
|
startWithVideoMuted
|
|
|
|
});
|
2022-09-01 12:05:14 +00:00
|
|
|
|
|
|
|
this._updateSettings({
|
|
|
|
startWithVideoMuted
|
|
|
|
});
|
2020-03-25 10:10:13 +00:00
|
|
|
}
|
2018-02-26 16:14:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Processes the server URL. It normalizes it and an error alert is
|
|
|
|
* displayed in case it's incorrect.
|
|
|
|
*
|
|
|
|
* @param {boolean} hideOnSuccess - True if the dialog should be hidden if
|
|
|
|
* normalization / validation succeeds, false otherwise.
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_processServerURL(hideOnSuccess: boolean) {
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2018-04-12 19:58:20 +00:00
|
|
|
const { serverURL } = this.props._settings;
|
2018-02-26 16:14:46 +00:00
|
|
|
const normalizedURL = normalizeUserInputURL(serverURL);
|
|
|
|
|
|
|
|
if (normalizedURL === null) {
|
|
|
|
this._showURLAlert();
|
2020-04-06 15:21:50 +00:00
|
|
|
|
|
|
|
return false;
|
2018-02-26 16:14:46 +00:00
|
|
|
}
|
2020-04-06 15:21:50 +00:00
|
|
|
|
|
|
|
this._onChangeServerURL(normalizedURL);
|
|
|
|
|
|
|
|
return hideOnSuccess;
|
2018-02-26 16:14:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stores a reference to the URL field for later use.
|
|
|
|
*
|
|
|
|
* @param {Object} component - The field component.
|
|
|
|
* @protected
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
_setURLFieldReference(component: object) {
|
2018-02-26 16:14:46 +00:00
|
|
|
this._urlField = component;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows an alert telling the user that the URL he/she entered was invalid.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_showURLAlert() {
|
|
|
|
const { t } = this.props;
|
|
|
|
|
|
|
|
Alert.alert(
|
|
|
|
t('settingsView.alertTitle'),
|
|
|
|
t('settingsView.alertURLText'),
|
|
|
|
[
|
|
|
|
{
|
2022-09-01 12:05:14 +00:00
|
|
|
// @ts-ignore
|
2018-02-26 16:14:46 +00:00
|
|
|
onPress: () => this._urlField.focus(),
|
|
|
|
text: t('settingsView.alertOk')
|
|
|
|
}
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
2019-10-18 14:30:59 +00:00
|
|
|
|
2020-05-07 21:05:48 +00:00
|
|
|
/**
|
|
|
|
* Shows an alert warning the user about disabling crash reporting.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_showCrashReportingDisableAlert() {
|
|
|
|
const { t } = this.props;
|
|
|
|
|
|
|
|
Alert.alert(
|
|
|
|
t('settingsView.alertTitle'),
|
|
|
|
t('settingsView.disableCrashReportingWarning'),
|
|
|
|
[
|
|
|
|
{
|
|
|
|
onPress: () => this._disableCrashReporting(true),
|
|
|
|
text: t('settingsView.alertOk')
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: t('settingsView.alertCancel')
|
|
|
|
}
|
|
|
|
]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the settings and sets state for disableCrashReporting.
|
|
|
|
*
|
|
|
|
* @param {boolean} disableCrashReporting - Whether crash reporting is disabled or not.
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
2022-09-01 12:05:14 +00:00
|
|
|
_disableCrashReporting(disableCrashReporting: boolean) {
|
|
|
|
this.setState({
|
|
|
|
disableCrashReporting
|
|
|
|
});
|
|
|
|
|
|
|
|
this._updateSettings({
|
|
|
|
disableCrashReporting
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates the persisted settings on any change.
|
|
|
|
*
|
|
|
|
* @param {Object} updateObject - The partial update object for the
|
|
|
|
* settings.
|
|
|
|
* @private
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
_updateSettings(updateObject: Object) {
|
|
|
|
const { dispatch } = this.props;
|
|
|
|
|
|
|
|
dispatch(updateSettings(updateObject));
|
2020-05-07 21:05:48 +00:00
|
|
|
}
|
2018-02-26 16:14:46 +00:00
|
|
|
}
|
|
|
|
|
2019-03-05 17:41:39 +00:00
|
|
|
/**
|
|
|
|
* Maps part of the Redux state to the props of this component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
2020-04-06 15:21:50 +00:00
|
|
|
* @returns {Props}
|
2019-03-05 17:41:39 +00:00
|
|
|
*/
|
2022-09-05 11:24:13 +00:00
|
|
|
function _mapStateToProps(state: IState) {
|
2022-07-28 07:28:29 +00:00
|
|
|
const localParticipant = getLocalParticipant(state);
|
|
|
|
|
2019-03-05 17:41:39 +00:00
|
|
|
return {
|
2022-09-01 12:05:14 +00:00
|
|
|
_localParticipantId: localParticipant?.id,
|
|
|
|
_serverURL: getDefaultURL(state),
|
2022-07-28 07:28:29 +00:00
|
|
|
_serverURLChangeEnabled: isServerURLChangeEnabled(state),
|
2022-09-01 12:05:14 +00:00
|
|
|
_settings: state['features/base/settings'],
|
|
|
|
_visible: state['features/settings'].visible
|
2019-03-05 17:41:39 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-09-01 12:05:14 +00:00
|
|
|
export default translate(connect(_mapStateToProps)(SettingsView));
|