parent
9d7b6cafc5
commit
0fe7383154
|
@ -6,7 +6,6 @@ import React, { useEffect } from 'react';
|
||||||
import { translate } from '../../../base/i18n';
|
import { translate } from '../../../base/i18n';
|
||||||
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
|
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
|
||||||
import { connect } from '../../../base/redux';
|
import { connect } from '../../../base/redux';
|
||||||
import { closeChat, openChat } from '../../actions.native';
|
|
||||||
import AbstractChat, {
|
import AbstractChat, {
|
||||||
_mapStateToProps,
|
_mapStateToProps,
|
||||||
type Props as AbstractProps
|
type Props as AbstractProps
|
||||||
|
@ -69,26 +68,19 @@ class Chat extends AbstractChat<Props> {
|
||||||
export default translate(connect(_mapStateToProps)(props => {
|
export default translate(connect(_mapStateToProps)(props => {
|
||||||
const {
|
const {
|
||||||
_nbUnreadMessages,
|
_nbUnreadMessages,
|
||||||
dispatch,
|
|
||||||
navigation,
|
navigation,
|
||||||
route,
|
|
||||||
t
|
t
|
||||||
} = props;
|
} = props;
|
||||||
const isChatScreenFocused = useIsFocused();
|
const isChatScreenFocused = useIsFocused();
|
||||||
const privateMessageRecipient = route.params?.privateMessageRecipient;
|
|
||||||
|
|
||||||
const nrUnreadMessages
|
const nrUnreadMessages
|
||||||
= !isChatScreenFocused && _nbUnreadMessages > 0
|
= !isChatScreenFocused && _nbUnreadMessages > 0
|
||||||
? `(${_nbUnreadMessages})` : '';
|
? `(${_nbUnreadMessages})` : '';
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(openChat(privateMessageRecipient));
|
|
||||||
|
|
||||||
navigation.setOptions({
|
navigation.setOptions({
|
||||||
tabBarLabel: `${t('chat.tabs.chat')} ${nrUnreadMessages}`
|
tabBarLabel: `${t('chat.tabs.chat')} ${nrUnreadMessages}`
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => dispatch(closeChat());
|
|
||||||
}, [ nrUnreadMessages ]);
|
}, [ nrUnreadMessages ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -58,7 +58,7 @@ class PrivateMessageButton extends AbstractButton<Props, any> {
|
||||||
toggledIcon = IconReply;
|
toggledIcon = IconReply;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles clicking / pressing the button, and kicks the participant.
|
* Handles clicking / pressing the button.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
|
@ -67,6 +67,7 @@ class PrivateMessageButton extends AbstractButton<Props, any> {
|
||||||
if (this.props._isLobbyMessage) {
|
if (this.props._isLobbyMessage) {
|
||||||
this.props.dispatch(handleLobbyChatInitialized(this.props.participantID));
|
this.props.dispatch(handleLobbyChatInitialized(this.props.participantID));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.props._isPollsDisabled
|
this.props._isPollsDisabled
|
||||||
? navigate(screen.conference.chat, {
|
? navigate(screen.conference.chat, {
|
||||||
privateMessageRecipient: this.props._participant
|
privateMessageRecipient: this.props._participant
|
||||||
|
@ -102,11 +103,11 @@ class PrivateMessageButton extends AbstractButton<Props, any> {
|
||||||
export function _mapStateToProps(state: Object, ownProps: Props): $Shape<Props> {
|
export function _mapStateToProps(state: Object, ownProps: Props): $Shape<Props> {
|
||||||
const enabled = getFeatureFlag(state, CHAT_ENABLED, true);
|
const enabled = getFeatureFlag(state, CHAT_ENABLED, true);
|
||||||
const { disablePolls } = state['features/base/config'];
|
const { disablePolls } = state['features/base/config'];
|
||||||
const { visible = enabled, isLobbyMessage } = ownProps;
|
const { visible = enabled, isLobbyMessage, participantID } = ownProps;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
_isPollsDisabled: disablePolls,
|
_isPollsDisabled: disablePolls,
|
||||||
_participant: getParticipantById(state, ownProps.participantID),
|
_participant: getParticipantById(state, participantID),
|
||||||
_isLobbyMessage: isLobbyMessage,
|
_isLobbyMessage: isLobbyMessage,
|
||||||
visible
|
visible
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue