Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(rn) removes settings dialog webviews and opens urls in browser

tmoldovan8x89fae488070c0
diff --git a/lang/main.json b/lang/main.json
index 7de21bb41f..ae4792809f 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -442,9 +442,6 @@
"noResults": "No results found :(",
"search": "Search GIPHY"
},
- "helpView": {
- "title": "Help center"
- },
"incomingCall": {
"answer": "Answer",
"audioCallTitle": "Incoming call",
@@ -864,9 +861,6 @@
"rejected": "Rejected",
"ringing": "Ringing..."
},
- "privacyView": {
- "title": "Privacy"
- },
"profile": {
"avatar": "avatar",
"setDisplayNameLabel": "Set your display name",
diff --git a/react/features/base/modal/components/JitsiScreenWebView.js b/react/features/base/modal/components/JitsiScreenWebView.js
deleted file mode 100644
index cb6241c156..0000000000
--- a/react/features/base/modal/components/JitsiScreenWebView.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// @flow
-
-import React from 'react';
-import WebView from 'react-native-webview';
-
-import JitsiScreen from './JitsiScreen';
-
-type Props = {
-
- /**
- * The URL to display.
- */
- source: string,
-
- /**
- * The component's external style.
- */
- style: Object
-}
-
-const JitsiScreenWebView = ({ source, style }: Props) => (
- <JitsiScreen
- disableForcedKeyboardDismiss = { true }
- style = { style }>
- <WebView source = {{ uri: source }} />
- </JitsiScreen>
-);
-
-export default JitsiScreenWebView;
diff --git a/react/features/mobile/navigation/components/settings/components/SettingsNavigationContainer.js b/react/features/mobile/navigation/components/settings/components/SettingsNavigationContainer.js
index 81b57c1dda..41fbfab542 100644
--- a/react/features/mobile/navigation/components/settings/components/SettingsNavigationContainer.js
+++ b/react/features/mobile/navigation/components/settings/components/SettingsNavigationContainer.js
@@ -3,14 +3,10 @@ import { createStackNavigator } from '@react-navigation/stack';
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
-import HelpView from '../../../../../settings/components/native/HelpView';
-import PrivacyView from '../../../../../settings/components/native/PrivacyView';
import SettingsView
from '../../../../../settings/components/native/SettingsView';
-import TermsView from '../../../../../settings/components/native/TermsView';
import { screen } from '../../../routes';
import {
- linkScreenOptions,
navigationContainerTheme,
settingsScreenOptions,
welcomeScreenOptions
@@ -61,27 +57,6 @@ const SettingsNavigationContainer = ({ isInWelcomePage }: Props) => {
}}>
{ SettingsScreen }
</SettingsStack.Screen>
- <SettingsStack.Screen
- component = { HelpView }
- name = { screen.settings.links.help }
- options = {{
- ...linkScreenOptions,
- title: t('helpView.title')
- }} />
- <SettingsStack.Screen
- component = { TermsView }
- name = { screen.settings.links.terms }
- options = {{
- ...linkScreenOptions,
- title: t('termsView.title')
- }} />
- <SettingsStack.Screen
- component = { PrivacyView }
- name = { screen.settings.links.privacy }
- options = {{
- ...linkScreenOptions,
- title: t('privacyView.title')
- }} />
</SettingsStack.Navigator>
</NavigationContainer>
);
diff --git a/react/features/mobile/navigation/screenOptions.js b/react/features/mobile/navigation/screenOptions.js
index 725f28e911..12f9036a3b 100644
--- a/react/features/mobile/navigation/screenOptions.js
+++ b/react/features/mobile/navigation/screenOptions.js
@@ -26,14 +26,6 @@ export const fullScreenOptions = {
headerShown: false
};
-export const linkScreenOptions = {
- gestureEnabled: true,
- headerShown: true,
- headerTitleStyle: {
- color: BaseTheme.palette.text01
- }
-};
-
/**
* Navigation container theme.
*/
diff --git a/react/features/settings/components/native/HelpView.tsx b/react/features/settings/components/native/HelpView.tsx
deleted file mode 100644
index 9d2547048b..0000000000
--- a/react/features/settings/components/native/HelpView.tsx
+++ /dev/null
@@ -1,85 +0,0 @@
-/* eslint-disable lines-around-comment */
-
-import React, { PureComponent } from 'react';
-
-import { IReduxState } from '../../../app/types';
-// @ts-ignore
-import JitsiScreenWebView from '../../../base/modal/components/JitsiScreenWebView';
-import { connect } from '../../../base/redux/functions';
-// @ts-ignore
-import { renderArrowBackButton }
-// @ts-ignore
- from '../../../mobile/navigation/components/welcome/functions';
-
-// @ts-ignore
-import styles from './styles';
-
-
-const DEFAULT_HELP_CENTRE_URL = 'https://web-cdn.jitsi.net/faq/meet-faq.html';
-
-interface IProps {
-
- /**
- * The URL to display in the Help Centre.
- */
- _url: string;
-
- /**
- * Default prop for navigating between screen components(React Navigation).
- */
- navigation: Object;
-}
-
-/**
- * Implements a page that renders the help content for the app.
- */
-class HelpView extends PureComponent<IProps> {
- /**
- * Implements React's {@link Component#componentDidMount()}. Invoked
- * immediately after mounting occurs.
- *
- * @inheritdoc
- * @returns {void}
- */
- componentDidMount() {
- const {
- navigation
- } = this.props;
-
- // @ts-ignore
- navigation.setOptions({
- headerLeft: () =>
- renderArrowBackButton(() =>
- // @ts-ignore
- navigation.goBack())
- });
- }
-
- /**
- * Implements {@code PureComponent#render()}.
- *
- * @inheritdoc
- * @returns {ReactElement}
- */
- render() {
- return (
- <JitsiScreenWebView
- source = { this.props._url }
- style = { styles.screenContainer } />
- );
- }
-}
-
-/**
- * Maps part of the Redux state to the props of this component.
- *
- * @param {Object} state - The Redux state.
- * @returns {IProps}
- */
-function _mapStateToProps(state: IReduxState) {
- return {
- _url: state['features/base/config'].helpCentreURL || DEFAULT_HELP_CENTRE_URL
- };
-}
-
-export default connect(_mapStateToProps)(HelpView);
diff --git a/react/features/settings/components/native/PrivacyView.tsx b/react/features/settings/components/native/PrivacyView.tsx
deleted file mode 100644
index 5acea382a2..0000000000
--- a/react/features/settings/components/native/PrivacyView.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-/* eslint-disable lines-around-comment */
-
-import React, { useEffect } from 'react';
-
-// @ts-ignore
-import JitsiScreenWebView from '../../../base/modal/components/JitsiScreenWebView';
-// @ts-ignore
-import { renderArrowBackButton }
-// @ts-ignore
- from '../../../mobile/navigation/components/welcome/functions';
-
-// @ts-ignore
-import styles from './styles';
-
-
-interface IProps {
-
- /**
- * Default prop for navigating between screen components(React Navigation).
- */
- navigation: Object;
-}
-
-/**
- * The URL at which the privacy policy is available to the user.
- */
-const PRIVACY_URL = 'https://jitsi.org/meet/privacy';
-
-const PrivacyView = ({ navigation }: IProps) => {
-
- useEffect(() => {
- // @ts-ignore
- navigation.setOptions({
- headerLeft: () =>
- renderArrowBackButton(() =>
- // @ts-ignore
- navigation.goBack())
- });
- });
-
- return (
- <JitsiScreenWebView
- source = { PRIVACY_URL }
- style = { styles.screenContainer } />
- );
-};
-
-export default PrivacyView;
diff --git a/react/features/settings/components/native/SettingsView.tsx b/react/features/settings/components/native/SettingsView.tsx
index aa5c0c955f..dfdade92a1 100644
--- a/react/features/settings/components/native/SettingsView.tsx
+++ b/react/features/settings/components/native/SettingsView.tsx
@@ -1,11 +1,11 @@
/* eslint-disable lines-around-comment */
-import { Link } from '@react-navigation/native';
import _ from 'lodash';
import React, { Component } from 'react';
import { WithTranslation } from 'react-i18next';
import {
Alert,
+ Linking,
NativeModules,
Platform,
ScrollView,
@@ -14,6 +14,7 @@ import {
} from 'react-native';
import { Divider } from 'react-native-paper';
+
import { getDefaultURL } from '../../../app/functions.native';
import { IReduxState } from '../../../app/types';
// @ts-ignore
@@ -24,10 +25,11 @@ import JitsiScreen from '../../../base/modal/components/JitsiScreen';
import { getLocalParticipant } from '../../../base/participants/functions';
import { connect } from '../../../base/redux/functions';
import { updateSettings } from '../../../base/settings/actions';
+import Button from '../../../base/ui/components/native/Button';
import Input from '../../../base/ui/components/native/Input';
import Switch from '../../../base/ui/components/native/Switch';
// @ts-ignore
-import { screen } from '../../../mobile/navigation/routes';
+import { BUTTON_TYPES } from '../../../base/ui/constants.any';
// @ts-ignore
import { AVATAR_SIZE } from '../../../welcome/components/styles';
import { isServerURLChangeEnabled, normalizeUserInputURL } from '../../functions.native';
@@ -44,6 +46,18 @@ import styles from './styles';
*/
const { AppInfo } = NativeModules;
+/**
+ * The URL at which the terms (of service/use) are available to the user.
+ */
+const TERMS_URL = 'https://jitsi.org/meet/terms';
+
+/**
+ * The URL at which the privacy policy is available to the user.
+ */
+const PRIVACY_URL = 'https://jitsi.org/meet/privacy';
+
+
+const DEFAULT_HELP_CENTRE_URL = 'https://web-cdn.jitsi.net/faq/meet-faq.html';
interface IState {
@@ -104,6 +118,13 @@ interface IState {
*/
interface IProps extends WithTranslation {
+ /**
+ * The URL for when the help link.
+ *
+ * @protected
+ */
+ _helpCentreUrl: string;
+
/**
* The ID of the local participant.
*/
@@ -225,6 +246,9 @@ class SettingsView extends Component<IProps, IState> {
this._onStartVideoMutedChange
= this._onStartVideoMutedChange.bind(this);
this._setURLFieldReference = this._setURLFieldReference.bind(this);
+ this._onShowHelpPressed = this._onShowHelpPressed.bind(this);
+ this._onShowPrivacyPressed = this._onShowPrivacyPressed.bind(this);
+ this._onShowTermsPressed = this._onShowTermsPressed.bind(this);
this._showURLAlert = this._showURLAlert.bind(this);
}
@@ -349,26 +373,23 @@ class SettingsView extends Component<IProps, IState> {
</FormSectionAccordion>
<FormSectionAccordion
label = 'settingsView.links'>
- <Link
- style = { styles.sectionLink }
- // @ts-ignore
- to = {{ screen: screen.settings.links.help }}>
- { t('settingsView.help') }
- </Link>
+ <Button
+ accessibilityLabel = 'settingsView.help'
+ labelKey = 'settingsView.help'
+ onClick = { this._onShowHelpPressed }
+ type = { BUTTON_TYPES.TERTIARY } />
<Divider style = { styles.fieldSeparator } />
- <Link
- style = { styles.sectionLink }
- // @ts-ignore
- to = {{ screen: screen.settings.links.terms }}>
- { t('settingsView.terms') }
- </Link>
+ <Button
+ accessibilityLabel = 'settingsView.terms'
+ labelKey = 'settingsView.terms'
+ onClick = { this._onShowTermsPressed }
+ type = { BUTTON_TYPES.TERTIARY } />
<Divider style = { styles.fieldSeparator } />
- <Link
- style = { styles.sectionLink }
- // @ts-ignore
- to = {{ screen: screen.settings.links.privacy }}>
- { t('settingsView.privacy') }
- </Link>
+ <Button
+ accessibilityLabel = 'settingsView.privacy'
+ labelKey = 'settingsView.privacy'
+ onClick = { this._onShowPrivacyPressed }
+ type = { BUTTON_TYPES.TERTIARY } />
</FormSectionAccordion>
<FormSectionAccordion
label = 'settingsView.buildInfoSection'>
@@ -668,6 +689,33 @@ class SettingsView extends Component<IProps, IState> {
);
}
+ /**
+ * Opens the help url into the browser.
+ *
+ * @returns {void}
+ */
+ _onShowHelpPressed() {
+ Linking.openURL(this.props._helpCentreUrl);
+ }
+
+ /**
+ * Opens the privacy url into the browser.
+ *
+ * @returns {void}
+ */
+ _onShowPrivacyPressed() {
+ Linking.openURL(PRIVACY_URL);
+ }
+
+ /**
+ * Opens the terms url into the browser.
+ *
+ * @returns {void}
+ */
+ _onShowTermsPressed() {
+ Linking.openURL(TERMS_URL);
+ }
+
/**
* Shows an alert warning the user about disabling crash reporting.
*
@@ -732,6 +780,7 @@ function _mapStateToProps(state: IReduxState) {
const localParticipant = getLocalParticipant(state);
return {
+ _helpCentreUrl: state['features/base/config'].helpCentreURL || DEFAULT_HELP_CENTRE_URL,
_localParticipantId: localParticipant?.id,
_serverURL: getDefaultURL(state),
_serverURLChangeEnabled: isServerURLChangeEnabled(state),
diff --git a/react/features/settings/components/native/TermsView.tsx b/react/features/settings/components/native/TermsView.tsx
deleted file mode 100644
index 4c840d5186..0000000000
--- a/react/features/settings/components/native/TermsView.tsx
+++ /dev/null
@@ -1,48 +0,0 @@
-/* eslint-disable lines-around-comment */
-
-import React, { useEffect } from 'react';
-
-// @ts-ignore
-import JitsiScreenWebView from '../../../base/modal/components/JitsiScreenWebView';
-// @ts-ignore
-import { renderArrowBackButton }
-// @ts-ignore
- from '../../../mobile/navigation/components/welcome/functions';
-
-// @ts-ignore
-import styles from './styles';
-
-
-interface IProps {
-
- /**
- * Default prop for navigating between screen components(React Navigation).
- */
- navigation: Object;
-}
-
-/**
- * The URL at which the terms (of service/use) are available to the user.
- */
-const TERMS_URL = 'https://jitsi.org/meet/terms';
-
-const TermsView = ({ navigation }: IProps) => {
-
- useEffect(() => {
- // @ts-ignore
- navigation.setOptions({
- headerLeft: () =>
- renderArrowBackButton(() =>
- // @ts-ignore
- navigation.goBack())
- });
- });
-
- return (
- <JitsiScreenWebView
- source = { TERMS_URL }
- style = { styles.screenContainer } />
- );
-};
-
-export default TermsView;
diff --git a/react/features/settings/components/native/styles.js b/react/features/settings/components/native/styles.js
index a72ca0f886..5c9bd79638 100644
--- a/react/features/settings/components/native/styles.js
+++ b/react/features/settings/components/native/styles.js
@@ -109,23 +109,6 @@ export default {
fontSize: 14
},
- sectionLink: {
- ...BaseTheme.typography.bodyShortBoldLarge,
- color: BaseTheme.palette.link01,
- margin: BaseTheme.spacing[3],
- textAlign: 'center'
- },
-
- sectionLinkContainer: {
- margin: BaseTheme.spacing[3]
- },
-
- sectionLinkText: {
- ...BaseTheme.typography.bodyShortBoldLarge,
- color: BaseTheme.palette.link01,
- textAlign: 'center'
- },
-
/**
* Global {@code Text} color for the components.
*/