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