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.

SettingsView.tsx 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807
  1. /* eslint-disable lines-around-comment */
  2. import _ from 'lodash';
  3. import React, { Component } from 'react';
  4. import { WithTranslation } from 'react-i18next';
  5. import {
  6. Alert,
  7. Linking,
  8. NativeModules,
  9. Platform,
  10. ScrollView,
  11. Text,
  12. View
  13. } from 'react-native';
  14. import { Divider } from 'react-native-paper';
  15. import { getDefaultURL } from '../../../app/functions.native';
  16. import { IReduxState } from '../../../app/types';
  17. // @ts-ignore
  18. import { Avatar } from '../../../base/avatar';
  19. import { translate } from '../../../base/i18n/functions';
  20. // @ts-ignore
  21. import JitsiScreen from '../../../base/modal/components/JitsiScreen';
  22. import { getLocalParticipant } from '../../../base/participants/functions';
  23. import { connect } from '../../../base/redux/functions';
  24. import { updateSettings } from '../../../base/settings/actions';
  25. import Button from '../../../base/ui/components/native/Button';
  26. import Input from '../../../base/ui/components/native/Input';
  27. import Switch from '../../../base/ui/components/native/Switch';
  28. // @ts-ignore
  29. import { BUTTON_TYPES } from '../../../base/ui/constants.any';
  30. // @ts-ignore
  31. import { AVATAR_SIZE } from '../../../welcome/components/styles';
  32. import { isServerURLChangeEnabled, normalizeUserInputURL } from '../../functions.native';
  33. // @ts-ignore
  34. import FormRow from './FormRow';
  35. // @ts-ignore
  36. import FormSection from './FormSection';
  37. // @ts-ignore
  38. import styles from './styles';
  39. /**
  40. * Application information module.
  41. */
  42. const { AppInfo } = NativeModules;
  43. /**
  44. * The URL at which the terms (of service/use) are available to the user.
  45. */
  46. const TERMS_URL = 'https://jitsi.org/meet/terms';
  47. /**
  48. * The URL at which the privacy policy is available to the user.
  49. */
  50. const PRIVACY_URL = 'https://jitsi.org/meet/privacy';
  51. const DEFAULT_HELP_CENTRE_URL = 'https://web-cdn.jitsi.net/faq/meet-faq.html';
  52. interface IState {
  53. /**
  54. * State variable for the disable call integration switch.
  55. */
  56. disableCallIntegration: boolean;
  57. /**
  58. * State variable for the disable crash reporting switch.
  59. */
  60. disableCrashReporting: boolean;
  61. /**
  62. * State variable for the disable p2p switch.
  63. */
  64. disableP2P: boolean;
  65. /**
  66. * Whether the self view is disabled or not.
  67. */
  68. disableSelfView: boolean;
  69. /**
  70. * State variable for the display name field.
  71. */
  72. displayName: string;
  73. /**
  74. * State variable for the email field.
  75. */
  76. email: string;
  77. /**
  78. * State variable for the server URL field.
  79. */
  80. serverURL: string;
  81. /**
  82. * State variable for start car mode.
  83. */
  84. startCarMode: boolean;
  85. /**
  86. * State variable for the start with audio muted switch.
  87. */
  88. startWithAudioMuted: boolean;
  89. /**
  90. * State variable for the start with video muted switch.
  91. */
  92. startWithVideoMuted: boolean;
  93. }
  94. /**
  95. * The type of the React {@code Component} props of
  96. * {@link SettingsView}.
  97. */
  98. interface IProps extends WithTranslation {
  99. /**
  100. * The URL for when the help link.
  101. *
  102. * @protected
  103. */
  104. _helpCentreUrl: string;
  105. /**
  106. * The ID of the local participant.
  107. */
  108. _localParticipantId: string;
  109. /**
  110. * The default URL for when there is no custom URL set in the settings.
  111. *
  112. * @protected
  113. */
  114. _serverURL: string;
  115. /**
  116. * Flag indicating if URL can be changed by user.
  117. *
  118. * @protected
  119. */
  120. _serverURLChangeEnabled: boolean;
  121. /**
  122. * The current settings object.
  123. */
  124. _settings: {
  125. disableCallIntegration: boolean;
  126. disableCrashReporting: boolean;
  127. disableP2P: boolean;
  128. disableSelfView: boolean;
  129. displayName: string;
  130. email: string;
  131. serverURL: string;
  132. startCarMode: boolean;
  133. startWithAudioMuted: boolean;
  134. startWithVideoMuted: boolean;
  135. };
  136. /**
  137. * Whether {@link SettingsView} is visible.
  138. *
  139. * @protected
  140. */
  141. _visible: boolean;
  142. /**
  143. * Add bottom padding to the screen.
  144. */
  145. addBottomInset?: boolean;
  146. /**
  147. * Redux store dispatch function.
  148. */
  149. dispatch: Function;
  150. /**
  151. * Default prop for navigating between screen components(React Navigation).
  152. */
  153. navigation: Object;
  154. /**
  155. * Bounce when scrolling.
  156. */
  157. scrollBounces?: boolean;
  158. }
  159. /**
  160. * The native container rendering the app settings page.
  161. */
  162. class SettingsView extends Component<IProps, IState> {
  163. _urlField: Object;
  164. /**
  165. *
  166. * Initializes a new {@code SettingsView} instance.
  167. *
  168. * @inheritdoc
  169. */
  170. constructor(props: IProps) {
  171. super(props);
  172. const {
  173. disableCallIntegration,
  174. disableCrashReporting,
  175. disableP2P,
  176. disableSelfView,
  177. displayName,
  178. email,
  179. serverURL,
  180. startCarMode,
  181. startWithAudioMuted,
  182. startWithVideoMuted
  183. } = props._settings || {};
  184. this.state = {
  185. disableCallIntegration,
  186. disableCrashReporting,
  187. disableP2P,
  188. disableSelfView,
  189. displayName: displayName || '',
  190. email: email || '',
  191. serverURL: serverURL || '',
  192. startCarMode,
  193. startWithAudioMuted,
  194. startWithVideoMuted
  195. };
  196. // Bind event handlers so they are only bound once per instance.
  197. this._onBlurServerURL = this._onBlurServerURL.bind(this);
  198. this._onChangeDisplayName = this._onChangeDisplayName.bind(this);
  199. this._onChangeEmail = this._onChangeEmail.bind(this);
  200. this._onChangeServerURL = this._onChangeServerURL.bind(this);
  201. this._onClose = this._onClose.bind(this);
  202. this._onDisableCallIntegration = this._onDisableCallIntegration.bind(this);
  203. this._onDisableCrashReporting = this._onDisableCrashReporting.bind(this);
  204. this._onDisableP2P = this._onDisableP2P.bind(this);
  205. this._onDisableSelfView = this._onDisableSelfView.bind(this);
  206. this._onStartAudioMutedChange
  207. = this._onStartAudioMutedChange.bind(this);
  208. this._onStartCarmodeInLowBandwidthMode
  209. = this._onStartCarmodeInLowBandwidthMode.bind(this);
  210. this._onStartVideoMutedChange
  211. = this._onStartVideoMutedChange.bind(this);
  212. this._setURLFieldReference = this._setURLFieldReference.bind(this);
  213. this._onShowHelpPressed = this._onShowHelpPressed.bind(this);
  214. this._onShowPrivacyPressed = this._onShowPrivacyPressed.bind(this);
  215. this._onShowTermsPressed = this._onShowTermsPressed.bind(this);
  216. this._showURLAlert = this._showURLAlert.bind(this);
  217. }
  218. /**
  219. * Updates and syncs settings.
  220. *
  221. * @inheritdoc
  222. * @returns {void}
  223. */
  224. componentDidUpdate(prevProps: IProps) {
  225. const { _settings } = this.props;
  226. if (!_.isEqual(prevProps._settings, _settings)) {
  227. // @ts-ignore
  228. // eslint-disable-next-line react/no-did-update-set-state
  229. this.setState(_settings);
  230. }
  231. }
  232. /**
  233. * Implements React's {@link Component#render()}, renders the settings page.
  234. *
  235. * @inheritdoc
  236. * @returns {ReactElement}
  237. */
  238. render() {
  239. const {
  240. disableCallIntegration,
  241. disableCrashReporting,
  242. disableP2P,
  243. disableSelfView,
  244. displayName,
  245. email,
  246. serverURL,
  247. startCarMode,
  248. startWithAudioMuted,
  249. startWithVideoMuted
  250. } = this.state;
  251. const {
  252. addBottomInset = false,
  253. scrollBounces = false,
  254. t
  255. } = this.props;
  256. return (
  257. <JitsiScreen
  258. disableForcedKeyboardDismiss = { true }
  259. safeAreaInsets = { [ addBottomInset && 'bottom', 'left', 'right' ].filter(Boolean) }
  260. style = { styles.settingsViewContainer }>
  261. <ScrollView bounces = { scrollBounces }>
  262. <View style = { styles.avatarContainer }>
  263. <Avatar
  264. participantId = { this.props._localParticipantId }
  265. size = { AVATAR_SIZE } />
  266. </View>
  267. {/* @ts-ignore */}
  268. <FormSection
  269. label = 'settingsView.profileSection'>
  270. <Input
  271. // @ts-ignore
  272. customStyles = {{ container: styles.customContainer }}
  273. label = { t('settingsView.displayName') }
  274. onChange = { this._onChangeDisplayName }
  275. placeholder = { t('settingsView.displayNamePlaceholderText') }
  276. textContentType = { 'name' } // iOS only
  277. value = { displayName } />
  278. {/* @ts-ignore */}
  279. <Divider style = { styles.fieldSeparator } />
  280. <Input
  281. // @ts-ignore
  282. autoCapitalize = 'none'
  283. customStyles = {{ container: styles.customContainer }}
  284. keyboardType = { 'email-address' }
  285. label = { t('settingsView.email') }
  286. onChange = { this._onChangeEmail }
  287. placeholder = { t('settingsView.emailPlaceholderText') }
  288. textContentType = { 'emailAddress' } // iOS only
  289. value = { email } />
  290. </FormSection>
  291. {/* @ts-ignore */}
  292. <FormSection
  293. label = 'settingsView.conferenceSection'>
  294. <Input
  295. // @ts-ignore
  296. autoCapitalize = 'none'
  297. customStyles = {{ container: styles.customContainer }}
  298. editable = { this.props._serverURLChangeEnabled }
  299. keyboardType = { 'url' }
  300. label = { t('settingsView.serverURL') }
  301. onBlur = { this._onBlurServerURL }
  302. onChange = { this._onChangeServerURL }
  303. placeholder = { this.props._serverURL }
  304. textContentType = { 'URL' } // iOS only
  305. value = { serverURL } />
  306. {/* @ts-ignore */}
  307. <Divider style = { styles.fieldSeparator } />
  308. <FormRow label = 'settingsView.startCarModeInLowBandwidthMode'>
  309. <Switch
  310. checked = { startCarMode }
  311. // @ts-ignore
  312. onChange = { this._onStartCarmodeInLowBandwidthMode } />
  313. </FormRow>
  314. {/* @ts-ignore */}
  315. <Divider style = { styles.fieldSeparator } />
  316. <FormRow
  317. label = 'settingsView.startWithAudioMuted'>
  318. <Switch
  319. checked = { startWithAudioMuted }
  320. // @ts-ignore
  321. onChange = { this._onStartAudioMutedChange } />
  322. </FormRow>
  323. {/* @ts-ignore */}
  324. <Divider style = { styles.fieldSeparator } />
  325. <FormRow label = 'settingsView.startWithVideoMuted'>
  326. <Switch
  327. checked = { startWithVideoMuted }
  328. // @ts-ignore
  329. onChange = { this._onStartVideoMutedChange } />
  330. </FormRow>
  331. {/* @ts-ignore */}
  332. <Divider style = { styles.fieldSeparator } />
  333. <FormRow label = 'videothumbnail.hideSelfView'>
  334. <Switch
  335. checked = { disableSelfView }
  336. // @ts-ignore
  337. onChange = { this._onDisableSelfView } />
  338. </FormRow>
  339. </FormSection>
  340. {/* @ts-ignore */}
  341. <FormSection
  342. label = 'settingsView.links'>
  343. <Button
  344. accessibilityLabel = 'settingsView.help'
  345. labelKey = 'settingsView.help'
  346. onClick = { this._onShowHelpPressed }
  347. type = { BUTTON_TYPES.TERTIARY } />
  348. {/* @ts-ignore */}
  349. <Divider style = { styles.fieldSeparator } />
  350. <Button
  351. accessibilityLabel = 'settingsView.terms'
  352. labelKey = 'settingsView.terms'
  353. onClick = { this._onShowTermsPressed }
  354. type = { BUTTON_TYPES.TERTIARY } />
  355. {/* @ts-ignore */}
  356. <Divider style = { styles.fieldSeparator } />
  357. <Button
  358. accessibilityLabel = 'settingsView.privacy'
  359. labelKey = 'settingsView.privacy'
  360. onClick = { this._onShowPrivacyPressed }
  361. type = { BUTTON_TYPES.TERTIARY } />
  362. </FormSection>
  363. {/* @ts-ignore */}
  364. <FormSection
  365. label = 'settingsView.buildInfoSection'>
  366. {/* @ts-ignore */}
  367. <FormRow
  368. label = 'settingsView.version'>
  369. <Text style = { styles.text }>
  370. {`${AppInfo.version} build ${AppInfo.buildNumber}`}
  371. </Text>
  372. </FormRow>
  373. </FormSection>
  374. {/* @ts-ignore */}
  375. <FormSection
  376. label = 'settingsView.advanced'>
  377. { Platform.OS === 'android' && (
  378. <>
  379. <FormRow
  380. label = 'settingsView.disableCallIntegration'>
  381. <Switch
  382. checked = { disableCallIntegration }
  383. // @ts-ignore
  384. onChange = { this._onDisableCallIntegration } />
  385. </FormRow>
  386. {/* @ts-ignore */}
  387. <Divider style = { styles.fieldSeparator } />
  388. </>
  389. )}
  390. <FormRow
  391. label = 'settingsView.disableP2P'>
  392. <Switch
  393. checked = { disableP2P }
  394. // @ts-ignore
  395. onChange = { this._onDisableP2P } />
  396. </FormRow>
  397. {/* @ts-ignore */}
  398. <Divider style = { styles.fieldSeparator } />
  399. {AppInfo.GOOGLE_SERVICES_ENABLED && (
  400. <FormRow
  401. fieldSeparator = { true }
  402. label = 'settingsView.disableCrashReporting'>
  403. <Switch
  404. checked = { disableCrashReporting }
  405. // @ts-ignore
  406. onChange = { this._onDisableCrashReporting } />
  407. </FormRow>
  408. )}
  409. </FormSection>
  410. </ScrollView>
  411. </JitsiScreen>
  412. );
  413. }
  414. /**
  415. * Handler the server URL lose focus event. Here we validate the server URL
  416. * and update it to the normalized version, or show an error if incorrect.
  417. *
  418. * @private
  419. * @returns {void}
  420. */
  421. _onBlurServerURL() {
  422. this._processServerURL(false /* hideOnSuccess */);
  423. }
  424. /**
  425. * Handles the display name field value change.
  426. *
  427. * @param {string} displayName - The value typed in the name field.
  428. * @protected
  429. * @returns {void}
  430. */
  431. _onChangeDisplayName(displayName: string) {
  432. this.setState({
  433. displayName
  434. });
  435. this._updateSettings({
  436. displayName
  437. });
  438. }
  439. /**
  440. * Handles the email field value change.
  441. *
  442. * @param {string} email - The value typed in the email field.
  443. * @protected
  444. * @returns {void}
  445. */
  446. _onChangeEmail(email: string) {
  447. this.setState({
  448. email
  449. });
  450. this._updateSettings({
  451. email
  452. });
  453. }
  454. /**
  455. * Handles the server name field value change.
  456. *
  457. * @param {string} serverURL - The server URL typed in the server field.
  458. * @protected
  459. * @returns {void}
  460. */
  461. _onChangeServerURL(serverURL: string) {
  462. this.setState({
  463. serverURL
  464. });
  465. this._updateSettings({
  466. serverURL
  467. });
  468. }
  469. /**
  470. * Handles the disable call integration change event.
  471. *
  472. * @param {boolean} disableCallIntegration - The new value
  473. * option.
  474. * @private
  475. * @returns {void}
  476. */
  477. _onDisableCallIntegration(disableCallIntegration: boolean) {
  478. this.setState({
  479. disableCallIntegration
  480. });
  481. this._updateSettings({
  482. disableCallIntegration
  483. });
  484. }
  485. /**
  486. * Handles the disable P2P change event.
  487. *
  488. * @param {boolean} disableP2P - The new value
  489. * option.
  490. * @private
  491. * @returns {void}
  492. */
  493. _onDisableP2P(disableP2P: boolean) {
  494. this.setState({
  495. disableP2P
  496. });
  497. this._updateSettings({
  498. disableP2P
  499. });
  500. }
  501. /** .
  502. * Handles the disable self view change event.
  503. *
  504. * @param {boolean} disableSelfView - The new value.
  505. * @private
  506. * @returns {void}
  507. */
  508. _onDisableSelfView(disableSelfView: boolean) {
  509. this.setState({
  510. disableSelfView
  511. });
  512. this._updateSettings({
  513. disableSelfView
  514. });
  515. }
  516. /** .
  517. * Handles car mode in low bandwidth mode.
  518. *
  519. * @param {boolean} startCarMode - The new value.
  520. * @private
  521. * @returns {void}
  522. */
  523. _onStartCarmodeInLowBandwidthMode(startCarMode: boolean) {
  524. this.setState({
  525. startCarMode
  526. });
  527. this._updateSettings({
  528. startCarMode
  529. });
  530. }
  531. /**
  532. * Handles the disable crash reporting change event.
  533. *
  534. * @param {boolean} disableCrashReporting - The new value
  535. * option.
  536. * @private
  537. * @returns {void}
  538. */
  539. _onDisableCrashReporting(disableCrashReporting: boolean) {
  540. if (disableCrashReporting) {
  541. this._showCrashReportingDisableAlert();
  542. } else {
  543. this._disableCrashReporting(disableCrashReporting);
  544. }
  545. }
  546. /**
  547. * Callback to be invoked on closing the modal. Also invokes normalizeUserInputURL to validate
  548. * the URL entered by the user.
  549. *
  550. * @returns {boolean} - True if the modal can be closed.
  551. */
  552. _onClose() {
  553. return this._processServerURL(true /* hideOnSuccess */);
  554. }
  555. /**
  556. * Handles the start audio muted change event.
  557. *
  558. * @param {boolean} startWithAudioMuted - The new value for the start audio muted
  559. * option.
  560. * @protected
  561. * @returns {void}
  562. */
  563. _onStartAudioMutedChange(startWithAudioMuted: boolean) {
  564. this.setState({
  565. startWithAudioMuted
  566. });
  567. this._updateSettings({
  568. startWithAudioMuted
  569. });
  570. }
  571. /**
  572. * Handles the start video muted change event.
  573. *
  574. * @param {boolean} startWithVideoMuted - The new value for the start video muted
  575. * option.
  576. * @protected
  577. * @returns {void}
  578. */
  579. _onStartVideoMutedChange(startWithVideoMuted: boolean) {
  580. this.setState({
  581. startWithVideoMuted
  582. });
  583. this._updateSettings({
  584. startWithVideoMuted
  585. });
  586. }
  587. /**
  588. * Processes the server URL. It normalizes it and an error alert is
  589. * displayed in case it's incorrect.
  590. *
  591. * @param {boolean} hideOnSuccess - True if the dialog should be hidden if
  592. * normalization / validation succeeds, false otherwise.
  593. * @private
  594. * @returns {void}
  595. */
  596. _processServerURL(hideOnSuccess: boolean) {
  597. // @ts-ignore
  598. const { serverURL } = this.props._settings;
  599. const normalizedURL = normalizeUserInputURL(serverURL);
  600. if (normalizedURL === null) {
  601. this._showURLAlert();
  602. return false;
  603. }
  604. this._onChangeServerURL(normalizedURL);
  605. return hideOnSuccess;
  606. }
  607. /**
  608. * Stores a reference to the URL field for later use.
  609. *
  610. * @param {Object} component - The field component.
  611. * @protected
  612. * @returns {void}
  613. */
  614. _setURLFieldReference(component: object) {
  615. this._urlField = component;
  616. }
  617. /**
  618. * Shows an alert telling the user that the URL he/she entered was invalid.
  619. *
  620. * @returns {void}
  621. */
  622. _showURLAlert() {
  623. const { t } = this.props;
  624. Alert.alert(
  625. t('settingsView.alertTitle'),
  626. t('settingsView.alertURLText'),
  627. [
  628. {
  629. // @ts-ignore
  630. onPress: () => this._urlField.focus(),
  631. text: t('settingsView.alertOk')
  632. }
  633. ]
  634. );
  635. }
  636. /**
  637. * Opens the help url into the browser.
  638. *
  639. * @returns {void}
  640. */
  641. _onShowHelpPressed() {
  642. Linking.openURL(this.props._helpCentreUrl);
  643. }
  644. /**
  645. * Opens the privacy url into the browser.
  646. *
  647. * @returns {void}
  648. */
  649. _onShowPrivacyPressed() {
  650. Linking.openURL(PRIVACY_URL);
  651. }
  652. /**
  653. * Opens the terms url into the browser.
  654. *
  655. * @returns {void}
  656. */
  657. _onShowTermsPressed() {
  658. Linking.openURL(TERMS_URL);
  659. }
  660. /**
  661. * Shows an alert warning the user about disabling crash reporting.
  662. *
  663. * @returns {void}
  664. */
  665. _showCrashReportingDisableAlert() {
  666. const { t } = this.props;
  667. Alert.alert(
  668. t('settingsView.alertTitle'),
  669. t('settingsView.disableCrashReportingWarning'),
  670. [
  671. {
  672. onPress: () => this._disableCrashReporting(true),
  673. text: t('settingsView.alertOk')
  674. },
  675. {
  676. text: t('settingsView.alertCancel')
  677. }
  678. ]
  679. );
  680. }
  681. /**
  682. * Updates the settings and sets state for disableCrashReporting.
  683. *
  684. * @param {boolean} disableCrashReporting - Whether crash reporting is disabled or not.
  685. * @returns {void}
  686. */
  687. _disableCrashReporting(disableCrashReporting: boolean) {
  688. this.setState({
  689. disableCrashReporting
  690. });
  691. this._updateSettings({
  692. disableCrashReporting
  693. });
  694. }
  695. /**
  696. * Updates the persisted settings on any change.
  697. *
  698. * @param {Object} updateObject - The partial update object for the
  699. * settings.
  700. * @private
  701. * @returns {void}
  702. */
  703. _updateSettings(updateObject: Object) {
  704. const { dispatch } = this.props;
  705. dispatch(updateSettings(updateObject));
  706. }
  707. }
  708. /**
  709. * Maps part of the Redux state to the props of this component.
  710. *
  711. * @param {Object} state - The Redux state.
  712. * @returns {IProps}
  713. */
  714. function _mapStateToProps(state: IReduxState) {
  715. const localParticipant = getLocalParticipant(state);
  716. return {
  717. _helpCentreUrl: state['features/base/config'].helpCentreURL || DEFAULT_HELP_CENTRE_URL,
  718. _localParticipantId: localParticipant?.id,
  719. _serverURL: getDefaultURL(state),
  720. _serverURLChangeEnabled: isServerURLChangeEnabled(state),
  721. _settings: state['features/base/settings'],
  722. _visible: state['features/settings'].visible
  723. };
  724. }
  725. export default translate(connect(_mapStateToProps)(SettingsView));