diff --git a/app/products/calls/components/reaction_bar.tsx b/app/products/calls/components/reaction_bar.tsx index d4046262b..90b6c2acb 100644 --- a/app/products/calls/components/reaction_bar.tsx +++ b/app/products/calls/components/reaction_bar.tsx @@ -2,7 +2,7 @@ // See LICENSE.txt for license information. import React, {useCallback} from 'react'; -import {Pressable, StyleSheet, View} from 'react-native'; +import {Pressable, StyleSheet, useWindowDimensions, View} from 'react-native'; import {raiseHand, unraiseHand} from '@calls/actions'; import {sendReaction} from '@calls/actions/calls'; @@ -16,12 +16,15 @@ const styles = StyleSheet.create({ flexDirection: 'row', alignItems: 'flex-end', justifyContent: 'space-between', - backgroundColor: 'rgba(255,255,255,0.16)', width: '100%', height: 64, paddingLeft: 16, paddingRight: 16, }, + containerInLandscape: { + paddingBottom: 6, + justifyContent: 'center', + }, button: { display: 'flex', flexDirection: 'row', @@ -33,6 +36,10 @@ const styles = StyleSheet.create({ paddingLeft: 10, paddingRight: 10, }, + buttonLandscape: { + marginRight: 12, + marginLeft: 12, + }, buttonPressed: { backgroundColor: 'rgba(245, 171, 0, 0.24)', }, @@ -54,6 +61,9 @@ interface Props { } const ReactionBar = ({raisedHand}: Props) => { + const {width, height} = useWindowDimensions(); + const isLandscape = width > height; + const LowerHandText = ( { }, [raisedHand]); return ( - + { sendReaction({name, unified})} /> )) diff --git a/app/products/calls/screens/call_screen/call_screen.tsx b/app/products/calls/screens/call_screen/call_screen.tsx index b74f6054e..ddb035b22 100644 --- a/app/products/calls/screens/call_screen/call_screen.tsx +++ b/app/products/calls/screens/call_screen/call_screen.tsx @@ -6,6 +6,7 @@ import {useIntl} from 'react-intl'; import { DeviceEventEmitter, Keyboard, + NativeModules, Platform, Pressable, SafeAreaView, @@ -42,6 +43,7 @@ import useAndroidHardwareBackHandler from '@hooks/android_back_handler'; import {useIsTablet} from '@hooks/device'; import WebsocketManager from '@managers/websocket_manager'; import { + allOrientations, bottomSheet, dismissAllModalsAndPopToScreen, dismissBottomSheet, @@ -50,6 +52,7 @@ import { setScreensOrientation, } from '@screens/navigation'; import NavigationStore from '@store/navigation_store'; +import {freezeOtherScreens} from '@utils/gallery'; import {bottomSheetSnapPoint} from '@utils/helpers'; import {mergeNavigationOptions} from '@utils/navigation'; import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; @@ -107,8 +110,8 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({ position: 'absolute', top: 0, backgroundColor: 'rgba(0,0,0,0.64)', - height: 64, - padding: 0, + height: 52, + paddingTop: 0, }, headerLandscapeNoControls: { top: -1000, @@ -160,11 +163,14 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({ }), }, buttonsLandscape: { - height: 128, + height: 110, position: 'absolute', backgroundColor: 'rgba(0,0,0,0.64)', bottom: 0, }, + buttonsLandscapeWithReactions: { + height: 174, + }, buttonsLandscapeNoControls: { bottom: 1000, }, @@ -173,6 +179,9 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({ alignItems: 'center', flex: 1, }, + buttonLandscape: { + flex: 0, + }, mute: { flexDirection: 'column', alignItems: 'center', @@ -198,7 +207,9 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({ otherButtons: { flexDirection: 'row', alignItems: 'center', - alignContent: 'space-between', + }, + otherButtonsLandscape: { + justifyContent: 'center', }, collapseIcon: { color: theme.sidebarText, @@ -208,6 +219,12 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({ borderRadius: 4, overflow: 'hidden', }, + collapseIconLandscape: { + margin: 10, + padding: 0, + backgroundColor: 'transparent', + borderRadius: 0, + }, muteIcon: { color: theme.sidebarText, }, @@ -230,6 +247,17 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({ margin: 10, overflow: 'hidden', }, + buttonIconLandscape: { + borderRadius: 26, + paddingTop: 14, + paddingRight: 16, + paddingBottom: 16, + paddingLeft: 14, + width: 52, + height: 52, + marginLeft: 12, + marginRight: 12, + }, hangUpIcon: { backgroundColor: Preferences.THEMES.denim.dndIndicator, }, @@ -272,7 +300,6 @@ const CallScreen = ({ const style = getStyleSheet(theme); const isLandscape = width > height; - const showControls = !isLandscape || showControlsInLandscape; const myParticipant = currentCall?.participants[currentCall.myUserId]; const micPermissionsError = !micPermissionsGranted && !currentCall?.micPermissionsErrorDismissed; @@ -285,11 +312,24 @@ const CallScreen = ({ mergeNavigationOptions('Call', { layout: { componentBackgroundColor: 'black', + orientation: allOrientations, }, topBar: { visible: false, }, }); + if (Platform.OS === 'ios') { + NativeModules.SplitView.unlockOrientation(); + } + + return () => { + setScreensOrientation(isTablet); + if (Platform.OS === 'ios' && !isTablet) { + // We need both the navigation & the module + NativeModules.SplitView.lockPortrait(); + } + freezeOtherScreens(false); + }; }, []); const leaveCallHandler = useCallback(() => { @@ -473,12 +513,14 @@ const CallScreen = ({ streamURL={currentCall.screenShareURL} style={style.screenShareImage} /> - + {!isLandscape && + + } ); } @@ -545,7 +587,11 @@ const CallScreen = ({ {waitingForRecording && } {recording && } @@ -558,18 +604,27 @@ const CallScreen = ({ {usersList} {screenShareView} {micPermissionsError && } - - {showReactions && } + {!isLandscape && + + } + {showReactions && + + } {!isLandscape && {myParticipant.muted ? UnmuteText : MuteText} - } - + + } + {myParticipant.muted ? UnmuteText : MuteText} - } + + }