Skip to content

Commit

Permalink
QA fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmitrevski committed Dec 7, 2023
1 parent ea71f33 commit 0e4166a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
updateScrolledIdToNewestMessage()
}

if lastMessageRead != nil && firstUnreadMessageId == nil {
if lastReadMessageId != nil && firstUnreadMessageId == nil {
firstUnreadMessageId = channelDataSource.firstUnreadMessageId
}
}
Expand Down Expand Up @@ -691,6 +691,9 @@ open class ChatChannelViewModel: ObservableObject, MessagesDataSource {
if messageController == nil {
utils.channelControllerFactory.clearCurrentController()
ImageCache.shared.trim(toCost: utils.messageListConfig.cacheSizeOnChatDismiss)
if !channelDataSource.hasLoadedAllNextMessages {
channelDataSource.loadFirstPage { _ in }
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,10 @@ public struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
ForEach(messages, id: \.messageId) { message in
var index: Int? = messageListDateUtils.indexForMessageDate(message: message, in: messages)
let messageDate: Date? = messageListDateUtils.showMessageDate(for: index, in: messages)
let messageIsFirstUnread = message.messageId == firstUnreadMessageId ||
message.id == firstUnreadMessageId
let showUnreadSeparator = messageListConfig.showNewMessagesSeparator && messageIsFirstUnread
let messageIsFirstUnread = firstUnreadMessageId?.contains(message.id) == true
let showUnreadSeparator = messageListConfig.showNewMessagesSeparator &&
messageIsFirstUnread &&
!isMessageThread
let showsLastInGroupInfo = showsLastInGroupInfo(for: message, channel: channel)
factory.makeMessageContainerView(
channel: channel,
Expand Down Expand Up @@ -291,7 +292,7 @@ public struct MessageListView<Factory: ViewFactory>: View, KeyboardReadable {
}
})
.overlay(
(channel.unreadCount.messages > 0 && !unreadMessagesBannerShown) ?
(channel.unreadCount.messages > 0 && !unreadMessagesBannerShown && !isMessageThread) ?
factory.makeJumpToUnreadButton(
channel: channel,
onJumpToMessage: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ extension MessageAction {

messageActions.append(deleteAction)
} else {
if !message.isPartOfThread {
if !message.isPartOfThread || message.showReplyInChannel {
let markUnreadAction = markAsUnreadAction(
for: message,
channel: channel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ extension ChatChannel: Identifiable {
}

public var id: String {
"\(cid.id)-\(lastMessageAt ?? createdAt)-\(lastActiveMembersCount)-\(mutedString)-\(typingUsersString)-\(readUsersId)"
"\(cid.id)-\(lastMessageAt ?? createdAt)-\(lastActiveMembersCount)-\(mutedString)-\(typingUsersString)-\(readUsersId)-\(unreadCount.messages)"
}

private var readUsersId: String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class MessageActions_Tests: StreamChatTestCase {
XCTAssert(messageActions[1].title == "Thread Reply")
XCTAssert(messageActions[2].title == "Pin to conversation")
XCTAssert(messageActions[3].title == "Copy Message")
XCTAssert(messageActions[4].title == "Mark Unread")
XCTAssert(messageActions[4].title == "Mark Unread")
XCTAssert(messageActions[5].title == "Flag Message")
XCTAssert(messageActions[6].title == "Mute User")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class MessageListView_Tests: StreamChatTestCase {
let reactions = [MessageReactionType(rawValue: "like"): 2]
let channel = ChatChannel.mockDMChannel(
config: channelConfig,
currentlyTypingUsers: currentlyTypingUsers,
currentlyTypingUsers: currentlyTypingUsers,
unreadCount: unreadCount
)
let temp = [ChatMessage.mock(
Expand Down

0 comments on commit 0e4166a

Please sign in to comment.