Skip to content

Commit c707fe7

Browse files
Implemented channel config for read events
1 parent de372c6 commit c707fe7

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

Sources/StreamChatSwiftUI/ChatChannel/MessageList/MessageContainerView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ struct MessageContainerView<Factory: ViewFactory>: View {
140140
if showsAllInfo && !message.isDeleted {
141141
if isInGroup && !message.isSentByCurrentUser {
142142
MessageAuthorAndDateView(message: message)
143-
} else if message.isSentByCurrentUser {
143+
} else if message.isSentByCurrentUser && channel.config.readEventsEnabled {
144144
HStack(spacing: 4) {
145145
factory.makeMessageReadIndicatorView(
146146
channel: channel,

Sources/StreamChatSwiftUI/ChatChannelList/ChatChannelListItem.swift

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ public struct ChatChannelListItem: View {
6969
}
7070

7171
HStack(spacing: 4) {
72-
if let message = channel.latestMessages.first,
73-
message.isSentByCurrentUser,
74-
!message.isDeleted {
72+
if shouldShowReadEvents {
7573
MessageReadIndicatorView(
7674
readUsers: channel.readUsers(
7775
currentUserId: chatClient.currentUserId
@@ -91,6 +89,16 @@ public struct ChatChannelListItem: View {
9189
.id("\(channel.id)-base")
9290
}
9391

92+
private var shouldShowReadEvents: Bool {
93+
if let message = channel.latestMessages.first,
94+
message.isSentByCurrentUser,
95+
!message.isDeleted {
96+
return channel.config.readEventsEnabled
97+
}
98+
99+
return false
100+
}
101+
94102
private var shouldShowTypingIndicator: Bool {
95103
!channel.currentlyTypingUsersFiltered(
96104
currentUserId: chatClient.currentUserId

0 commit comments

Comments
 (0)