-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CIS-2084, CIS-2085] New Message List Diffing Implementation #2226
[CIS-2084, CIS-2085] New Message List Diffing Implementation #2226
Conversation
…always to DiffChatMessage
Since the this was actually not causing the messages to jump
📏 Size AnalysisTotal install size 9.6 MB | This change: ⬆️ +45.7 kB (+0.476%)🗂 See size breakdown
🔎 See the full size analysis (c5b16c5) merging into develop (86daace)
|
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @nuno-vieira 👏 . It seems much more stable now, and the performance is better.
I've noticed few issues that we need to fix before merging:
- bug with pagination broken (see comments)
- reactions don't work when in "skip inserts" mode (also in comments)
Additionally, we would need some tests before we can merge it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks really good, I am just concerned with certain pieces of custom logic. We don't want this evolution to end up being like the previous one where it was full of patches and custom logic.
Also, we should be embedding DifferenceKit as part of StreamChatUI
4bdf4f1
to
2e3e59a
Compare
…nserted while skipping messages This caused some data concurrency issues because a lot of data updates are triggered. In order to avoid this reloadData() is much more safe.
It was using the data controller directly, instead of the data source messages
ceb4fae
to
eba3eae
Compare
Kudos, SonarCloud Quality Gate passed! |
* Add cell heights cache so that new contentSize calculation is more precise * Remove `_messageListDiffingEnabled` flag and diffable data source implementation * WIP DifferenceKit * Move DiffKit logic to Message List only * Improve performance by using ChatMessage directly instead of mapping always to DiffChatMessage * Improve performance of the message list by skipping channel list updates * Disable animations when loading new messages Since the this was actually not causing the messages to jump * Fix not loading previous messages when there are skipped messages * Add `ListChange` helpers * WIP Skipping Messages * Move the skipping logic to the message list view * Improve the performance of Message Content Equality * Fix Giphy not updating the UI when moved from original position * Add code docs to cell height cache + channel list skip rendering * Add comments explaining CATransaction in DiffKit reload * Update CHANGELOG.md * Update documentation of our dependencies * When skipping messages, only skip insertions, not all updates * Improve the readability of skipping messages * Always store the original messages from the data source to avoid data inconsistencies * Provide comments for the new introduced methods * Add Sentry dependency to DemoApp and remove it from StreamChat * Properly add DifferenceKit dependency * Ignore third party dependencies when formatting code with SwiftFormat * Add required declarations changes to DiffKit dependency Also adds a function to make the removePublicDeclarations.sh more readable * Undo changes on SwiftyMarkdown done by our SwiftFormat * Add missing required declaration changes to DiffKit Source files * Move DiffKit logic to the correct files * Add missing message id comparison in ChatMessage Content Equality * Fix crash when message from same user but with difference device is inserted while skipping messages This caused some data concurrency issues because a lot of data updates are triggered. In order to avoid this reloadData() is much more safe. * Remove willUpdateMessages events since it is actually not needed * Fix message cell layout options not being correctly calculated It was using the data controller directly, instead of the data source messages * Make sure to use the messages from the data source in ChatThreadVC * When a message is hard deleted, make sure to reload the previous cell * Fix thread root message not being updated * Fix and Add missing coverage to ChannelListVC * Fix E2E Tests + First message from participant not appearing * Fix updating replyCount of the parent message in E2E Tests * Fix Xcode 12 compilation * Add E2E Test to coverage giphy message move scroll to bottom case * Fix false positives when asserting messages in E2E Tests * Add E2E Test case for when hard deleting last message from group * Add unit test coverage to when should reload skipped messages * Improve ListChange test coverage
🔗 Issue Links
CIS-2084
CIS-2085
#2094
Bonus:
#2184
CIS-1965
🎯 Goal
The goal of this PR is to fix the crashes in the message list related to data inconsistencies in
performBatchUpdates
and also to fix the message list jumps when receiving multiple messages and the user is scrolled up.📝 Summary
StreamChatUI
._messageListDiffingEnabled
flag, since now we only have 1 implementation of the message list and it is not experimental anymoreListChange
updates fromStreamChat
, now theStreamChatUI
applies changes from the diffing calculation of the old messages snapshot, and the newest message snapshotPerformance Improvements:
All tests were performed in an iPhone XR iOS 15.5 and for an interval of 10s.
Loading previous messages continuously
Scrolling while inserting multiple new messages at the bottom through stress test script
🎨 Showcase
RPReplay_Final1660064107.MP4
RPReplay_Final1660064236.MP4
🧪 Manual Testing Notes
☑️ Contributor Checklist
🎁 Meme