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

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