2022-07-18 13:16:08 +00:00
|
|
|
/* eslint-disable lines-around-comment */
|
2022-05-06 10:14:10 +00:00
|
|
|
import React, { useEffect } from 'react';
|
2022-07-07 08:57:48 +00:00
|
|
|
import { View } from 'react-native';
|
2022-05-06 10:14:10 +00:00
|
|
|
import { withSafeAreaInsets } from 'react-native-safe-area-context';
|
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
|
|
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-06-16 09:49:53 +00:00
|
|
|
import JitsiScreen from '../../../../base/modal/components/JitsiScreen';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import { LoadingIndicator, TintedView } from '../../../../base/react';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-06-16 09:49:53 +00:00
|
|
|
import { isLocalVideoTrackDesktop } from '../../../../base/tracks';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-06-21 05:49:46 +00:00
|
|
|
import { setPictureInPictureEnabled } from '../../../../mobile/picture-in-picture/functions';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import { setIsCarmode } from '../../../../video-layout/actions';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import ConferenceTimer from '../../ConferenceTimer';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import { isConnecting } from '../../functions';
|
|
|
|
|
2022-07-07 08:57:48 +00:00
|
|
|
import CarModeFooter from './CarModeFooter';
|
2022-05-06 10:14:10 +00:00
|
|
|
import MicrophoneButton from './MicrophoneButton';
|
|
|
|
import TitleBar from './TitleBar';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
/**
|
2022-07-07 08:57:48 +00:00
|
|
|
* Implements the carmode component.
|
2022-05-06 10:14:10 +00:00
|
|
|
*
|
2022-07-07 08:57:48 +00:00
|
|
|
* @returns { JSX.Element} - The carmode component.
|
2022-05-06 10:14:10 +00:00
|
|
|
*/
|
2022-07-07 08:57:48 +00:00
|
|
|
const CarMode = (): JSX.Element => {
|
2022-05-06 10:14:10 +00:00
|
|
|
const dispatch = useDispatch();
|
|
|
|
const connecting = useSelector(isConnecting);
|
|
|
|
const isSharing = useSelector(isLocalVideoTrackDesktop);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
dispatch(setIsCarmode(true));
|
2022-06-21 05:49:46 +00:00
|
|
|
setPictureInPictureEnabled(false);
|
2022-05-06 10:14:10 +00:00
|
|
|
|
|
|
|
return () => {
|
|
|
|
dispatch(setIsCarmode(false));
|
|
|
|
if (!isSharing) {
|
2022-06-21 05:49:46 +00:00
|
|
|
setPictureInPictureEnabled(true);
|
2022-05-06 10:14:10 +00:00
|
|
|
}
|
2022-06-16 09:49:53 +00:00
|
|
|
};
|
2022-05-06 10:14:10 +00:00
|
|
|
}, []);
|
|
|
|
|
|
|
|
return (
|
2022-07-07 08:57:48 +00:00
|
|
|
<JitsiScreen
|
|
|
|
footerComponent = { CarModeFooter }
|
|
|
|
style = { styles.conference }>
|
2022-05-06 10:14:10 +00:00
|
|
|
{/*
|
|
|
|
* The activity/loading indicator goes above everything, except
|
|
|
|
* the toolbox/toolbars and the dialogs.
|
|
|
|
*/
|
|
|
|
connecting
|
|
|
|
&& <TintedView>
|
|
|
|
<LoadingIndicator />
|
|
|
|
</TintedView>
|
|
|
|
}
|
|
|
|
<View
|
|
|
|
pointerEvents = 'box-none'
|
|
|
|
style = { styles.titleBarSafeViewColor }>
|
|
|
|
<View
|
|
|
|
style = { styles.titleBar }>
|
2022-07-18 13:16:08 +00:00
|
|
|
{/* @ts-ignore */}
|
2022-05-06 10:14:10 +00:00
|
|
|
<TitleBar />
|
|
|
|
</View>
|
|
|
|
<ConferenceTimer textStyle = { styles.roomTimer } />
|
|
|
|
</View>
|
|
|
|
<View
|
|
|
|
pointerEvents = 'box-none'
|
|
|
|
style = { styles.microphoneContainer }>
|
|
|
|
<MicrophoneButton />
|
|
|
|
</View>
|
|
|
|
</JitsiScreen>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-07-07 08:57:48 +00:00
|
|
|
export default withSafeAreaInsets(CarMode);
|