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(sdk): custom server url is overwritten by sdk default url option value (#14092)

Calinteodor109b83d6f1fa
diff --git a/android/app/src/main/res/xml/app_restrictions.xml b/android/app/src/main/res/xml/app_restrictions.xml
index 150c4c7ca5..d501b9469c 100644
--- a/android/app/src/main/res/xml/app_restrictions.xml
+++ b/android/app/src/main/res/xml/app_restrictions.xml
@@ -1,11 +1,10 @@
-<?xml version="1.0" encoding="utf-8"?>
-<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
-
- <!-- Server URL configuration -->
- <restriction
- android:defaultValue="https://meet.jit.si"
- android:description="@string/restriction_server_url_description"
- android:key="SERVER_URL"
- android:restrictionType="string"
- android:title="@string/restriction_server_url_title"/>
-</restrictions>
+<?xml version="1.0" encoding="utf-8"?>
+<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <!-- Server URL configuration -->
+ <restriction
+ android:description="@string/restriction_server_url_description"
+ android:key="SERVER_URL"
+ android:restrictionType="string"
+ android:title="@string/restriction_server_url_title"/>
+</restrictions>
diff --git a/ios/app/src/AppDelegate.m b/ios/app/src/AppDelegate.m
index 634c199ea4..35e4a433d8 100644
--- a/ios/app/src/AppDelegate.m
+++ b/ios/app/src/AppDelegate.m
@@ -38,7 +38,6 @@
[builder setFeatureFlag:@"resolution" withValue:@(360)];
[builder setFeatureFlag:@"ios.screensharing.enabled" withBoolean:YES];
[builder setFeatureFlag:@"ios.recording.enabled" withBoolean:YES];
- builder.serverURL = [NSURL URLWithString:@"https://meet.jit.si"];
}];
[jitsiMeet application:application didFinishLaunchingWithOptions:launchOptions];
@@ -126,7 +125,7 @@
- (UIInterfaceOrientationMask)application:(UIApplication *)application
supportedInterfaceOrientationsForWindow:(UIWindow *)window {
- return [[JitsiMeet sharedInstance] application:application
+ return [[JitsiMeet sharedInstance] application:application
supportedInterfaceOrientationsForWindow:window];
}
diff --git a/react/features/app/components/App.native.tsx b/react/features/app/components/App.native.tsx
index e80580e61e..d018e723b8 100644
--- a/react/features/app/components/App.native.tsx
+++ b/react/features/app/components/App.native.tsx
@@ -21,6 +21,7 @@ import { AbstractApp, IProps as AbstractAppProps } from './AbstractApp';
import '../middlewares.native';
import '../reducers.native';
+
declare let __DEV__: any;
const { AppInfo } = NativeModules;
@@ -110,7 +111,7 @@ export class App extends AbstractApp<IProps> {
*/
async _extraInit() {
const { dispatch, getState } = this.state.store ?? {};
- const { flags = {} } = this.props;
+ const { flags = {}, url, userInfo } = this.props;
let callIntegrationEnabled = flags[CALL_INTEGRATION_ENABLED as keyof typeof flags];
// CallKit does not work on the simulator, make sure we disable it.
@@ -153,16 +154,18 @@ export class App extends AbstractApp<IProps> {
await rootNavigationReady;
// Update specified server URL.
- if (typeof this.props.url !== 'undefined') {
+ if (typeof url !== 'undefined') {
+
// @ts-ignore
- const { serverURL } = this.props.url;
+ const { serverURL } = url;
if (typeof serverURL !== 'undefined') {
dispatch?.(updateSettings({ serverURL }));
}
}
- dispatch?.(updateSettings(this.props.userInfo || {}));
+ // @ts-ignore
+ dispatch?.(updateSettings(userInfo || {}));
// Update settings with feature-flag.
if (typeof callIntegrationEnabled !== 'undefined') {
diff --git a/react/features/settings/components/native/ConferenceSection.tsx b/react/features/settings/components/native/ConferenceSection.tsx
index 52b8261395..51d2647986 100644
--- a/react/features/settings/components/native/ConferenceSection.tsx
+++ b/react/features/settings/components/native/ConferenceSection.tsx
@@ -1,4 +1,4 @@
-import React, { useCallback, useEffect, useMemo } from 'react';
+import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
@@ -7,7 +7,7 @@ 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 { isServerURLChangeEnabled, normalizeUserInputURL } from '../../functions.native';
import FormRow from './FormRow';
import FormSection from './FormSection';
@@ -17,7 +17,6 @@ import styles from './styles';
const ConferenceSection = () => {
const { t } = useTranslation();
const dispatch = useDispatch();
- const defaultServerURL = useSelector((state: IReduxState) => getDefaultURL(state));
const {
serverURL,
startCarMode,
@@ -25,7 +24,10 @@ const ConferenceSection = () => {
startWithVideoMuted
} = useSelector((state: IReduxState) => state['features/base/settings']);
- const { serverURLChangeEnabled } = useSelector((state: IReduxState) => isServerURLChangeEnabled(state));
+ const defaultServerURL = useSelector((state: IReduxState) => getDefaultURL(state));
+ const [ newServerURL, setNewServerURL ] = useState(serverURL ?? '');
+
+ const serverURLChangeEnabled = useSelector((state: IReduxState) => isServerURLChangeEnabled(state));
const switches = useMemo(() => [
{
@@ -45,21 +47,27 @@ const ConferenceSection = () => {
}
], [ startCarMode, startWithAudioMuted, startWithVideoMuted ]);
- const onChangeServerURL = useCallback(newServerURL => {
- dispatch(updateSettings({ serverURL: newServerURL }));
- }, [ updateSettings ]);
+ const onChangeServerURL = useCallback(value => {
+
+ setNewServerURL(value);
+ dispatch(updateSettings({
+ serverURL: value
+ }));
+ }, [ dispatch, newServerURL ]);
const processServerURL = useCallback(() => {
- const normalizedURL = normalizeUserInputURL(serverURL ?? '');
+ const normalizedURL = normalizeUserInputURL(newServerURL);
onChangeServerURL(normalizedURL);
- }, [ serverURL ]);
+ }, [ newServerURL ]);
useEffect(() => () => processServerURL(), []);
const onSwitchToggled = useCallback((name: string) => (enabled?: boolean) => {
+
+ // @ts-ignore
dispatch(updateSettings({ [name]: enabled }));
- }, [ dispatch, updateSettings ]);
+ }, [ dispatch ]);
return (
<FormSection
@@ -74,7 +82,7 @@ const ConferenceSection = () => {
onChange = { onChangeServerURL }
placeholder = { defaultServerURL }
textContentType = { 'URL' } // iOS only
- value = { serverURL ?? '' } />
+ value = { newServerURL } />
{
switches.map(({ label, state, name }) => (
<FormRow