diff --git a/app/i18n/locales/en.json b/app/i18n/locales/en.json index 31ed00891..074192f9b 100644 --- a/app/i18n/locales/en.json +++ b/app/i18n/locales/en.json @@ -743,6 +743,11 @@ "accept": "Accept", "Incoming_call_from": "Incoming call from", "Call_started": "Call started", + "Jitsi_may_require_authentication": "Jitsi may require authentication", + "Jitsi_authentication_before_making_calls_admin": "Jitsi may require authentication before making calls. To learn more about their policies, visit the Jitsi website. You can also update the default app for video calls in the preferences.", + "Jitsi_authentication_before_making_calls": "Jitsi may require authentication before making calls. To learn more about their policies, visit the Jitsi website.", + "Jitsi_authentication_before_making_calls_ask_admin": "If you believe there are problems with Jitsi and its authentication, ask a workspace administrator for help.", + "Continue": "Continue", "Message_has_been_shared": "Message has been shared", "No_channels_in_team": "No Channels on this team" -} \ No newline at end of file +} diff --git a/app/i18n/locales/pt-BR.json b/app/i18n/locales/pt-BR.json index 1301946c2..0fedb4ed9 100644 --- a/app/i18n/locales/pt-BR.json +++ b/app/i18n/locales/pt-BR.json @@ -726,10 +726,15 @@ "Select": "Selecionar", "Nickname": "Apelido", "Bio": "Biografia", + "Message_has_been_shared":"Menssagem foi compartilhada", + "No_channels_in_team": "Nenhum canal nesta equipe", + "Jitsi_may_requires_authentication": "Jitsi pode exigir autenticação", + "Jitsi_authentication_before_making_calls_admin": "Jitsi pode exigir autenticação antes de fazer chamadas. Para saber mais sobre as políticas deles, visite o site do Jitsi. Você também pode atualizar o aplicativo padrão para chamadas de vídeo nas preferências.", + "Jitsi_authentication_before_making_calls": "Jitsi pode exigir autenticação antes de fazer chamadas. Para saber mais sobre suas políticas, visite o site do Jitsi.", + "Jitsi_authentication_before_making_calls_ask_admin": "Se você acredita que há problemas com o Jitsi e sua autenticação, peça ajuda a um administrador do espaço de trabalho.", + "Continue": "Continuar", "decline": "Recusar", "accept": "Aceitar", "Incoming_call_from": "Chamada recebida de", - "Call_started": "Chamada Iniciada", - "Message_has_been_shared": "Menssagem foi compartilhada", - "No_channels_in_team": "Nenhum canal nesta equipe" + "Call_started": "Chamada Iniciada" } \ No newline at end of file diff --git a/app/views/JitsiMeetView.tsx b/app/views/JitsiMeetView.tsx deleted file mode 100644 index 54670c562..000000000 --- a/app/views/JitsiMeetView.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import { activateKeepAwake, deactivateKeepAwake } from 'expo-keep-awake'; -import React from 'react'; -import { BackHandler, Linking, NativeEventSubscription, SafeAreaView } from 'react-native'; -import WebView from 'react-native-webview'; -import { WebViewNavigation } from 'react-native-webview/lib/WebViewTypes'; - -import { IBaseScreen } from '../definitions'; -import { userAgent } from '../lib/constants'; -import { isIOS } from '../lib/methods/helpers'; -import { getRoomIdFromJitsiCallUrl } from '../lib/methods/helpers/getRoomIdFromJitsiCall'; -import { events, logEvent } from '../lib/methods/helpers/log'; -import { endVideoConfTimer, initVideoConfTimer } from '../lib/methods/videoConfTimer'; -import { ChatsStackParamList } from '../stacks/types'; -import { withTheme } from '../theme'; - -type TJitsiMeetViewProps = IBaseScreen; - -class JitsiMeetView extends React.Component { - private rid: string; - private url: string; - private videoConf: boolean; - private backHandler!: NativeEventSubscription; - - constructor(props: TJitsiMeetViewProps) { - super(props); - this.rid = props.route.params?.rid; - this.url = props.route.params?.url; - this.videoConf = !!props.route.params?.videoConf; - } - - componentDidMount() { - this.handleJitsiApp(); - this.onConferenceJoined(); - activateKeepAwake(); - } - - componentWillUnmount() { - logEvent(this.videoConf ? events.LIVECHAT_VIDEOCONF_TERMINATE : events.JM_CONFERENCE_TERMINATE); - if (!this.videoConf) { - endVideoConfTimer(); - } - if (this.backHandler) { - this.backHandler.remove(); - } - deactivateKeepAwake(); - } - - handleJitsiApp = async () => { - const { route, navigation } = this.props; - const callUrl = route.params.url.replace(/^https?:\/\//, ''); - try { - await Linking.openURL(`org.jitsi.meet://${callUrl}`); - navigation.pop(); - } catch (error) { - // As the jitsi app was not opened disable the backhandler on android - this.backHandler = BackHandler.addEventListener('hardwareBackPress', () => true); - } - }; - - // Jitsi Update Timeout needs to be called every 10 seconds to make sure - // call is not ended and is available to web users. - onConferenceJoined = () => { - logEvent(this.videoConf ? events.LIVECHAT_VIDEOCONF_JOIN : events.JM_CONFERENCE_JOIN); - if (this.rid && !this.videoConf) { - initVideoConfTimer(this.rid); - } - }; - - onNavigationStateChange = (webViewState: WebViewNavigation) => { - const { navigation, route } = this.props; - - const roomId = getRoomIdFromJitsiCallUrl(route.params.url); - - if ((roomId && !webViewState.url.includes(roomId)) || webViewState.url.includes('close')) { - if (isIOS) { - if (webViewState.navigationType) { - navigation.pop(); - } - } else { - navigation.pop(); - } - } - }; - - render() { - const uri = `${this.url}${this.url.includes('#config') ? '&' : '#'}config.disableDeepLinking=true`; - return ( - - - - ); - } -} - -export default withTheme(JitsiMeetView); diff --git a/app/views/JitsiMeetView/JitsiAuthModal.tsx b/app/views/JitsiMeetView/JitsiAuthModal.tsx new file mode 100644 index 000000000..f6c8a2de0 --- /dev/null +++ b/app/views/JitsiMeetView/JitsiAuthModal.tsx @@ -0,0 +1,81 @@ +import { useNavigation } from '@react-navigation/native'; +import React from 'react'; +import { Linking, StyleSheet, Text, View } from 'react-native'; +import Modal from 'react-native-modal'; + +import sharedStyles from '../Styles'; +import Button from '../../containers/Button'; +import { useTheme } from '../../theme'; +import { useAppSelector } from '../../lib/hooks'; +import { getUserSelector } from '../../selectors/login'; +import i18n from '../../i18n'; + +const styles = StyleSheet.create({ + title: { + ...sharedStyles.textBold, + fontSize: 24, + marginBottom: 24 + }, + regular: { + ...sharedStyles.textRegular, + fontSize: 16, + marginBottom: 24 + }, + min: { + ...sharedStyles.textRegular, + fontSize: 12, + marginBottom: 24 + }, + container: { padding: 24, borderRadius: 8 }, + buttonContainer: { + flexDirection: 'row', + justifyContent: 'space-between' + } +}); + +const JitsiAuthModal = ({ + setAuthModal, + callUrl +}: { + setAuthModal: React.Dispatch>; + callUrl: string; +}): React.ReactElement => { + const { goBack } = useNavigation(); + const { colors } = useTheme(); + const user = useAppSelector(state => getUserSelector(state)); + + const isAdmin = !!user.roles?.includes('admin'); + + return ( + + + {i18n.t('Jitsi_may_require_authentication')} + {isAdmin ? ( + + {i18n.t('Jitsi_authentication_before_making_calls_admin')} + + ) : ( + {i18n.t('Jitsi_authentication_before_making_calls')} + )} + {!isAdmin ? ( + + {i18n.t('Jitsi_authentication_before_making_calls_ask_admin')} + + ) : null} + +