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. import Avatar from '../../../base/avatar/components/Avatar';
  19. import { getLegalUrls } from '../../../base/config/functions.native';
  20. import { translate } from '../../../base/i18n/functions';
  21. // @ts-ignore
  22. import JitsiScreen from '../../../base/modal/components/JitsiScreen';
  23. import { getLocalParticipant } from '../../../base/participants/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. interface IState {
  44. /**
  45. * State variable for the disable call integration switch.
  46. */
  47. disableCallIntegration?: boolean;
  48. /**
  49. * State variable for the disable crash reporting switch.
  50. */
  51. disableCrashReporting?: boolean;
  52. /**
  53. * State variable for the disable p2p switch.
  54. */
  55. disableP2P?: boolean;
  56. /**
  57. * Whether the self view is disabled or not.
  58. */
  59. disableSelfView?: boolean;
  60. /**
  61. * State variable for the display name field.
  62. */
  63. displayName?: string;
  64. /**
  65. * State variable for the email field.
  66. */
  67. email?: string;
  68. /**
  69. * State variable for the server URL field.
  70. */
  71. serverURL?: string;
  72. /**
  73. * State variable for start car mode.
  74. */
  75. startCarMode?: boolean;
  76. /**
  77. * State variable for the start with audio muted switch.
  78. */
  79. startWithAudioMuted?: boolean;
  80. /**
  81. * State variable for the start with video muted switch.
  82. */
  83. startWithVideoMuted?: boolean;
  84. }
  85. /**
  86. * The type of the React {@code Component} props of
  87. * {@link SettingsView}.
  88. */
  89. interface IProps extends WithTranslation {
  90. /**
  91. * The legal URL's.
  92. */
  93. _legalUrls: {
  94. helpCentre: string;
  95. privacy: string;
  96. terms: string;
  97. };
  98. /**
  99. * The ID of the local participant.
  100. */
  101. _localParticipantId?: string;
  102. /**
  103. * The default URL for when there is no custom URL set in the settings.
  104. *
  105. * @protected
  106. */
  107. _serverURL: string;
  108. /**
  109. * Flag indicating if URL can be changed by user.
  110. *
  111. * @protected
  112. */
  113. _serverURLChangeEnabled: boolean;
  114. /**
  115. * The current settings object.
  116. */
  117. _settings: {
  118. disableCallIntegration?: boolean;
  119. disableCrashReporting?: boolean;
  120. disableP2P?: boolean;
  121. disableSelfView?: boolean;
  122. displayName?: string;
  123. email?: string;
  124. serverURL?: string;
  125. startCarMode?: boolean;
  126. startWithAudioMuted?: boolean;
  127. startWithVideoMuted?: boolean;
  128. };
  129. /**
  130. * Whether {@link SettingsView} is visible.
  131. *
  132. * @protected
  133. */
  134. _visible?: boolean;
  135. /**
  136. * Add bottom padding to the screen.
  137. */
  138. addBottomInset?: boolean;
  139. /**
  140. * Redux store dispatch function.
  141. */
  142. dispatch: Function;
  143. /**
  144. * Default prop for navigating between screen components(React Navigation).
  145. */
  146. navigation?: Object;
  147. /**
  148. * Bounce when scrolling.
  149. */
  150. scrollBounces?: boolean;
  151. }
  152. /**
  153. * The native container rendering the app settings page.
  154. */
  155. class SettingsView extends Component<IProps, IState> {
  156. _urlField: Object;
  157. /**
  158. *
  159. * Initializes a new {@code SettingsView} instance.
  160. *
  161. * @inheritdoc
  162. */
  163. constructor(props: IProps) {
  164. super(props);
  165. const {
  166. disableCallIntegration,
  167. disableCrashReporting,
  168. disableP2P,
  169. disableSelfView,
  170. displayName,
  171. email,
  172. serverURL,
  173. startCarMode,
  174. startWithAudioMuted,
  175. startWithVideoMuted
  176. } = props._settings || {};
  177. this.state = {
  178. disableCallIntegration,
  179. disableCrashReporting,
  180. disableP2P,
  181. disableSelfView,
  182. displayName: displayName || '',
  183. email: email || '',
  184. serverURL: serverURL || '',
  185. startCarMode,
  186. startWithAudioMuted,
  187. startWithVideoMuted
  188. };
  189. // Bind event handlers so they are only bound once per instance.
  190. this._onBlurServerURL = this._onBlurServerURL.bind(this);
  191. this._onChangeDisplayName = this._onChangeDisplayName.bind(this);
  192. this._onChangeEmail = this._onChangeEmail.bind(this);
  193. this._onChangeServerURL = this._onChangeServerURL.bind(this);
  194. this._onClose = this._onClose.bind(this);
  195. this._onDisableCallIntegration = this._onDisableCallIntegration.bind(this);
  196. this._onDisableCrashReporting = this._onDisableCrashReporting.bind(this);
  197. this._onDisableP2P = this._onDisableP2P.bind(this);
  198. this._onDisableSelfView = this._onDisableSelfView.bind(this);
  199. this._onStartAudioMutedChange
  200. = this._onStartAudioMutedChange.bind(this);
  201. this._onStartCarmodeInLowBandwidthMode
  202. = this._onStartCarmodeInLowBandwidthMode.bind(this);
  203. this._onStartVideoMutedChange
  204. = this._onStartVideoMutedChange.bind(this);
  205. this._setURLFieldReference = this._setURLFieldReference.bind(this);
  206. this._onShowHelpPressed = this._onShowHelpPressed.bind(this);
  207. this._onShowPrivacyPressed = this._onShowPrivacyPressed.bind(this);
  208. this._onShowTermsPressed = this._onShowTermsPressed.bind(this);
  209. this._showURLAlert = this._showURLAlert.bind(this);
  210. }
  211. /**
  212. * Updates and syncs settings.
  213. *
  214. * @inheritdoc
  215. * @returns {void}
  216. */
  217. componentDidUpdate(prevProps: IProps) {
  218. const { _settings } = this.props;
  219. if (!_.isEqual(prevProps._settings, _settings)) {
  220. // @ts-ignore
  221. // eslint-disable-next-line react/no-did-update-set-state
  222. this.setState(_settings);
  223. }
  224. }
  225. /**
  226. * Implements React's {@link Component#render()}, renders the settings page.
  227. *
  228. * @inheritdoc
  229. * @returns {ReactElement}
  230. */
  231. render() {
  232. const {
  233. disableCallIntegration,
  234. disableCrashReporting,
  235. disableP2P,
  236. disableSelfView,
  237. displayName,
  238. email,
  239. serverURL,
  240. startCarMode,
  241. startWithAudioMuted,
  242. startWithVideoMuted
  243. } = this.state;
  244. const {
  245. addBottomInset = false,
  246. scrollBounces = false,
  247. t
  248. } = this.props;
  249. return (
  250. <JitsiScreen
  251. disableForcedKeyboardDismiss = { true }
  252. // @ts-ignore
  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));