diff --git a/app/lib/hooks/useVideoConf/StartACallActionSheet.tsx b/app/lib/hooks/useVideoConf/StartACallActionSheet.tsx index 0554608ec..06d2ba574 100644 --- a/app/lib/hooks/useVideoConf/StartACallActionSheet.tsx +++ b/app/lib/hooks/useVideoConf/StartACallActionSheet.tsx @@ -1,8 +1,8 @@ import { Camera, CameraType } from 'expo-camera'; import React, { useState } from 'react'; import { StyleSheet, View } from 'react-native'; -import { useDispatch } from 'react-redux'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; +import { useDispatch } from 'react-redux'; import { useAppSelector } from '..'; import { cancelCall, initVideoCall } from '../../../actions/videoConf'; @@ -10,12 +10,19 @@ import AvatarContainer from '../../../containers/Avatar'; import Button from '../../../containers/Button'; import { CallHeader } from '../../../containers/CallHeader'; import Ringer, { ERingerSounds } from '../../../containers/Ringer'; +import { SubscriptionType } from '../../../definitions'; import i18n from '../../../i18n'; import { getUserSelector } from '../../../selectors/login'; import { useTheme } from '../../../theme'; import useUserData from '../useUserData'; -export default function StartACallActionSheet({ rid }: { rid: string }): React.ReactElement { +export default function StartACallActionSheet({ + rid, + roomType +}: { + rid: string; + roomType?: SubscriptionType; +}): React.ReactElement { const { colors } = useTheme(); const [mic, setMic] = useState(true); const [cam, setCam] = useState(false); @@ -42,7 +49,7 @@ export default function StartACallActionSheet({ rid }: { rid: string }): React.R style={[style.actionSheetContainer, { paddingBottom: bottom }]} onLayout={e => setContainerWidth(e.nativeEvent.layout.width / 2)} > - {calling ? : null} + {calling && roomType === SubscriptionType.DIRECT ? : null} getUserSelector(state)); const serverVersion = useAppSelector(state => state.server.version); - const { callEnabled, disabledTooltip } = useVideoConfCall(rid); + const { callEnabled, disabledTooltip, roomType } = useVideoConfCall(rid); const [permission, requestPermission] = Camera.useCameraPermissions(); const { showActionSheet } = useActionSheet(); @@ -59,7 +59,7 @@ export const useVideoConf = ( const canInit = await canInitAnCall(); if (canInit) { showActionSheet({ - children: , + children: , snaps: [480] }); diff --git a/app/lib/hooks/useVideoConf/useVideoConfCall.ts b/app/lib/hooks/useVideoConf/useVideoConfCall.ts index e14bdfb37..a9f00ec3a 100644 --- a/app/lib/hooks/useVideoConf/useVideoConfCall.ts +++ b/app/lib/hooks/useVideoConf/useVideoConfCall.ts @@ -3,15 +3,18 @@ import { useEffect, useState } from 'react'; import { SubscriptionType } from '../../../definitions'; import { getUserSelector } from '../../../selectors/login'; import { getSubscriptionByRoomId } from '../../database/services/Subscription'; +import { isRoomFederated } from '../../methods'; import { compareServerVersion, isReadOnly } from '../../methods/helpers'; import { useAppSelector } from '../useAppSelector'; import { usePermissions } from '../usePermissions'; import { useSetting } from '../useSetting'; -import { isRoomFederated } from '../../methods'; -export const useVideoConfCall = (rid: string): { callEnabled: boolean; disabledTooltip?: boolean } => { +export const useVideoConfCall = ( + rid: string +): { callEnabled: boolean; disabledTooltip?: boolean; roomType?: SubscriptionType } => { const [callEnabled, setCallEnabled] = useState(false); const [disabledTooltip, setDisabledTooltip] = useState(false); + const [roomType, setRoomType] = useState(); // OLD SETTINGS const jitsiEnabled = useSetting('Jitsi_Enabled'); @@ -34,6 +37,7 @@ export const useVideoConfCall = (rid: string): { callEnabled: boolean; disabledT const init = async () => { const room = await getSubscriptionByRoomId(rid); if (room) { + setRoomType(room.t); if (isServer5OrNewer) { const isReadyOnly = await isReadOnly(room, user.username); const ownUser = room.uids && room.uids.length === 1; @@ -64,5 +68,5 @@ export const useVideoConfCall = (rid: string): { callEnabled: boolean; disabledT init(); }, []); - return { callEnabled, disabledTooltip }; + return { callEnabled, disabledTooltip, roomType }; };