the notification icon in the room header will appear if notifications are disabled or highlight troubleshoot is true

This commit is contained in:
Reinaldo Neto 2024-02-09 19:18:29 -03:00
parent f515f750b4
commit 8ea4ddf5f5
2 changed files with 17 additions and 8 deletions

View File

@ -47,6 +47,7 @@ interface IRightButtonsProps extends Pick<ISubscription, 't'> {
theme?: TSupportedThemes;
colors?: TColors;
highlightTroubleshooting: boolean;
disableNotifications?: boolean;
}
interface IRigthButtonsState {
@ -95,7 +96,7 @@ class RightButtonsContainer extends Component<IRightButtonsProps, IRigthButtonsS
shouldComponentUpdate(nextProps: IRightButtonsProps, nextState: IRigthButtonsState) {
const { isFollowingThread, tunread, tunreadUser, tunreadGroup } = this.state;
const { teamId, status, joined, omnichannelPermissions, theme, highlightTroubleshooting } = this.props;
const { teamId, status, joined, omnichannelPermissions, theme, highlightTroubleshooting, disableNotifications } = this.props;
if (nextProps.teamId !== teamId) {
return true;
}
@ -114,6 +115,9 @@ class RightButtonsContainer extends Component<IRightButtonsProps, IRigthButtonsS
if (nextProps.highlightTroubleshooting !== highlightTroubleshooting) {
return true;
}
if (nextProps.disableNotifications !== disableNotifications) {
return true;
}
if (!dequal(nextProps.omnichannelPermissions, omnichannelPermissions)) {
return true;
}
@ -357,7 +361,7 @@ class RightButtonsContainer extends Component<IRightButtonsProps, IRigthButtonsS
render() {
const { isFollowingThread, tunread, tunreadUser, tunreadGroup } = this.state;
const { t, tmid, threadsEnabled, rid, colors, highlightTroubleshooting } = this.props;
const { t, tmid, threadsEnabled, rid, colors, highlightTroubleshooting, disableNotifications } = this.props;
if (t === 'l') {
if (!this.isOmnichannelPreview()) {
@ -382,12 +386,14 @@ class RightButtonsContainer extends Component<IRightButtonsProps, IRigthButtonsS
}
return (
<HeaderButton.Container>
<HeaderButton.Item
color={highlightTroubleshooting ? colors!.fontDanger : colors!.headerTintColor}
iconName='notification-disabled'
onPress={this.goToNotification}
testID='room-view-push-troubleshoot'
/>
{highlightTroubleshooting || disableNotifications ? (
<HeaderButton.Item
color={highlightTroubleshooting ? colors!.fontDanger : colors!.headerTintColor}
iconName='notification-disabled'
onPress={this.goToNotification}
testID='room-view-push-troubleshoot'
/>
) : null}
{rid ? <HeaderCallButton rid={rid} /> : null}
{threadsEnabled ? (
<HeaderButton.Item

View File

@ -515,6 +515,9 @@ class RoomView extends React.Component<IRoomViewProps, IRoomViewState> {
toggleFollowThread={this.toggleFollowThread}
showActionSheet={this.showActionSheet}
departmentId={departmentId}
// The properties of notification are saved on the object of room too
// @ts-ignore
disableNotifications={room.disableNotifications}
/>
)
});