Skip to content

Commit ac66f8c

Browse files
authored
[CIS-2159] Fix message list not reloading skipped messages (#2267)
1 parent 6428ff9 commit ac66f8c

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

Sources/StreamChatUI/ChatMessageList/ChatMessageListView.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,9 @@ open class ChatMessageListView: UITableView, Customizable, ComponentsProvider {
251251
internal func reloadSkippedMessages() {
252252
skippedMessages = []
253253
newMessagesSnapshot = currentMessagesFromDataSource
254+
onNewDataSource?(newMessagesSnapshot)
254255
reloadData()
255-
DispatchQueue.main.asyncAfter(deadline: .now() + 0.2) {
256-
self.scrollToMostRecentMessage()
257-
}
256+
scrollToMostRecentMessage()
258257
}
259258
}
260259

StreamChatUITestsAppUITests/Tests/MessageList_Tests.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,30 @@ final class MessageList_Tests: StreamTestCase {
341341
}
342342
}
343343

344+
func test_reloadsSkippedMessages_whenScrolledToTheBottom() throws {
345+
linkToScenario(withId: 289)
346+
347+
try XCTSkipIf(ProcessInfo().operatingSystemVersion.majorVersion == 12,
348+
"[CIS-2020] Scroll on message list does not work well enough")
349+
350+
GIVEN("user opens the channel") {
351+
backendRobot.generateChannels(count: 1, messagesCount: 30)
352+
userRobot.login().openChannel()
353+
}
354+
AND("user scrolls up") {
355+
userRobot.scrollMessageListUpSlow()
356+
}
357+
AND("participant sends some messages") {
358+
participantRobot.sendMultipleMessages(repeatingText: "Some message", count: 16)
359+
}
360+
WHEN("user scrolls to the bottom") {
361+
userRobot.tapOnScrollToBottomButton()
362+
}
363+
THEN("skipped messages are reloaded") {
364+
userRobot.assertMessageIsVisible("Some message-16")
365+
}
366+
}
367+
344368
func test_commandsPopupDisappear_whenUserTapsOnMessageList() {
345369
linkToScenario(withId: 98)
346370

0 commit comments

Comments
 (0)