Skip to content

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

feat(rn, settings, rn): update view

Gabriel Borleaebc932572f4e
diff --git a/lang/main.json b/lang/main.json
index d2b5e531c4..6c900fca7b 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -1079,6 +1079,7 @@
"alertOk": "OK",
"alertTitle": "Warning",
"alertURLText": "The entered server URL is invalid",
+ "apply": "Apply",
"buildInfoSection": "Build Information",
"conferenceSection": "Conference",
"disableCallIntegration": "Disable native call integration",
@@ -1089,6 +1090,7 @@
"displayNamePlaceholderText": "Eg: John Doe",
"email": "Email",
"emailPlaceholderText": "[email protected]",
+ "gavatarMessage": "If your email is associated with a Gravatar account, we will use it to display your profile picture.",
"goTo": "Go to",
"header": "Settings",
"help": "Help",
diff --git a/react/features/mobile/navigation/components/settings/SettingsNavigationContainerRef.ts b/react/features/mobile/navigation/components/settings/SettingsNavigationContainerRef.ts
index 02f675e23e..6614b4053b 100644
--- a/react/features/mobile/navigation/components/settings/SettingsNavigationContainerRef.ts
+++ b/react/features/mobile/navigation/components/settings/SettingsNavigationContainerRef.ts
@@ -10,7 +10,7 @@ export const settingsNavigationContainerRef = React.createRef<NavigationContaine
* @param {Object} params - Params to pass to the destination route.
* @returns {Function}
*/
-export function navigate(name: string, params: Object) {
+export function navigate(name: string, params?: Object) {
return settingsNavigationContainerRef.current?.navigate(name, params);
}
diff --git a/react/features/mobile/navigation/components/settings/components/SettingsNavigationContainer.tsx b/react/features/mobile/navigation/components/settings/components/SettingsNavigationContainer.tsx
index 9fafb4e344..e2630d0d2d 100644
--- a/react/features/mobile/navigation/components/settings/components/SettingsNavigationContainer.tsx
+++ b/react/features/mobile/navigation/components/settings/components/SettingsNavigationContainer.tsx
@@ -3,11 +3,15 @@ import { createStackNavigator } from '@react-navigation/stack';
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
+import LanguageSelectView from '../../../../../settings/components/native/LanguageSelectView';
+import ProfileView from '../../../../../settings/components/native/ProfileView';
import SettingsView
from '../../../../../settings/components/native/SettingsView';
import { screen } from '../../../routes';
import {
+ languageSelectScreenOptions,
navigationContainerTheme,
+ profileSettingsScreenOptions,
settingsScreenOptions,
welcomeScreenOptions
} from '../../../screenOptions';
@@ -37,10 +41,19 @@ const SettingsNavigationContainer = ({ isInWelcomePage }: IProps) => {
const SettingsScreen = useCallback(() =>
(
<SettingsView
- addBottomInset = { !isInWelcomePage }
- scrollBounces = { isInWelcomePage } />
+ isInWelcomePage = { isInWelcomePage } />
), []);
+ const ProfileScreen = useCallback(() =>
+ (<ProfileView
+ isInWelcomePage = { isInWelcomePage } />)
+ , []);
+
+ const LanguageSelectScreen = useCallback(() =>
+ (<LanguageSelectView
+ isInWelcomePage = { isInWelcomePage } />)
+ , []);
+
return (
<NavigationContainer
independent = { true }
@@ -56,6 +69,20 @@ const SettingsNavigationContainer = ({ isInWelcomePage }: IProps) => {
}}>
{ SettingsScreen }
</SettingsStack.Screen>
+ <SettingsStack.Screen
+ component = { ProfileScreen }
+ name = { screen.settings.profile }
+ options = {{
+ ...profileSettingsScreenOptions,
+ title: t('settingsView.profileSection')
+ }} />
+ <SettingsStack.Screen
+ component = { LanguageSelectScreen }
+ name = { screen.settings.language }
+ options = {{
+ ...languageSelectScreenOptions,
+ title: t('settings.language')
+ }} />
</SettingsStack.Navigator>
</NavigationContainer>
);
diff --git a/react/features/mobile/navigation/routes.ts b/react/features/mobile/navigation/routes.ts
index 5433922d71..09f37c4c06 100644
--- a/react/features/mobile/navigation/routes.ts
+++ b/react/features/mobile/navigation/routes.ts
@@ -44,7 +44,9 @@ export const screen = {
help: 'Help',
privacy: 'Privacy',
terms: 'Terms'
- }
+ },
+ profile: 'Profile',
+ language: 'Language'
},
unsafeRoomWarning: 'Unsafe Room Warning'
};
diff --git a/react/features/mobile/navigation/screenOptions.ts b/react/features/mobile/navigation/screenOptions.ts
index 1e46e7ccfb..0136c30746 100644
--- a/react/features/mobile/navigation/screenOptions.ts
+++ b/react/features/mobile/navigation/screenOptions.ts
@@ -196,6 +196,24 @@ export const preJoinScreenOptions = {
}
};
+/**
+ * Screen options for profile setting.
+ */
+export const profileSettingsScreenOptions = {
+ headerStyle: {
+ backgroundColor: BaseTheme.palette.ui01
+ },
+ headerTitleStyle: {
+ color: BaseTheme.palette.text01
+ },
+ headerBackTitleVisible: false
+};
+
+/**
+ * Screen options for language select screen.
+ */
+export const languageSelectScreenOptions = profileSettingsScreenOptions;
+
/**
* Screen options for pre-join screen.
*/
diff --git a/react/features/settings/components/native/AdvancedSection.tsx b/react/features/settings/components/native/AdvancedSection.tsx
new file mode 100644
index 0000000000..a4afb47cc8
--- /dev/null
+++ b/react/features/settings/components/native/AdvancedSection.tsx
@@ -0,0 +1,114 @@
+import React, { useCallback, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+import { Alert, NativeModules, Platform, Text } from 'react-native';
+import { Divider } from 'react-native-paper';
+import { useDispatch, useSelector } from 'react-redux';
+
+import { IReduxState } from '../../../app/types';
+import { updateSettings } from '../../../base/settings/actions';
+import Switch from '../../../base/ui/components/native/Switch';
+
+import FormRow from './FormRow';
+import FormSection from './FormSection';
+import styles from './styles';
+
+const { AppInfo } = NativeModules;
+
+const AdvancedSection = () => {
+ const { t } = useTranslation();
+ const dispatch = useDispatch();
+ const {
+ disableCrashReporting,
+ disableCallIntegration,
+ disableP2P
+ } = useSelector((state: IReduxState) => state['features/base/settings']);
+
+ const onSwitchToggled = useCallback((name: string) => (enabled?: boolean) => {
+
+ if (name === 'disableCrashReporting' && enabled === true) {
+ Alert.alert(
+ t('settingsView.alertTitle'),
+ t('settingsView.disableCrashReportingWarning'),
+ [
+ {
+ onPress: () => dispatch(updateSettings({ disableCrashReporting: true })),
+ text: t('settingsView.alertOk')
+ },
+ {
+ text: t('settingsView.alertCancel')
+ }
+ ]
+ );
+ } else {
+ dispatch(updateSettings({ [name]: enabled }));
+ }
+ }, [ dispatch, updateSettings ]);
+
+ const switches = useMemo(() => {
+ const partialSwitches = [
+ {
+ label: 'settingsView.disableCallIntegration',
+ state: disableCallIntegration,
+ name: 'disableCallIntegration'
+ },
+ {
+ label: 'settingsView.disableP2P',
+ state: disableP2P,
+ name: 'disableP2P'
+ },
+ {
+ label: 'settingsView.disableCrashReporting',
+ state: disableCrashReporting,
+ name: 'disableCrashReporting'
+ }
+ ];
+
+ if (Platform.OS !== 'android') {
+ partialSwitches.shift();
+ }
+
+ if (!AppInfo.GOOGLE_SERVICES_ENABLED) {
+ partialSwitches.pop();
+ }
+
+ return partialSwitches;
+ }, [ disableCallIntegration, disableP2P, disableCrashReporting ]);
+
+ return (
+ <>
+ <FormSection
+ label = 'settingsView.advanced'>
+ {
+ switches.map(({ label, state, name }) => (
+ <FormRow
+ key = { label }
+ label = { label }>
+ <Switch
+ checked = { Boolean(state) }
+ onChange = { onSwitchToggled(name) } />
+ </FormRow>
+ ))
+ }
+ </FormSection>
+ {/* @ts-ignore */}
+ <Divider style = { styles.fieldSeparator } />
+ <FormSection
+ label = 'settingsView.buildInfoSection'>
+ <FormRow
+ label = 'settingsView.version'>
+ <Text style = { styles.text }>
+ {`${AppInfo.version} build ${AppInfo.buildNumber}`}
+ </Text>
+ </FormRow>
+ <FormRow
+ label = 'settingsView.sdkVersion'>
+ <Text style = { styles.text }>
+ {AppInfo.sdkVersion}
+ </Text>
+ </FormRow>
+ </FormSection>
+ </>
+ );
+};
+
+export default AdvancedSection;
diff --git a/react/features/settings/components/native/ConferenceSection.tsx b/react/features/settings/components/native/ConferenceSection.tsx
new file mode 100644
index 0000000000..52b8261395
--- /dev/null
+++ b/react/features/settings/components/native/ConferenceSection.tsx
@@ -0,0 +1,93 @@
+import React, { useCallback, useEffect, useMemo } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useDispatch, useSelector } from 'react-redux';
+
+import { getDefaultURL } from '../../../app/functions.native';
+import { IReduxState } from '../../../app/types';
+import { updateSettings } from '../../../base/settings/actions';
+import Input from '../../../base/ui/components/native/Input';
+import Switch from '../../../base/ui/components/native/Switch';
+import { isServerURLChangeEnabled, normalizeUserInputURL } from '../../functions.any';
+
+import FormRow from './FormRow';
+import FormSection from './FormSection';
+import styles from './styles';
+
+
+const ConferenceSection = () => {
+ const { t } = useTranslation();
+ const dispatch = useDispatch();
+ const defaultServerURL = useSelector((state: IReduxState) => getDefaultURL(state));
+ const {
+ serverURL,
+ startCarMode,
+ startWithAudioMuted,
+ startWithVideoMuted
+ } = useSelector((state: IReduxState) => state['features/base/settings']);
+
+ const { serverURLChangeEnabled } = useSelector((state: IReduxState) => isServerURLChangeEnabled(state));
+
+ const switches = useMemo(() => [
+ {
+ label: 'settingsView.startCarModeInLowBandwidthMode',
+ state: startCarMode,
+ name: 'startCarMode'
+ },
+ {
+ label: 'settingsView.startWithAudioMuted',
+ state: startWithAudioMuted,
+ name: 'startWithAudioMuted'
+ },
+ {
+ label: 'settingsView.startWithVideoMuted',
+ state: startWithVideoMuted,
+ name: 'startWithVideoMuted'
+ }
+ ], [ startCarMode, startWithAudioMuted, startWithVideoMuted ]);
+
+ const onChangeServerURL = useCallback(newServerURL => {
+ dispatch(updateSettings({ serverURL: newServerURL }));
+ }, [ updateSettings ]);
+
+ const processServerURL = useCallback(() => {
+ const normalizedURL = normalizeUserInputURL(serverURL ?? '');
+
+ onChangeServerURL(normalizedURL);
+ }, [ serverURL ]);
+
+ useEffect(() => () => processServerURL(), []);
+
+ const onSwitchToggled = useCallback((name: string) => (enabled?: boolean) => {
+ dispatch(updateSettings({ [name]: enabled }));
+ }, [ dispatch, updateSettings ]);
+
+ return (
+ <FormSection
+ label = 'settingsView.conferenceSection'>
+ <Input
+ autoCapitalize = 'none'
+ customStyles = {{ container: styles.customContainer }}
+ editable = { serverURLChangeEnabled }
+ keyboardType = { 'url' }
+ label = { t('settingsView.serverURL') }
+ onBlur = { processServerURL }
+ onChange = { onChangeServerURL }
+ placeholder = { defaultServerURL }
+ textContentType = { 'URL' } // iOS only
+ value = { serverURL ?? '' } />
+ {
+ switches.map(({ label, state, name }) => (
+ <FormRow
+ key = { label }
+ label = { label }>
+ <Switch
+ checked = { Boolean(state) }
+ onChange = { onSwitchToggled(name) } />
+ </FormRow>
+ ))
+ }
+ </FormSection>
+ );
+};
+
+export default ConferenceSection;
diff --git a/react/features/settings/components/native/FormRow.tsx b/react/features/settings/components/native/FormRow.tsx
index 513e01fd71..9d2d0551d6 100644
--- a/react/features/settings/components/native/FormRow.tsx
+++ b/react/features/settings/components/native/FormRow.tsx
@@ -59,7 +59,7 @@ class FormRow extends Component<IProps> {
* @returns {ReactElement}
*/
render() {
- const { layout, t } = this.props;
+ const { t } = this.props;
// Some field types need additional props to look good and standardized
// on a form.
@@ -75,8 +75,7 @@ class FormRow extends Component<IProps> {
<Text
style = { [
styles.text,
- styles.fieldLabelText,
- layout === 'column' ? styles.fieldLabelTextColumn : undefined
+ styles.fieldLabelText
] } >
{ t(this.props.label) }
</Text>
diff --git a/react/features/settings/components/native/FormSection.tsx b/react/features/settings/components/native/FormSection.tsx
index f1dd010786..efa8a42a18 100644
--- a/react/features/settings/components/native/FormSection.tsx
+++ b/react/features/settings/components/native/FormSection.tsx
@@ -20,7 +20,7 @@ interface IProps extends WithTranslation {
/**
* The i18n key of the text label of the section.
*/
- label: string;
+ label?: string;
}
/**
@@ -31,12 +31,9 @@ interface IProps extends WithTranslation {
function FormSection({ children, label, t }: IProps) {
return (
<View>
- <View
- style = { styles.formSectionTitleContent }>
- <Text style = { styles.formSectionTitleText }>
- { t(label) }
- </Text>
- </View>
+ {label && <Text style = { styles.formSectionTitleText }>
+ { t(label) }
+ </Text>}
{ children }
</View>
);
diff --git a/react/features/settings/components/native/GeneralSection.tsx b/react/features/settings/components/native/GeneralSection.tsx
new file mode 100644
index 0000000000..d30380616d
--- /dev/null
+++ b/react/features/settings/components/native/GeneralSection.tsx
@@ -0,0 +1,83 @@
+import React, { useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
+import { Text, TouchableHighlight, View, ViewStyle } from 'react-native';
+import { useDispatch, useSelector } from 'react-redux';
+
+import { IReduxState } from '../../../app/types';
+import i18next, { DEFAULT_LANGUAGE } from '../../../base/i18n/i18next';
+import Icon from '../../../base/icons/components/Icon';
+import { IconArrowRight } from '../../../base/icons/svg';
+import { updateSettings } from '../../../base/settings/actions';
+import Switch from '../../../base/ui/components/native/Switch';
+import { navigate } from '../../../mobile/navigation/components/settings/SettingsNavigationContainerRef';
+import { screen } from '../../../mobile/navigation/routes';
+
+import FormRow from './FormRow';
+import FormSection from './FormSection';
+import styles from './styles';
+
+
+const GeneralSection = () => {
+ const { t } = useTranslation();
+ const dispatch = useDispatch();
+ const {
+ disableSelfView,
+ userSelectedSkipPrejoin
+ } = useSelector((state: IReduxState) => state['features/base/settings']);
+
+ const showPrejoinPage = !userSelectedSkipPrejoin;
+
+ let showPrejoinSettings = useSelector(
+ (state: IReduxState) => state['features/base/config'].prejoinConfig?.enabled);
+
+ const { language = DEFAULT_LANGUAGE } = i18next;
+
+ const onSelfViewToggled = useCallback((enabled?: boolean) =>
+ dispatch(updateSettings({ disableSelfView: enabled }))
+ , [ dispatch, updateSettings ]);
+
+ const onShowPejoinToggled = useCallback((enabled?: boolean) => {
+ dispatch(updateSettings({ userSelectedSkipPrejoin: !enabled }));
+ }
+ , [ dispatch, updateSettings ]);
+
+ const navigateToLanguageSelect = useCallback(() => {
+ navigate(screen.settings.language);
+ }, [ navigate, screen ]);
+
+ // TODO:
+ // Delete this line when prejoin skipping is available on mobile
+ showPrejoinSettings = false;
+
+ return (
+ <FormSection>
+ <FormRow label = 'videothumbnail.hideSelfView'>
+ <Switch
+ checked = { Boolean(disableSelfView) }
+ onChange = { onSelfViewToggled } />
+ </FormRow>
+
+ {showPrejoinSettings && <FormRow label = 'prejoin.showScreen'>
+ <Switch
+ checked = { showPrejoinPage }
+ onChange = { onShowPejoinToggled } />
+ </FormRow>}
+
+ <FormRow label = 'settings.language'>
+ <TouchableHighlight onPress = { navigateToLanguageSelect }>
+ <View style = { styles.languageButton as ViewStyle }>
+ <Text
+ style = { styles.languageText }>{t(`languages:${language}`)}</Text>
+ <View>
+ <Icon
+ size = { 24 }
+ src = { IconArrowRight } />
+ </View>
+ </View>
+ </TouchableHighlight>
+ </FormRow>
+ </FormSection>
+ );
+};
+
+export default GeneralSection;
diff --git a/react/features/settings/components/native/LanguageSelectView.tsx b/react/features/settings/components/native/LanguageSelectView.tsx
new file mode 100644
index 0000000000..ec18c3a666
--- /dev/null
+++ b/react/features/settings/components/native/LanguageSelectView.tsx
@@ -0,0 +1,55 @@
+import React, { useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
+import { ScrollView, Text, TouchableHighlight, View, ViewStyle } from 'react-native';
+
+import i18next, { DEFAULT_LANGUAGE, LANGUAGES } from '../../../base/i18n/i18next';
+import JitsiScreen from '../../../base/modal/components/JitsiScreen';
+import { navigate } from '../../../mobile/navigation/components/settings/SettingsNavigationContainerRef';
+import { screen } from '../../../mobile/navigation/routes';
+
+import styles from './styles';
+
+const LanguageSelectView = ({ isInWelcomePage }: { isInWelcomePage?: boolean; }) => {
+ const { t } = useTranslation();
+ const { language: currentLanguage = DEFAULT_LANGUAGE } = i18next;
+
+ const setLanguage = useCallback(language => () => {
+ i18next.changeLanguage(language);
+ navigate(screen.settings.main);
+ }, [ i18next ]);
+
+ return (
+ <JitsiScreen
+ disableForcedKeyboardDismiss = { true }
+
+ // @ts-ignore
+ safeAreaInsets = { [ !isInWelcomePage && 'bottom', 'left', 'right' ].filter(Boolean) }
+ style = { styles.settingsViewContainer }>
+ <ScrollView
+ bounces = { isInWelcomePage }
+ contentContainerStyle = { styles.profileView as ViewStyle }>
+ {
+ LANGUAGES.map(language => (
+ <TouchableHighlight
+ disabled = { currentLanguage === language }
+ key = { language }
+ onPress = { setLanguage(language) }>
+ <View
+ style = { styles.languageOption as ViewStyle }>
+ <Text
+ style = { [
+ styles.text,
+ styles.fieldLabelText,
+ currentLanguage === language && styles.selectedLanguage ] }>
+ { t(`languages:${language}`) }
+ </Text>
+ </View>
+ </TouchableHighlight>
+ ))
+ }
+ </ScrollView>
+ </JitsiScreen>
+ );
+};
+
+export default LanguageSelectView;
diff --git a/react/features/settings/components/native/LinksSection.tsx b/react/features/settings/components/native/LinksSection.tsx
new file mode 100644
index 0000000000..e4c3f2cdc9
--- /dev/null
+++ b/react/features/settings/components/native/LinksSection.tsx
@@ -0,0 +1,57 @@
+import React, { useCallback, useMemo } from 'react';
+import { Linking, View, ViewStyle } from 'react-native';
+import { useSelector } from 'react-redux';
+
+import { IReduxState } from '../../../app/types';
+import { getLegalUrls } from '../../../base/config/functions.native';
+import Button from '../../../base/ui/components/native/Button';
+import { BUTTON_TYPES } from '../../../base/ui/constants.native';
+
+import FormSection from './FormSection';
+import styles from './styles';
+
+
+const LinksSection = () => {
+ const {
+ privacy,
+ helpCentre,
+ terms
+ } = useSelector((state: IReduxState) => getLegalUrls(state));
+
+ const links = useMemo(() => [
+ {
+ label: 'settingsView.help',
+ link: helpCentre
+ },
+ {
+ label: 'settingsView.terms',
+ link: terms
+ },
+ {
+ label: 'settingsView.privacy',
+ link: privacy
+ }
+ ], [ privacy, helpCentre, terms ]);
+
+ const onLinkPress = useCallback(link => () => Linking.openURL(link), [ Linking ]);
+
+ return (
+ <FormSection>
+ <View style = { styles.linksSection as ViewStyle }>
+ {
+ links.map(({ label, link }) => (
+ <Button
+ accessibilityLabel = { label }
+ key = { label }
+ labelKey = { label }
+ onClick = { onLinkPress(link) }
+ style = { styles.linksButton }
+ type = { BUTTON_TYPES.TERTIARY } />
+ ))
+ }
+ </View>
+ </FormSection>
+ );
+};
+
+export default LinksSection;
diff --git a/react/features/settings/components/native/ModeratorSection.tsx b/react/features/settings/components/native/ModeratorSection.tsx
new file mode 100644
index 0000000000..394acf3831
--- /dev/null
+++ b/react/features/settings/components/native/ModeratorSection.tsx
@@ -0,0 +1,96 @@
+import React, { useCallback, useMemo } from 'react';
+import { useDispatch, useSelector } from 'react-redux';
+
+import { IReduxState } from '../../../app/types';
+import { setFollowMe, setStartMutedPolicy, setStartReactionsMuted } from '../../../base/conference/actions';
+import { updateSettings } from '../../../base/settings/actions';
+import Switch from '../../../base/ui/components/native/Switch';
+import { getModeratorTabProps } from '../../functions.native';
+
+import FormRow from './FormRow';
+import FormSection from './FormSection';
+
+const ModeratorSection = () => {
+ const dispatch = useDispatch();
+ const {
+ followMeEnabled,
+ startAudioMuted,
+ startVideoMuted,
+ startReactionsMuted
+ } = useSelector((state: IReduxState) => getModeratorTabProps(state));
+
+ const { disableReactionsModeration } = useSelector((state: IReduxState) => state['features/base/config']);
+
+ const onStartAudioMutedToggled = useCallback((enabled?: boolean) => {
+ dispatch(setStartMutedPolicy(
+ Boolean(enabled), Boolean(startVideoMuted)));
+ }, [ startVideoMuted, dispatch, setStartMutedPolicy ]);
+
+ const onStartVideoMutedToggled = useCallback((enabled?: boolean) => {
+ dispatch(setStartMutedPolicy(
+ Boolean(startAudioMuted), Boolean(enabled)));
+ }, [ startAudioMuted, dispatch, setStartMutedPolicy ]);
+
+ const onFollowMeToggled = useCallback((enabled?: boolean) => {
+ dispatch(setFollowMe(Boolean(enabled)));
+ }, [ dispatch, setFollowMe ]);
+
+ const onStartReactionsMutedToggled = useCallback((enabled?: boolean) => {
+ dispatch(setStartReactionsMuted(Boolean(enabled), true));
+ dispatch(updateSettings({ soundsReactions: enabled }));
+ }, [ dispatch, updateSettings, setStartReactionsMuted ]);
+
+ const moderationSettings = useMemo(() => {
+ const moderation = [
+ {
+ label: 'settings.startAudioMuted',
+ state: startAudioMuted,
+ onChange: onStartAudioMutedToggled
+ },
+ {
+ label: 'settings.startVideoMuted',
+ state: startVideoMuted,
+ onChange: onStartVideoMutedToggled
+ },
+ {
+ label: 'settings.followMe',
+ state: followMeEnabled,
+ onChange: onFollowMeToggled
+ },
+ {
+ label: 'settings.startReactionsMuted',
+ state: startReactionsMuted,
+ onChange: onStartReactionsMutedToggled
+ }
+ ];
+
+ if (disableReactionsModeration) {
+ moderation.pop();
+ }
+
+ return moderation;
+ }, [ startAudioMuted,
+ startVideoMuted,
+ followMeEnabled,
+ disableReactionsModeration,
+ startReactionsMuted ]);
+
+ return (
+ <FormSection
+ label = 'settings.playSounds'>
+ {
+ moderationSettings.map(({ label, state, onChange }) => (
+ <FormRow
+ key = { label }
+ label = { label }>
+ <Switch
+ checked = { Boolean(state) }
+ onChange = { onChange } />
+ </FormRow>
+ ))
+ }
+ </FormSection>
+ );
+};
+
+export default ModeratorSection;
diff --git a/react/features/settings/components/native/NotificationsSection.tsx b/react/features/settings/components/native/NotificationsSection.tsx
new file mode 100644
index 0000000000..dafea669e0
--- /dev/null
+++ b/react/features/settings/components/native/NotificationsSection.tsx
@@ -0,0 +1,139 @@
+import React, { useCallback, useMemo } from 'react';
+import { Divider } from 'react-native-paper';
+import { useDispatch, useSelector } from 'react-redux';
+
+import { IReduxState } from '../../../app/types';
+import { updateSettings } from '../../../base/settings/actions';
+import Switch from '../../../base/ui/components/native/Switch';
+import { getNotificationsTabProps } from '../../functions.any';
+
+import FormRow from './FormRow';
+import FormSection from './FormSection';
+import styles from './styles';
+
+const NotificationsSection = () => {
+ const dispatch = useDispatch();
+ const {
+ soundsIncomingMessage,
+ soundsParticipantJoined,
+ soundsParticipantKnocking,
+ soundsParticipantLeft,
+ soundsReactions,
+ soundsTalkWhileMuted,
+ enableReactions,
+ enabledNotifications,
+ disabledSounds,
+ moderatorMutedSoundsReactions
+ } = useSelector((state: IReduxState) => getNotificationsTabProps(state));
+
+ const sounds = useMemo(() => {
+ const partialSounds = [
+ {
+ label: 'settings.reactions',
+ state: soundsReactions,
+ name: 'soundsReactions',
+ disabled: Boolean(moderatorMutedSoundsReactions
+ || disabledSounds.includes('REACTION_SOUND'))
+ },
+ {
+ label: 'settings.incomingMessage',
+ state: soundsIncomingMessage,
+ name: 'soundsIncomingMessage'
+ },
+ {
+ label: 'settings.participantJoined',
+ state: soundsParticipantJoined,
+ name: 'soundsParticipantJoined'
+ },
+ {
+ label: 'settings.participantLeft',
+ state: soundsParticipantLeft,
+ name: 'soundsParticipantLeft'
+ },
+ {
+ label: 'settings.talkWhileMuted',
+ state: soundsTalkWhileMuted,
+ name: 'soundsTalkWhileMuted'
+ },
+ {
+ label: 'settings.participantKnocking',
+ state: soundsParticipantKnocking,
+ name: 'soundsParticipantKnocking'
+ }
+ ];
+
+ if (!enableReactions) {
+ partialSounds.shift();
+ }
+
+ return partialSounds;
+
+ }, [ soundsReactions,
+ soundsIncomingMessage,
+ soundsParticipantJoined,
+ soundsParticipantLeft,
+ soundsTalkWhileMuted,
+ soundsParticipantKnocking,
+ enableReactions ]);
+
+ const onSoundToggled = useCallback((name: string) => (enabled?: boolean) => {
+ dispatch(updateSettings({ [name]: enabled }));
+ }, [ dispatch, updateSettings ]);
+
+
+ const onNotificationToggled = useCallback((name: string) => (enabled?: boolean) => {
+ dispatch(updateSettings({
+ userSelectedNotifications: {
+ ...enabledNotifications,
+ [name]: Boolean(enabled)
+ }
+ }
+ )
+ );
+ }, [ dispatch, updateSettings, enabledNotifications ]);
+
+ return (
+ <>
+ <FormSection
+ label = 'settings.playSounds'>
+ {
+ sounds.map(({ label, state, name, disabled }) => (
+ <FormRow
+ key = { label }
+ label = { label }>
+ <Switch
+ checked = { Boolean(state) }
+ disabled = { disabled }
+ onChange = { onSoundToggled(name) } />
+ </FormRow>
+ ))
+ }
+ </FormSection>
+ {
+ Object.keys(enabledNotifications).length > 0 && (
+ <>
+ {/* @ts-ignore */}
+ <Divider style = { styles.fieldSeparator } />
+ <FormSection
+ label = 'notify.displayNotifications'>
+ {
+ Object.keys(enabledNotifications).map(name => (
+ <FormRow
+ key = { name }
+ label = { name }>
+ <Switch
+ checked = { Boolean(enabledNotifications[name]) }
+ onChange = { onNotificationToggled(name) } />
+ </FormRow>)
+ )
+ }
+ </FormSection>
+ </>
+ )
+
+ }
+ </>
+ );
+};
+
+export default NotificationsSection;
diff --git a/react/features/settings/components/native/ProfileView.tsx b/react/features/settings/components/native/ProfileView.tsx
new file mode 100644
index 0000000000..716205f4f2
--- /dev/null
+++ b/react/features/settings/components/native/ProfileView.tsx
@@ -0,0 +1,101 @@
+import React, { useCallback, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { ScrollView, Text, View, ViewStyle } from 'react-native';
+import { useDispatch, useSelector } from 'react-redux';
+
+import { IReduxState } from '../../../app/types';
+import Avatar from '../../../base/avatar/components/Avatar';
+import JitsiScreen from '../../../base/modal/components/JitsiScreen';
+import { getLocalParticipant } from '../../../base/participants/functions';
+import { updateSettings } from '../../../base/settings/actions';
+import Button from '../../../base/ui/components/native/Button';
+import Input from '../../../base/ui/components/native/Input';
+import { BUTTON_TYPES } from '../../../base/ui/constants.native';
+import { navigate } from '../../../mobile/navigation/components/settings/SettingsNavigationContainerRef';
+import { screen } from '../../../mobile/navigation/routes';
+
+import FormSection from './FormSection';
+import { AVATAR_SIZE } from './constants';
+import styles from './styles';
+
+const ProfileView = ({ isInWelcomePage }: { isInWelcomePage?: boolean; }) => {
+ const { t } = useTranslation();
+ const dispatch = useDispatch();
+
+ const { displayName: reduxDisplayName, email: reduxEmail } = useSelector(
+ (state: IReduxState) => state['features/base/settings']
+ );
+ const participant = useSelector((state: IReduxState) => getLocalParticipant(state));
+
+ const [ displayName, setDisplayName ] = useState(reduxDisplayName);
+ const [ email, setEmail ] = useState(reduxEmail);
+
+ const onDisplayNameChanged = useCallback(newDisplayName => {
+ setDisplayName(newDisplayName);
+ }, [ setDisplayName ]);
+
+ const onEmailChanged = useCallback(newEmail => {
+ setEmail(newEmail);
+ }, [ setEmail ]);
+
+ const onApplySettings = useCallback(() => {
+ dispatch(updateSettings({
+ displayName,
+ email
+ }));
+
+ navigate(screen.settings.main);
+ },
+ [ dispatch, updateSettings, email, displayName ]);
+
+ return (
+ <JitsiScreen
+ disableForcedKeyboardDismiss = { true }
+
+ // @ts-ignore
+ safeAreaInsets = { [ !isInWelcomePage && 'bottom', 'left', 'right' ].filter(Boolean) }
+ style = { styles.settingsViewContainer }>
+ <ScrollView
+ bounces = { isInWelcomePage }
+ contentContainerStyle = { styles.profileView as ViewStyle }>
+ <View>
+ <View style = { styles.avatarContainer as ViewStyle }>
+ <Avatar
+ participantId = { participant?.id }
+ size = { AVATAR_SIZE } />
+ </View>
+ <FormSection>
+ <Input
+ customStyles = {{ container: styles.customContainer }}
+ label = { t('settingsView.displayName') }
+ onChange = { onDisplayNameChanged }
+ placeholder = { t('settingsView.displayNamePlaceholderText') }
+ textContentType = { 'name' } // iOS only
+ value = { displayName ?? '' } />
+ <Input
+ autoCapitalize = 'none'
+ customStyles = {{ container: styles.customContainer }}
+ keyboardType = { 'email-address' }
+ label = { t('settingsView.email') }
+ onChange = { onEmailChanged }
+ placeholder = { t('settingsView.emailPlaceholderText') }
+ textContentType = { 'emailAddress' } // iOS only
+ value = { email ?? '' } />
+ <Text style = { styles.gavatarMessageContainer }>
+ { t('settingsView.gavatarMessage') }
+ </Text>
+ </FormSection>
+ </View>
+ <Button
+ accessibilityLabel = { t('settingsView.apply') }
+ labelKey = { 'settingsView.apply' }
+ onClick = { onApplySettings }
+ style = { styles.applyProfileSettingsButton }
+ type = { BUTTON_TYPES.PRIMARY } />
+ </ScrollView>
+ </JitsiScreen>
+
+ );
+};
+
+export default ProfileView;
diff --git a/react/features/settings/components/native/SettingsView.tsx b/react/features/settings/components/native/SettingsView.tsx
index bb8a8b320f..baca998746 100644
--- a/react/features/settings/components/native/SettingsView.tsx
+++ b/react/features/settings/components/native/SettingsView.tsx
@@ -1,110 +1,42 @@
-import _ from 'lodash';
import React, { Component } from 'react';
import { WithTranslation } from 'react-i18next';
import {
- Alert,
- Linking,
- NativeModules,
- Platform,
ScrollView,
Text,
+ TouchableHighlight,
View,
ViewStyle
} from 'react-native';
import { Divider } from 'react-native-paper';
import { connect } from 'react-redux';
-import { getDefaultURL } from '../../../app/functions.native';
import { IReduxState, IStore } from '../../../app/types';
import Avatar from '../../../base/avatar/components/Avatar';
-import { getLegalUrls } from '../../../base/config/functions.native';
import { translate } from '../../../base/i18n/functions';
+import Icon from '../../../base/icons/components/Icon';
+import { IconArrowRight } from '../../../base/icons/svg';
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
import { getLocalParticipant } from '../../../base/participants/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';
-import { BUTTON_TYPES } from '../../../base/ui/constants.any';
-import { AVATAR_SIZE } from '../../../welcome/components/styles';
-import { isServerURLChangeEnabled, normalizeUserInputURL } from '../../functions.native';
-
-import FormRow from './FormRow';
-import FormSection from './FormSection';
+import { navigate } from '../../../mobile/navigation/components/settings/SettingsNavigationContainerRef';
+import { screen } from '../../../mobile/navigation/routes';
+import { shouldShowModeratorSettings } from '../../functions.native';
+
+import AdvancedSection from './AdvancedSection';
+import ConferenceSection from './ConferenceSection';
+import GeneralSection from './GeneralSection';
+import LinksSection from './LinksSection';
+import ModeratorSection from './ModeratorSection';
+import NotificationsSection from './NotificationsSection';
+import { AVATAR_SIZE } from './constants';
import styles from './styles';
-/**
- * Application information module.
- */
-const { AppInfo } = NativeModules;
-
-interface IState {
-
- /**
- * State variable for the disable call integration switch.
- */
- disableCallIntegration?: boolean;
-
- /**
- * State variable for the disable crash reporting switch.
- */
- disableCrashReporting?: boolean;
-
- /**
- * State variable for the disable p2p switch.
- */
- disableP2P?: boolean;
-
- /**
- * Whether the self view is disabled or not.
- */
- disableSelfView?: boolean;
-
- /**
- * State variable for the display name field.
- */
- displayName?: string;
-
- /**
- * State variable for the email field.
- */
- email?: string;
-
- /**
- * State variable for the server URL field.
- */
- serverURL?: string;
-
- /**
- * State variable for start car mode.
- */
- startCarMode?: boolean;
-
- /**
- * State variable for the start with audio muted switch.
- */
- startWithAudioMuted?: boolean;
-
- /**
- * State variable for the start with video muted switch.
- */
- startWithVideoMuted?: boolean;
-}
-
/**
* The type of the React {@code Component} props of
* {@link SettingsView}.
*/
interface IProps extends WithTranslation {
- /**
- * The legal URL's.
- */
- _legalUrls: {
- helpCentre: string;
- privacy: string;
- terms: string;
- };
+ _displayName?: string;
/**
* The ID of the local participant.
@@ -112,34 +44,9 @@ interface IProps extends WithTranslation {
_localParticipantId?: string;
/**
- * The default URL for when there is no custom URL set in the settings.
- *
- * @protected
+ * Flag indicating whether the moderator settings are available.
*/
- _serverURL: string;
-
- /**
- * Flag indicating if URL can be changed by user.
- *
- * @protected
- */
- _serverURLChangeEnabled: boolean;
-
- /**
- * The current settings object.
- */
- _settings: {
- disableCallIntegration?: boolean;
- disableCrashReporting?: boolean;
- disableP2P?: boolean;
- disableSelfView?: boolean;
- displayName?: string;
- email?: string;
- serverURL?: string;
- startCarMode?: boolean;
- startWithAudioMuted?: boolean;
- startWithVideoMuted?: boolean;
- };
+ _showModeratorSettings: boolean;
/**
* Whether {@link SettingsView} is visible.
@@ -148,105 +55,35 @@ interface IProps extends WithTranslation {
*/
_visible?: boolean;
- /**
- * Add bottom padding to the screen.
- */
- addBottomInset?: boolean;
-
/**
* Redux store dispatch function.
*/
dispatch: IStore['dispatch'];
/**
- * Default prop for navigating between screen components(React Navigation).
+ * Flag indicating whether the settings is launched inside welcome page.
*/
- navigation?: Object;
+ isInWelcomePage?: boolean;
/**
- * Bounce when scrolling.
+ * Default prop for navigating between screen components(React Navigation).
*/
- scrollBounces?: boolean;
+ navigation?: Object;
}
/**
* The native container rendering the app settings page.
*/
-class SettingsView extends Component<IProps, IState> {
+class SettingsView extends Component<IProps> {
_urlField: Object;
/**
+ * Opens the profile settings screen.
*
- * Initializes a new {@code SettingsView} instance.
- *
- * @inheritdoc
- */
- constructor(props: IProps) {
- super(props);
-
- const {
- disableCallIntegration,
- disableCrashReporting,
- disableP2P,
- disableSelfView,
- displayName,
- email,
- serverURL,
- startCarMode,
- startWithAudioMuted,
- startWithVideoMuted
- } = props._settings || {};
-
- this.state = {
- disableCallIntegration,
- disableCrashReporting,
- disableP2P,
- disableSelfView,
- displayName: displayName || '',
- email: email || '',
- serverURL: serverURL || '',
- startCarMode,
- startWithAudioMuted,
- startWithVideoMuted
- };
-
- // Bind event handlers so they are only bound once per instance.
- this._onBlurServerURL = this._onBlurServerURL.bind(this);
- this._onChangeDisplayName = this._onChangeDisplayName.bind(this);
- this._onChangeEmail = this._onChangeEmail.bind(this);
- this._onChangeServerURL = this._onChangeServerURL.bind(this);
- this._onClose = this._onClose.bind(this);
- this._onDisableCallIntegration = this._onDisableCallIntegration.bind(this);
- this._onDisableCrashReporting = this._onDisableCrashReporting.bind(this);
- this._onDisableP2P = this._onDisableP2P.bind(this);
- this._onDisableSelfView = this._onDisableSelfView.bind(this);
- this._onStartAudioMutedChange
- = this._onStartAudioMutedChange.bind(this);
- this._onStartCarmodeInLowBandwidthMode
- = this._onStartCarmodeInLowBandwidthMode.bind(this);
- 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);
- }
-
- /**
- * Updates and syncs settings.
- *
- * @inheritdoc
* @returns {void}
*/
- componentDidUpdate(prevProps: IProps) {
- const { _settings } = this.props;
-
- if (!_.isEqual(prevProps._settings, _settings)) {
- // @ts-ignore
- // eslint-disable-next-line react/no-did-update-set-state
- this.setState(_settings);
- }
+ _onPressProfile() {
+ navigate(screen.settings.profile);
}
/**
@@ -257,24 +94,17 @@ class SettingsView extends Component<IProps, IState> {
*/
render() {
const {
- disableCallIntegration,
- disableCrashReporting,
- disableP2P,
- disableSelfView,
- displayName,
- email,
- serverURL,
- startCarMode,
- startWithAudioMuted,
- startWithVideoMuted
- } = this.state;
+ _displayName
+ } = this.props;
const {
- addBottomInset = false,
- scrollBounces = false,
- t
+ isInWelcomePage,
+ _showModeratorSettings
} = this.props;
+ const addBottomInset = !isInWelcomePage;
+ const scrollBounces = Boolean(isInWelcomePage);
+
return (
<JitsiScreen
disableForcedKeyboardDismiss = { true }
@@ -283,484 +113,49 @@ class SettingsView extends Component<IProps, IState> {
safeAreaInsets = { [ addBottomInset && 'bottom', 'left', 'right' ].filter(Boolean) }
style = { styles.settingsViewContainer }>
<ScrollView bounces = { scrollBounces }>
- <View style = { styles.avatarContainer as ViewStyle }>
- <Avatar
- participantId = { this.props._localParticipantId }
- size = { AVATAR_SIZE } />
+ <View style = { styles.profileContainerWrapper }>
+ <TouchableHighlight onPress = { this._onPressProfile }>
+ <View
+ style = { styles.profileContainer as ViewStyle }>
+ <Avatar
+ participantId = { this.props._localParticipantId }
+ size = { AVATAR_SIZE } />
+ <Text style = { styles.displayName }>
+ { _displayName }
+ </Text>
+ <Icon
+ size = { 24 }
+ src = { IconArrowRight }
+ style = { styles.profileViewArrow } />
+ </View>
+ </TouchableHighlight>
</View>
- <FormSection
- label = 'settingsView.profileSection'>
- <Input
- customStyles = {{ container: styles.customContainer }}
- label = { t('settingsView.displayName') }
- onChange = { this._onChangeDisplayName }
- placeholder = { t('settingsView.displayNamePlaceholderText') }
- textContentType = { 'name' } // iOS only
- value = { displayName ?? '' } />
- {/* @ts-ignore */}
- <Divider style = { styles.fieldSeparator } />
- <Input
- autoCapitalize = 'none'
- customStyles = {{ container: styles.customContainer }}
- keyboardType = { 'email-address' }
- label = { t('settingsView.email') }
- onChange = { this._onChangeEmail }
- placeholder = { t('settingsView.emailPlaceholderText') }
- textContentType = { 'emailAddress' } // iOS only
- value = { email ?? '' } />
- </FormSection>
- <FormSection
- label = 'settingsView.conferenceSection'>
- <Input
- autoCapitalize = 'none'
- customStyles = {{ container: styles.customContainer }}
- editable = { this.props._serverURLChangeEnabled }
- keyboardType = { 'url' }
- label = { t('settingsView.serverURL') }
- onBlur = { this._onBlurServerURL }
- onChange = { this._onChangeServerURL }
- placeholder = { this.props._serverURL }
- textContentType = { 'URL' } // iOS only
- value = { serverURL ?? '' } />
+ <GeneralSection />
+ { isInWelcomePage && <>
{/* @ts-ignore */}
<Divider style = { styles.fieldSeparator } />
- <FormRow label = 'settingsView.startCarModeInLowBandwidthMode'>
- <Switch
- checked = { Boolean(startCarMode) }
- onChange = { this._onStartCarmodeInLowBandwidthMode } />
- </FormRow>
- {/* @ts-ignore */}
- <Divider style = { styles.fieldSeparator } />
- <FormRow
- label = 'settingsView.startWithAudioMuted'>
- <Switch
- checked = { Boolean(startWithAudioMuted) }
- onChange = { this._onStartAudioMutedChange } />
- </FormRow>
- {/* @ts-ignore */}
- <Divider style = { styles.fieldSeparator } />
- <FormRow label = 'settingsView.startWithVideoMuted'>
- <Switch
- checked = { Boolean(startWithVideoMuted) }
- onChange = { this._onStartVideoMutedChange } />
- </FormRow>
- {/* @ts-ignore */}
- <Divider style = { styles.fieldSeparator } />
- <FormRow label = 'videothumbnail.hideSelfView'>
- <Switch
- checked = { Boolean(disableSelfView) }
- onChange = { this._onDisableSelfView } />
- </FormRow>
- </FormSection>
- <FormSection
- label = 'settingsView.links'>
- <Button
- accessibilityLabel = 'settingsView.help'
- labelKey = 'settingsView.help'
- onClick = { this._onShowHelpPressed }
- style = { styles.linksButton }
- type = { BUTTON_TYPES.TERTIARY } />
- {/* @ts-ignore */}
- <Divider style = { styles.fieldSeparator } />
- <Button
- accessibilityLabel = 'settingsView.terms'
- labelKey = 'settingsView.terms'
- onClick = { this._onShowTermsPressed }
- style = { styles.linksButton }
- type = { BUTTON_TYPES.TERTIARY } />
- {/* @ts-ignore */}
- <Divider style = { styles.fieldSeparator } />
- <Button
- accessibilityLabel = 'settingsView.privacy'
- labelKey = 'settingsView.privacy'
- onClick = { this._onShowPrivacyPressed }
- style = { styles.linksButton }
- type = { BUTTON_TYPES.TERTIARY } />
- </FormSection>
- <FormSection
- label = 'settingsView.buildInfoSection'>
- <FormRow
- label = 'settingsView.version'>
- <Text style = { styles.text }>
- {`${AppInfo.version} build ${AppInfo.buildNumber}`}
- </Text>
- </FormRow>
- {/* @ts-ignore */}
- <Divider style = { styles.fieldSeparator } />
- <FormRow
- label = 'settingsView.sdkVersion'>
- <Text style = { styles.text }>
- {AppInfo.sdkVersion}
- </Text>
- </FormRow>
- </FormSection>
- <FormSection
- label = 'settingsView.advanced'>
- { Platform.OS === 'android' && (
- <>
- <FormRow
- label = 'settingsView.disableCallIntegration'>
- <Switch
- checked = { Boolean(disableCallIntegration) }
- onChange = { this._onDisableCallIntegration } />
- </FormRow>
- {/* @ts-ignore */}
- <Divider style = { styles.fieldSeparator } />
- </>
- )}
- <FormRow
- label = 'settingsView.disableP2P'>
- <Switch
- checked = { Boolean(disableP2P) }
- onChange = { this._onDisableP2P } />
- </FormRow>
- {/* @ts-ignore */}
- <Divider style = { styles.fieldSeparator } />
- {AppInfo.GOOGLE_SERVICES_ENABLED && (
- <FormRow
- fieldSeparator = { true }
- label = 'settingsView.disableCrashReporting'>
- <Switch
- checked = { Boolean(disableCrashReporting) }
- onChange = { this._onDisableCrashReporting } />
- </FormRow>
- )}
- </FormSection>
+ <ConferenceSection />
+ </> }
+ {/* @ts-ignore */}
+ <Divider style = { styles.fieldSeparator } />
+ <NotificationsSection />
+
+ { _showModeratorSettings
+ && <>
+ {/* @ts-ignore */}
+ <Divider style = { styles.fieldSeparator } />
+ <ModeratorSection />
+ </> }
+ {/* @ts-ignore */}
+ <Divider style = { styles.fieldSeparator } />
+ <AdvancedSection />
+ {/* @ts-ignore */}
+ <Divider style = { styles.fieldSeparator } />
+ <LinksSection />
</ScrollView>
</JitsiScreen>
);
}
-
- /**
- * 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 */);
- }
-
- /**
- * Handles the display name field value change.
- *
- * @param {string} displayName - The value typed in the name field.
- * @protected
- * @returns {void}
- */
- _onChangeDisplayName(displayName: string) {
- this.setState({
- displayName
- });
-
- this._updateSettings({
- displayName
- });
- }
-
- /**
- * Handles the email field value change.
- *
- * @param {string} email - The value typed in the email field.
- * @protected
- * @returns {void}
- */
- _onChangeEmail(email: string) {
- this.setState({
- email
- });
-
- this._updateSettings({
- email
- });
- }
-
- /**
- * Handles the server name field value change.
- *
- * @param {string} serverURL - The server URL typed in the server field.
- * @protected
- * @returns {void}
- */
- _onChangeServerURL(serverURL: string) {
- this.setState({
- serverURL
- });
-
- this._updateSettings({
- serverURL
- });
- }
-
- /**
- * Handles the disable call integration change event.
- *
- * @param {boolean} disableCallIntegration - The new value
- * option.
- * @private
- * @returns {void}
- */
- _onDisableCallIntegration(disableCallIntegration?: boolean) {
- this.setState({
- disableCallIntegration
- });
-
- this._updateSettings({
- disableCallIntegration
- });
- }
-
- /**
- * Handles the disable P2P change event.
- *
- * @param {boolean} disableP2P - The new value
- * option.
- * @private
- * @returns {void}
- */
- _onDisableP2P(disableP2P?: boolean) {
- this.setState({
- disableP2P
- });
-
- this._updateSettings({
- disableP2P
- });
- }
-
- /** .
- * 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
- });
- }
-
- /** .
- * 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
- });
- }
-
- /**
- * Handles the disable crash reporting change event.
- *
- * @param {boolean} disableCrashReporting - The new value
- * option.
- * @private
- * @returns {void}
- */
- _onDisableCrashReporting(disableCrashReporting?: boolean) {
- if (disableCrashReporting) {
- this._showCrashReportingDisableAlert();
- } else {
- this._disableCrashReporting(Boolean(disableCrashReporting));
- }
- }
-
- /**
- * Callback to be invoked on closing the modal. Also invokes normalizeUserInputURL to validate
- * the URL entered by the user.
- *
- * @returns {boolean} - True if the modal can be closed.
- */
- _onClose() {
- return this._processServerURL(true /* hideOnSuccess */);
- }
-
- /**
- * Handles the start audio muted change event.
- *
- * @param {boolean} startWithAudioMuted - The new value for the start audio muted
- * option.
- * @protected
- * @returns {void}
- */
- _onStartAudioMutedChange(startWithAudioMuted?: boolean) {
- this.setState({
- startWithAudioMuted
- });
-
- this._updateSettings({
- startWithAudioMuted
- });
- }
-
- /**
- * Handles the start video muted change event.
- *
- * @param {boolean} startWithVideoMuted - The new value for the start video muted
- * option.
- * @protected
- * @returns {void}
- */
- _onStartVideoMutedChange(startWithVideoMuted?: boolean) {
- this.setState({
- startWithVideoMuted
- });
-
- this._updateSettings({
- startWithVideoMuted
- });
- }
-
- /**
- * 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) {
- // @ts-ignore
- const { serverURL } = this.props._settings;
- const normalizedURL = normalizeUserInputURL(serverURL ?? '');
-
- if (normalizedURL === null) {
- this._showURLAlert();
-
- return false;
- }
-
- this._onChangeServerURL(normalizedURL);
-
- return hideOnSuccess;
- }
-
- /**
- * Stores a reference to the URL field for later use.
- *
- * @param {Object} component - The field component.
- * @protected
- * @returns {void}
- */
- _setURLFieldReference(component: object) {
- 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'),
- [
- {
- // @ts-ignore
- onPress: () => this._urlField.focus(),
- text: t('settingsView.alertOk')
- }
- ]
- );
- }
-
- /**
- * Opens the help url into the browser.
- *
- * @returns {void}
- */
- _onShowHelpPressed() {
- Linking.openURL(this.props._legalUrls.helpCentre);
- }
-
- /**
- * Opens the privacy url into the browser.
- *
- * @returns {void}
- */
- _onShowPrivacyPressed() {
- Linking.openURL(this.props._legalUrls.privacy);
- }
-
- /**
- * Opens the terms url into the browser.
- *
- * @returns {void}
- */
- _onShowTermsPressed() {
- Linking.openURL(this.props._legalUrls.terms);
- }
-
- /**
- * 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}
- */
- _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));
- }
}
/**
@@ -773,12 +168,10 @@ function _mapStateToProps(state: IReduxState) {
const localParticipant = getLocalParticipant(state);
return {
- _legalUrls: getLegalUrls(state),
_localParticipantId: localParticipant?.id,
- _serverURL: getDefaultURL(state),
- _serverURLChangeEnabled: isServerURLChangeEnabled(state),
- _settings: state['features/base/settings'],
- _visible: state['features/settings'].visible
+ _displayName: state['features/base/settings'].displayName,
+ _visible: state['features/settings'].visible,
+ _showModeratorSettings: shouldShowModeratorSettings(state)
};
}
diff --git a/react/features/settings/components/native/constants.ts b/react/features/settings/components/native/constants.ts
new file mode 100644
index 0000000000..457172e9d1
--- /dev/null
+++ b/react/features/settings/components/native/constants.ts
@@ -0,0 +1 @@
+export const AVATAR_SIZE = 64;
diff --git a/react/features/settings/components/native/styles.ts b/react/features/settings/components/native/styles.ts
index d13ae58f31..a7c59b28cd 100644
--- a/react/features/settings/components/native/styles.ts
+++ b/react/features/settings/components/native/styles.ts
@@ -3,19 +3,60 @@ import BaseTheme from '../../../base/ui/components/BaseTheme.native';
export const ANDROID_UNDERLINE_COLOR = 'transparent';
export const PLACEHOLDER_COLOR = BaseTheme.palette.focus01;
-const TEXT_SIZE = 14;
-
-
/**
* The styles of the native components of the feature {@code settings}.
*/
export default {
- avatarContainer: {
+ profileContainerWrapper: {
+ margin: BaseTheme.spacing[4]
+ },
+
+ profileContainer: {
+ backgroundColor: BaseTheme.palette.ui02,
+ borderRadius: BaseTheme.shape.borderRadius,
alignItems: 'center',
+ flexDirection: 'row',
+ justifyContent: 'flex-start',
+ padding: BaseTheme.spacing[3]
+ },
+
+ profileView: {
+ flexGrow: 1,
flexDirection: 'column',
- height: 180,
- justifyContent: 'center'
+ justifyContent: 'space-between'
+ },
+
+ applyProfileSettingsButton: {
+ marginHorizontal: BaseTheme.spacing[4],
+ marginVertical: BaseTheme.spacing[3]
+ },
+
+ avatarContainer: {
+ alignItems: 'center',
+ flexDirection: 'row',
+ justifyContent: 'center',
+ padding: BaseTheme.spacing[3],
+ margin: BaseTheme.spacing[4]
+ },
+
+ gavatarMessageContainer: {
+ marginHorizontal: BaseTheme.spacing[4],
+ color: BaseTheme.palette.text02,
+ marginTop: -BaseTheme.spacing[2],
+ ...BaseTheme.typography.bodyShortRegular
+ },
+
+ displayName: {
+ ...BaseTheme.typography.bodyLongRegularLarge,
+ color: BaseTheme.palette.text01,
+ marginLeft: BaseTheme.spacing[3],
+ position: 'relative'
+ },
+
+ profileViewArrow: {
+ position: 'absolute',
+ right: BaseTheme.spacing[3]
},
/**
@@ -50,29 +91,25 @@ export default {
fieldLabelContainer: {
alignItems: 'center',
flexDirection: 'row',
- paddingLeft: 8
+ flex: 3,
+ paddingLeft: BaseTheme.spacing[3]
},
/**
* Text of the field labels on the form.
*/
fieldLabelText: {
- fontSize: TEXT_SIZE
- },
-
- /**
- * Appended style for column layout fields.
- */
- fieldLabelTextColumn: {
- fontSize: 12
+ ...BaseTheme.typography.bodyShortRegularLarge
},
/**
* Field container style for all but last row {@code View}.
*/
fieldSeparator: {
+ marginHorizontal: BaseTheme.spacing[4],
borderBottomWidth: 1,
- borderColor: BaseTheme.palette.ui05
+ borderColor: BaseTheme.palette.ui05,
+ marginVertical: BaseTheme.spacing[3]
},
/**
@@ -84,7 +121,7 @@ export default {
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end',
- paddingRight: 8
+ paddingRight: BaseTheme.spacing[3]
},
/**
@@ -97,10 +134,10 @@ export default {
},
formSectionTitleText: {
- ...BaseTheme.typography.bodyShortRegular,
- color: BaseTheme.palette.text01,
- opacity: 0.6,
- textAlign: 'center'
+ ...BaseTheme.typography.bodyShortBold,
+ color: BaseTheme.palette.text02,
+ marginHorizontal: BaseTheme.spacing[4],
+ marginVertical: BaseTheme.spacing[3]
},
/**
@@ -115,17 +152,42 @@ export default {
*/
customContainer: {
marginBottom: BaseTheme.spacing[3],
- marginHorizontal: BaseTheme.spacing[3],
+ marginHorizontal: BaseTheme.spacing[4],
marginTop: BaseTheme.spacing[2]
},
+ languageButton: {
+ display: 'flex',
+ flexDirection: 'row'
+ },
+
+ languageOption: {
+ display: 'flex',
+ flexDirection: 'row',
+ alignItems: 'center',
+ height: BaseTheme.spacing[6],
+ marginHorizontal: BaseTheme.spacing[4],
+ borderBottomWidth: 1,
+ borderColor: BaseTheme.palette.ui05
+ },
+
+ selectedLanguage: {
+ color: BaseTheme.palette.text03
+ },
+
+ languageText: {
+ ...BaseTheme.typography.bodyShortRegularLarge,
+ color: BaseTheme.palette.text01,
+ marginRight: BaseTheme.spacing[3]
+ },
+
/**
* Standard text input field style.
*/
textInputField: {
color: BaseTheme.palette.field01,
flex: 1,
- fontSize: TEXT_SIZE,
+ ...BaseTheme.typography.bodyShortRegularLarge,
textAlign: 'right'
},
@@ -147,9 +209,18 @@ export default {
flex: 1
},
+ linksSection: {
+ display: 'flex',
+ flexDirection: 'row',
+ flex: 1,
+ marginHorizontal: BaseTheme.spacing[3]
+ },
+
linksButton: {
- alignSelf: 'center',
- maxWidth: 400,
- width: 'auto'
+ width: '33%',
+ justifyContent: 'center',
+ flexDirection: 'row',
+ alignItems: 'center',
+ ...BaseTheme.typography.bodyShortBoldLarge
}
};
diff --git a/react/features/settings/functions.any.ts b/react/features/settings/functions.any.ts
index 3099d999c0..d9f590b281 100644
--- a/react/features/settings/functions.any.ts
+++ b/react/features/settings/functions.any.ts
@@ -5,29 +5,17 @@ import { SERVER_URL_CHANGE_ENABLED } from '../base/flags/constants';
import { getFeatureFlag } from '../base/flags/functions';
import i18next, { DEFAULT_LANGUAGE, LANGUAGES } from '../base/i18n/i18next';
import {
- getLocalParticipant,
- isLocalParticipantModerator
+ getLocalParticipant
} from '../base/participants/functions';
import { toState } from '../base/redux/functions';
import { getHideSelfView } from '../base/settings/functions';
import { parseStandardURIString } from '../base/util/uri';
import { isStageFilmstripEnabled } from '../filmstrip/functions';
import { isFollowMeActive } from '../follow-me/functions';
-import { getParticipantsPaneConfig } from '../participants-pane/functions';
import { isReactionsEnabled } from '../reactions/functions.any';
import { iAmVisitor } from '../visitors/functions';
-/**
- * Used for web. Indicates if the setting section is enabled.
- *
- * @param {string} settingName - The name of the setting section as defined in
- * interface_config.js and SettingsMenu.js.
- * @returns {boolean} True to indicate that the given setting section
- * is enabled, false otherwise.
- */
-export function isSettingEnabled(settingName: string) {
- return interfaceConfig.SETTINGS_SECTIONS.includes(settingName);
-}
+import { shouldShowModeratorSettings } from './functions';
/**
* Returns true if user is allowed to change Server URL.
@@ -84,7 +72,7 @@ export function normalizeUserInputURL(url: string) {
* {@code getState} function to be used to retrieve the state.
* @returns {Object} - The section of notifications to be configured.
*/
-export function getNotificationsMap(stateful: IStateful) {
+export function getNotificationsMap(stateful: IStateful): { [key: string]: boolean; } {
const state = toState(stateful);
const { notifications } = state['features/base/config'];
const { userSelectedNotifications } = state['features/base/settings'];
@@ -167,21 +155,6 @@ export function getModeratorTabProps(stateful: IStateful) {
};
}
-/**
- * Returns true if moderator tab in settings should be visible/accessible.
- *
- * @param {(Function|Object)} stateful - The (whole) redux state, or redux's
- * {@code getState} function to be used to retrieve the state.
- * @returns {boolean} True to indicate that moderator tab should be visible, false otherwise.
- */
-export function shouldShowModeratorSettings(stateful: IStateful) {
- const state = toState(stateful);
- const { hideModeratorSettingsTab } = getParticipantsPaneConfig(state);
- const hasModeratorRights = Boolean(isSettingEnabled('moderator') && isLocalParticipantModerator(state));
-
- return hasModeratorRights && !hideModeratorSettingsTab;
-}
-
/**
* Returns the properties for the "Profile" tab from settings dialog from Redux
* state.
diff --git a/react/features/settings/functions.native.ts b/react/features/settings/functions.native.ts
index f4320446fc..cfba19948d 100644
--- a/react/features/settings/functions.native.ts
+++ b/react/features/settings/functions.native.ts
@@ -1,3 +1,8 @@
+import { IStateful } from '../base/app/types';
+import { isLocalParticipantModerator } from '../base/participants/functions';
+import { toState } from '../base/redux/functions';
+import { getParticipantsPaneConfig } from '../participants-pane/functions';
+
export * from './functions.any';
/**
@@ -16,3 +21,18 @@ export function getShortcutsTabProps(_stateful: any, _isDisplayedOnWelcomePage?:
keyboardShortcutsEnabled: false
};
}
+
+/**
+ * Returns true if moderator tab in settings should be visible/accessible.
+ *
+ * @param {(Function|Object)} stateful - The (whole) redux state, or redux's
+ * {@code getState} function to be used to retrieve the state.
+ * @returns {boolean} True to indicate that moderator tab should be visible, false otherwise.
+ */
+export function shouldShowModeratorSettings(stateful: IStateful) {
+ const state = toState(stateful);
+ const { hideModeratorSettingsTab } = getParticipantsPaneConfig(state);
+ const hasModeratorRights = isLocalParticipantModerator(state);
+
+ return hasModeratorRights && !hideModeratorSettingsTab;
+}
diff --git a/react/features/settings/functions.web.ts b/react/features/settings/functions.web.ts
index 99784aadd8..2e16ad8f75 100644
--- a/react/features/settings/functions.web.ts
+++ b/react/features/settings/functions.web.ts
@@ -1,8 +1,10 @@
import { IStateful } from '../base/app/types';
import { createLocalTrack } from '../base/lib-jitsi-meet/functions';
+import { isLocalParticipantModerator } from '../base/participants/functions';
import { toState } from '../base/redux/functions';
import { getUserSelectedCameraDeviceId } from '../base/settings/functions.web';
import { areKeyboardShortcutsEnabled, getKeyboardShortcutsHelpDescriptions } from '../keyboard-shortcuts/functions';
+import { getParticipantsPaneConfig } from '../participants-pane/functions';
import { isPrejoinPageVisible } from '../prejoin/functions';
export * from './functions.any';
@@ -115,3 +117,31 @@ export function getVirtualBackgroundTabProps(stateful: IStateful, isDisplayedOnW
selectedVideoInputId
};
}
+
+/**
+ * Used for web. Indicates if the setting section is enabled.
+ *
+ * @param {string} settingName - The name of the setting section as defined in
+ * interface_config.js and SettingsMenu.js.
+ * @returns {boolean} True to indicate that the given setting section
+ * is enabled, false otherwise.
+ */
+export function isSettingEnabled(settingName: string) {
+ return interfaceConfig.SETTINGS_SECTIONS.includes(settingName);
+}
+
+
+/**
+ * Returns true if moderator tab in settings should be visible/accessible.
+ *
+ * @param {(Function|Object)} stateful - The (whole) redux state, or redux's
+ * {@code getState} function to be used to retrieve the state.
+ * @returns {boolean} True to indicate that moderator tab should be visible, false otherwise.
+ */
+export function shouldShowModeratorSettings(stateful: IStateful) {
+ const state = toState(stateful);
+ const { hideModeratorSettingsTab } = getParticipantsPaneConfig(state);
+ const hasModeratorRights = Boolean(isSettingEnabled('moderator') && isLocalParticipantModerator(state));
+
+ return hasModeratorRights && !hideModeratorSettingsTab;
+}