2019-01-30 15:43:57 +00:00
|
|
|
// @flow
|
|
|
|
|
2021-03-18 10:54:49 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { Text, View } from 'react-native';
|
2019-01-30 15:43:57 +00:00
|
|
|
|
2021-12-02 13:00:50 +00:00
|
|
|
import { getConferenceName, getConferenceTimestamp } from '../../../base/conference/functions';
|
2022-09-27 07:10:28 +00:00
|
|
|
import { CONFERENCE_TIMER_ENABLED, MEETING_NAME_ENABLED, getFeatureFlag } from '../../../base/flags';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2022-01-13 12:15:53 +00:00
|
|
|
import AudioDeviceToggleButton from '../../../mobile/audio-mode/components/AudioDeviceToggleButton';
|
2019-01-30 15:43:57 +00:00
|
|
|
import { PictureInPictureButton } from '../../../mobile/picture-in-picture';
|
2022-09-26 20:33:27 +00:00
|
|
|
import { ParticipantsPaneButton } from '../../../participants-pane/components/native';
|
|
|
|
import ToggleCameraButton from '../../../toolbox/components/native/ToggleCameraButton';
|
2020-07-24 12:14:33 +00:00
|
|
|
import { isToolboxVisible } from '../../../toolbox/functions.native';
|
2020-01-13 17:12:25 +00:00
|
|
|
import ConferenceTimer from '../ConferenceTimer';
|
2020-05-20 10:57:03 +00:00
|
|
|
|
2021-03-18 10:56:06 +00:00
|
|
|
import Labels from './Labels';
|
2021-03-18 10:54:49 +00:00
|
|
|
import styles from './styles';
|
|
|
|
|
2019-01-30 15:43:57 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
2022-01-13 12:15:53 +00:00
|
|
|
/**
|
|
|
|
* Creates a function to be invoked when the onPress of the touchables are
|
|
|
|
* triggered.
|
|
|
|
*/
|
|
|
|
_createOnPress: Function,
|
|
|
|
|
2020-07-15 08:22:35 +00:00
|
|
|
/**
|
|
|
|
* Whether displaying the current conference timer is enabled or not.
|
|
|
|
*/
|
|
|
|
_conferenceTimerEnabled: boolean,
|
|
|
|
|
2019-01-30 15:43:57 +00:00
|
|
|
/**
|
|
|
|
* Name of the meeting we're currently in.
|
|
|
|
*/
|
|
|
|
_meetingName: string,
|
|
|
|
|
2020-04-29 07:35:18 +00:00
|
|
|
/**
|
|
|
|
* Whether displaying the current meeting name is enabled or not.
|
|
|
|
*/
|
|
|
|
_meetingNameEnabled: boolean,
|
|
|
|
|
2019-01-30 15:43:57 +00:00
|
|
|
/**
|
|
|
|
* True if the navigation bar should be visible.
|
|
|
|
*/
|
|
|
|
_visible: boolean
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements a navigation bar component that is rendered on top of the
|
|
|
|
* conference screen.
|
2021-03-18 10:54:49 +00:00
|
|
|
*
|
|
|
|
* @param {Props} props - The React props passed to this component.
|
|
|
|
* @returns {React.Node}
|
2019-01-30 15:43:57 +00:00
|
|
|
*/
|
2022-01-13 12:15:53 +00:00
|
|
|
const TitleBar = (props: Props) => (<>
|
|
|
|
{props._visible && <View
|
|
|
|
pointerEvents = 'box-none'
|
|
|
|
style = { styles.titleBarWrapper }>
|
|
|
|
<View style = { styles.pipButtonContainer }>
|
|
|
|
<PictureInPictureButton styles = { styles.pipButton } />
|
|
|
|
</View>
|
2021-03-18 10:54:49 +00:00
|
|
|
<View
|
|
|
|
pointerEvents = 'box-none'
|
2022-01-13 12:15:53 +00:00
|
|
|
style = { styles.roomNameWrapper }>
|
|
|
|
{
|
|
|
|
props._conferenceTimerEnabled
|
|
|
|
&& <View style = { styles.roomTimerView }>
|
|
|
|
<ConferenceTimer textStyle = { styles.roomTimer } />
|
|
|
|
</View>
|
|
|
|
}
|
|
|
|
{
|
|
|
|
props._meetingNameEnabled
|
2021-03-18 13:05:08 +00:00
|
|
|
&& <View style = { styles.roomNameView }>
|
|
|
|
<Text
|
|
|
|
numberOfLines = { 1 }
|
|
|
|
style = { styles.roomName }>
|
|
|
|
{ props._meetingName }
|
|
|
|
</Text>
|
|
|
|
</View>
|
2022-01-13 12:15:53 +00:00
|
|
|
}
|
|
|
|
{/* eslint-disable-next-line react/jsx-no-bind */}
|
|
|
|
<Labels createOnPress = { props._createOnPress } />
|
2021-03-18 10:54:49 +00:00
|
|
|
</View>
|
2022-01-13 12:15:53 +00:00
|
|
|
<View style = { styles.titleBarButtonContainer }>
|
2022-07-11 08:58:33 +00:00
|
|
|
<ToggleCameraButton styles = { styles.titleBarButton } />
|
2022-01-13 12:15:53 +00:00
|
|
|
</View>
|
|
|
|
<View style = { styles.titleBarButtonContainer }>
|
2022-07-11 08:58:33 +00:00
|
|
|
<AudioDeviceToggleButton styles = { styles.titleBarButton } />
|
|
|
|
</View>
|
|
|
|
<View style = { styles.titleBarButtonContainer }>
|
2022-09-26 20:33:27 +00:00
|
|
|
<ParticipantsPaneButton styles = { styles.titleBarButton } />
|
2022-01-13 12:15:53 +00:00
|
|
|
</View>
|
|
|
|
</View>}
|
|
|
|
</>);
|
2019-01-30 15:43:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps part of the Redux store to the props of this component.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
2020-04-29 07:35:18 +00:00
|
|
|
* @returns {Props}
|
2019-01-30 15:43:57 +00:00
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
2021-01-07 13:31:53 +00:00
|
|
|
const { hideConferenceTimer, hideConferenceSubject } = state['features/base/config'];
|
2021-12-02 13:00:50 +00:00
|
|
|
const startTimestamp = getConferenceTimestamp(state);
|
2021-01-07 13:31:53 +00:00
|
|
|
|
2019-01-30 15:43:57 +00:00
|
|
|
return {
|
2020-12-03 21:49:08 +00:00
|
|
|
_conferenceTimerEnabled:
|
2021-12-03 07:27:09 +00:00
|
|
|
Boolean(getFeatureFlag(state, CONFERENCE_TIMER_ENABLED, true) && !hideConferenceTimer && startTimestamp),
|
2019-05-29 07:53:12 +00:00
|
|
|
_meetingName: getConferenceName(state),
|
2021-01-07 13:31:53 +00:00
|
|
|
_meetingNameEnabled:
|
|
|
|
getFeatureFlag(state, MEETING_NAME_ENABLED, true) && !hideConferenceSubject,
|
2019-01-30 15:43:57 +00:00
|
|
|
_visible: isToolboxVisible(state)
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2022-01-13 12:15:53 +00:00
|
|
|
export default connect(_mapStateToProps)(TitleBar);
|