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(base/flags): created flag to control unsafe room warning (#13560)

Calinteodor63761d515a9e
diff --git a/react/features/app/actions.native.ts b/react/features/app/actions.native.ts
index 98c61e1eb3..9cf7054d86 100644
--- a/react/features/app/actions.native.ts
+++ b/react/features/app/actions.native.ts
@@ -8,10 +8,10 @@ import {
import {
createFakeConfig,
restoreConfig
-} from '../base/config/functions';
-import { connect, disconnect, setLocationURL } from '../base/connection/actions';
+} from '../base/config/functions.native';
+import { connect, disconnect, setLocationURL } from '../base/connection/actions.native';
import { loadConfig } from '../base/lib-jitsi-meet/functions.native';
-import { createDesiredLocalTracks } from '../base/tracks/actions';
+import { createDesiredLocalTracks } from '../base/tracks/actions.native';
import isInsecureRoomName from '../base/util/isInsecureRoomName';
import { parseURLParams } from '../base/util/parseURLParams';
import {
@@ -27,6 +27,7 @@ import {
} from '../mobile/navigation/rootNavigationContainerRef';
import { screen } from '../mobile/navigation/routes';
import { clearNotifications } from '../notifications/actions';
+import { isUnsafeRoomWarningEnabled } from '../prejoin/functions';
import { addTrackStateToURL, getDefaultURL } from './functions.native';
import logger from './logger';
@@ -137,7 +138,7 @@ export function appNavigate(uri?: string, options: IReloadNowOptions = {}) {
dispatch(setRoom(room));
if (room) {
- if (isInsecureRoomName(room)) {
+ if (isUnsafeRoomWarningEnabled(getState()) && isInsecureRoomName(room)) {
navigateRoot(screen.unsafeRoomWarning);
return;
diff --git a/react/features/base/flags/constants.ts b/react/features/base/flags/constants.ts
index 906fc4ceeb..38b8293328 100644
--- a/react/features/base/flags/constants.ts
+++ b/react/features/base/flags/constants.ts
@@ -243,6 +243,12 @@ export const TOOLBOX_ALWAYS_VISIBLE = 'toolbox.alwaysVisible';
*/
export const TOOLBOX_ENABLED = 'toolbox.enabled';
+/**
+ * Flag indicating if the unsafe room warning should be enabled.
+ * Default: disabled (false).
+ */
+export const UNSAFE_ROOM_WARNING = 'unsaferoomwarning.enabled';
+
/**
* Flag indicating if the video mute button should be displayed.
* Default: enabled (true).
diff --git a/react/features/mobile/navigation/components/RootNavigationContainer.tsx b/react/features/mobile/navigation/components/RootNavigationContainer.tsx
index 0fc7fc87c1..47e8b76192 100644
--- a/react/features/mobile/navigation/components/RootNavigationContainer.tsx
+++ b/react/features/mobile/navigation/components/RootNavigationContainer.tsx
@@ -8,6 +8,7 @@ import { IReduxState, IStore } from '../../../app/types';
import DialInSummary from '../../../invite/components/dial-in-summary/native/DialInSummary';
import Prejoin from '../../../prejoin/components/native/Prejoin';
import UnsafeRoomWarning from '../../../prejoin/components/native/UnsafeRoomWarning';
+import { isUnsafeRoomWarningEnabled } from '../../../prejoin/functions';
// eslint-disable-next-line
// @ts-ignore
import WelcomePage from '../../../welcome/components/WelcomePage';
@@ -39,6 +40,11 @@ interface IProps {
*/
dispatch: IStore['dispatch'];
+ /**
+ * Is unsafe room warning available?
+ */
+ isUnsafeRoomWarningAvailable: boolean;
+
/**
* Is welcome page available?
*/
@@ -46,7 +52,7 @@ interface IProps {
}
-const RootNavigationContainer = ({ dispatch, isWelcomePageAvailable }: IProps) => {
+const RootNavigationContainer = ({ dispatch, isUnsafeRoomWarningAvailable, isWelcomePageAvailable }: IProps) => {
const initialRouteName = isWelcomePageAvailable
? screen.welcome.main : screen.connecting;
const onReady = useCallback(() => {
@@ -92,10 +98,13 @@ const RootNavigationContainer = ({ dispatch, isWelcomePageAvailable }: IProps) =
component = { Prejoin }
name = { screen.preJoin }
options = { preJoinScreenOptions } />
- <RootStack.Screen
- component = { UnsafeRoomWarning }
- name = { screen.unsafeRoomWarning }
- options = { unsafeMeetingScreenOptions } />
+ {
+ isUnsafeRoomWarningAvailable
+ && <RootStack.Screen
+ component = { UnsafeRoomWarning }
+ name = { screen.unsafeRoomWarning }
+ options = { unsafeMeetingScreenOptions } />
+ }
<RootStack.Screen
component = { ConferenceNavigationContainer }
name = { screen.conference.root }
@@ -113,6 +122,7 @@ const RootNavigationContainer = ({ dispatch, isWelcomePageAvailable }: IProps) =
*/
function mapStateToProps(state: IReduxState) {
return {
+ isUnsafeRoomWarningAvailable: isUnsafeRoomWarningEnabled(state),
isWelcomePageAvailable: isWelcomePageEnabled(state)
};
}
diff --git a/react/features/prejoin/functions.ts b/react/features/prejoin/functions.ts
index 65fb90515c..396853155c 100644
--- a/react/features/prejoin/functions.ts
+++ b/react/features/prejoin/functions.ts
@@ -1,9 +1,12 @@
import { IReduxState } from '../app/types';
import { getRoomName } from '../base/conference/functions';
-import { getDialOutStatusUrl, getDialOutUrl } from '../base/config/functions';
+import { getDialOutStatusUrl, getDialOutUrl } from '../base/config/functions.any';
+import { UNSAFE_ROOM_WARNING } from '../base/flags/constants';
+import { getFeatureFlag } from '../base/flags/functions';
import { isAudioMuted, isVideoMutedByUser } from '../base/media/functions';
import { getLobbyConfig } from '../lobby/functions';
+
/**
* Selector for the visibility of the 'join by phone' button.
*
@@ -169,3 +172,14 @@ export function shouldAutoKnock(state: IReduxState): boolean {
|| autoKnock || (iAmRecorder && iAmSipGateway))
&& !state['features/lobby'].knocking);
}
+
+/**
+ * Returns true if the unsafe room warning flag is enabled.
+ *
+ * @param {IReduxState} stateful - The state of the app.
+ * @returns {boolean}
+ */
+export function isUnsafeRoomWarningEnabled(stateful: IReduxState): boolean {
+ return Boolean(navigator.product === 'ReactNative'
+ && getFeatureFlag(stateful, UNSAFE_ROOM_WARNING, true));
+}