You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

getUnsafeRoomText.native.ts 1.1KB

12345678910111213141516171819202122232425262728293031
  1. import React from 'react';
  2. import { Text } from 'react-native';
  3. import { IReduxState } from '../../app/types';
  4. import Link from '../react/components/native/Link';
  5. import BaseTheme from '../ui/components/BaseTheme.native';
  6. import { SECURITY_URL } from './contants';
  7. /**
  8. * Gets the unsafe room text for the given context.
  9. *
  10. * @param {IReduxState} state - The redux state.
  11. * @param {Function} t - The translation function.
  12. * @param {'meeting'|'prejoin'|'welcome'} context - The given context of the warining.
  13. * @returns {Text}
  14. */
  15. export default function getUnsafeRoomText(state: IReduxState, t: Function, context: 'meeting' | 'prejoin' | 'welcome') {
  16. const securityUrl = state['features/base/config'].legalUrls?.security ?? SECURITY_URL;
  17. const link = React.createElement(Link, {
  18. url: securityUrl,
  19. children: 'here',
  20. style: { color: BaseTheme.palette.action01 } });
  21. const options = {
  22. recommendAction: t(`security.unsafeRoomActions.${context}`)
  23. };
  24. return React.createElement(Text, { children: [ t('security.insecureRoomNameWarningNative', options), link, '.' ] });
  25. }