jitsi-meet/react/features/base/util/getUnsafeRoomText.native.ts
theluyuan 38ba663466
Some checks failed
Close stale issues and PRs / stale (push) Has been cancelled
init
2025-09-02 14:49:16 +08:00

33 lines
1.1 KiB
TypeScript

import React from 'react';
import { Text } from 'react-native';
import { IReduxState } from '../../app/types';
import Link from '../react/components/native/Link';
import BaseTheme from '../ui/components/BaseTheme.native';
import { SECURITY_URL } from './contants';
/**
* Gets the unsafe room text for the given context.
*
* @param {IReduxState} state - The redux state.
* @param {Function} t - The translation function.
* @param {'meeting'|'prejoin'|'welcome'} context - The given context of the warning.
* @returns {Text}
*/
export default function getUnsafeRoomText(state: IReduxState, t: Function, context: 'meeting' | 'prejoin' | 'welcome') {
const securityUrl = state['features/base/config'].legalUrls?.security ?? SECURITY_URL;
const link = React.createElement(Link, {
url: securityUrl,
children: 'here',
key: 'support-link',
style: { color: BaseTheme.palette.action01 } });
const options = {
recommendAction: t(`security.unsafeRoomActions.${context}`)
};
return React.createElement(Text, { children: [ t('security.insecureRoomNameWarningNative', options), link, '.' ] });
}