You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import React, { useEffect } from 'react';
  2. import { View, ViewStyle } from 'react-native';
  3. import Orientation from 'react-native-orientation-locker';
  4. import { withSafeAreaInsets } from 'react-native-safe-area-context';
  5. import { useDispatch, useSelector } from 'react-redux';
  6. import JitsiScreen from '../../../../base/modal/components/JitsiScreen';
  7. import LoadingIndicator from '../../../../base/react/components/native/LoadingIndicator';
  8. import TintedView from '../../../../base/react/components/native/TintedView';
  9. import { isLocalVideoTrackDesktop } from '../../../../base/tracks/functions.native';
  10. import { setPictureInPictureEnabled } from '../../../../mobile/picture-in-picture/functions';
  11. import { setIsCarmode } from '../../../../video-layout/actions';
  12. import ConferenceTimer from '../../ConferenceTimer';
  13. import { isConnecting } from '../../functions';
  14. import CarModeFooter from './CarModeFooter';
  15. import MicrophoneButton from './MicrophoneButton';
  16. import TitleBar from './TitleBar';
  17. import styles from './styles';
  18. /**
  19. * Implements the carmode component.
  20. *
  21. * @returns { JSX.Element} - The carmode component.
  22. */
  23. const CarMode = (): JSX.Element => {
  24. const dispatch = useDispatch();
  25. const connecting = useSelector(isConnecting);
  26. const isSharing = useSelector(isLocalVideoTrackDesktop);
  27. useEffect(() => {
  28. dispatch(setIsCarmode(true));
  29. setPictureInPictureEnabled(false);
  30. Orientation.lockToPortrait();
  31. return () => {
  32. Orientation.unlockAllOrientations();
  33. dispatch(setIsCarmode(false));
  34. if (!isSharing) {
  35. setPictureInPictureEnabled(true);
  36. }
  37. };
  38. }, []);
  39. return (
  40. <JitsiScreen
  41. footerComponent = { CarModeFooter }
  42. style = { styles.conference }>
  43. {/*
  44. * The activity/loading indicator goes above everything, except
  45. * the toolbox/toolbars and the dialogs.
  46. */
  47. connecting
  48. && <TintedView>
  49. <LoadingIndicator />
  50. </TintedView>
  51. }
  52. <View
  53. pointerEvents = 'box-none'
  54. style = { styles.titleBarSafeViewColor as ViewStyle }>
  55. <View
  56. style = { styles.titleBar as ViewStyle }>
  57. <TitleBar />
  58. </View>
  59. <ConferenceTimer textStyle = { styles.roomTimer } />
  60. </View>
  61. <View
  62. pointerEvents = 'box-none'
  63. style = { styles.microphoneContainer as ViewStyle }>
  64. <MicrophoneButton />
  65. </View>
  66. </JitsiScreen>
  67. );
  68. };
  69. export default withSafeAreaInsets(CarMode);