add option to open jitsi app
This commit is contained in:
parent
c9261ef11e
commit
658f4d7eab
|
@ -79,10 +79,4 @@
|
|||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
<queries>
|
||||
<package android:name="org.jitsi.meet" />
|
||||
<intent>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
</intent>
|
||||
</queries>
|
||||
</manifest>
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
import { activateKeepAwake, deactivateKeepAwake } from 'expo-keep-awake';
|
||||
import React from 'react';
|
||||
import { BackHandler, NativeEventSubscription, SafeAreaView } from 'react-native';
|
||||
import { isAppInstalled, openAppWithUri } from 'react-native-send-intent';
|
||||
import { BackHandler, Linking, NativeEventSubscription, SafeAreaView } from 'react-native';
|
||||
import WebView from 'react-native-webview';
|
||||
import { WebViewMessage, WebViewNavigation } from 'react-native-webview/lib/WebViewTypes';
|
||||
|
||||
import { IBaseScreen } from '../definitions';
|
||||
import { userAgent } from '../lib/constants';
|
||||
import { isAndroid } from '../lib/methods/helpers';
|
||||
import { events, logEvent } from '../lib/methods/helpers/log';
|
||||
import { endVideoConfTimer, initVideoConfTimer } from '../lib/methods/videoConfTimer';
|
||||
import { ChatsStackParamList } from '../stacks/types';
|
||||
import { withTheme } from '../theme';
|
||||
|
||||
const JITSI_INTENT = 'org.jitsi.meet';
|
||||
|
||||
type TJitsiMeetViewProps = IBaseScreen<ChatsStackParamList, 'JitsiMeetView'>;
|
||||
|
||||
class JitsiMeetView extends React.Component<TJitsiMeetViewProps> {
|
||||
|
@ -31,20 +27,7 @@ class JitsiMeetView extends React.Component<TJitsiMeetViewProps> {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { route, navigation } = this.props;
|
||||
if (isAndroid) {
|
||||
isAppInstalled(JITSI_INTENT)
|
||||
.then(function (isInstalled) {
|
||||
if (isInstalled) {
|
||||
const callUrl = route.params.url.replace(/^https?:\/\//, '').split('#')[0];
|
||||
openAppWithUri(`intent://${callUrl}#Intent;scheme=${JITSI_INTENT};package=${JITSI_INTENT};end`)
|
||||
.then(() => navigation.pop())
|
||||
.catch(() => {});
|
||||
}
|
||||
})
|
||||
.catch(() => {});
|
||||
this.backHandler = BackHandler.addEventListener('hardwareBackPress', () => true);
|
||||
}
|
||||
this.handleJitsiApp();
|
||||
this.onConferenceJoined();
|
||||
activateKeepAwake();
|
||||
}
|
||||
|
@ -60,6 +43,18 @@ class JitsiMeetView extends React.Component<TJitsiMeetViewProps> {
|
|||
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 = () => {
|
||||
|
|
|
@ -126,7 +126,6 @@
|
|||
"react-native-safe-area-context": "3.2.0",
|
||||
"react-native-screens": "3.13.1",
|
||||
"react-native-scrollable-tab-view": "ptomasroos/react-native-scrollable-tab-view",
|
||||
"react-native-send-intent": "^1.3.0",
|
||||
"react-native-simple-crypto": "RocketChat/react-native-simple-crypto#0.5.1",
|
||||
"react-native-skeleton-placeholder": "^5.2.3",
|
||||
"react-native-slowlog": "^1.0.2",
|
||||
|
|
|
@ -17577,11 +17577,6 @@ react-native-scrollable-tab-view@ptomasroos/react-native-scrollable-tab-view:
|
|||
prop-types "^15.6.0"
|
||||
react-timer-mixin "^0.13.3"
|
||||
|
||||
react-native-send-intent@^1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-send-intent/-/react-native-send-intent-1.3.0.tgz#d8c7898827da1b8b10e25a645ce6802d1a0b440c"
|
||||
integrity sha512-ODTX7BHITFxdcAL0K2iHfa3qVYnqG8GPcv1NbLBNC1DyCaOSJiiGtVH6Kc5YBqzQ8+1pV9uN5nfQ5wyFgiq74g==
|
||||
|
||||
react-native-simple-crypto@RocketChat/react-native-simple-crypto#0.5.1:
|
||||
version "0.5.1"
|
||||
resolved "https://codeload.github.com/RocketChat/react-native-simple-crypto/tar.gz/dcf6eef5359c739d521371918e13a73f2ea6cb42"
|
||||
|
|
Loading…
Reference in New Issue