deltachat / deltachat-ios

Email-based instant messaging for iOS.
Other
319 stars 51 forks source link

Create virtual list for messages #614

Closed cyBerta closed 4 years ago

cyBerta commented 4 years ago

As a precondition to fix #602 we need to be able to refer to the whole list of chat messages, not only the last N as currently implemented using a pull-to-refresh mechanism. The pull-to-refresh can be removed completely.

cyBerta commented 4 years ago

while implementing #746 I stumbled over the following issue: https://github.com/MessageKit/MessageKit/issues/1119

Bottom line: MassageKit has currently issues with big data sets. The underlying problem is that MessageKit uses UICollectionViewFlowLayout to display chat messages. UICollectionViewFlowLayout calculates all cell sizes on initialization even for cells that are not visible on the screen. The current implementation uses a pull-to-refresh mechanism in order to keep small data sets.

I think we're coming to a point where we should switch the UI framework and implement an easy solution using a UITableViewController that is able to load and render only the data that is currently visible on the screen. Alternatively we could hack further on MessageKit implementing the PrefetchAPI for UICollectionViews. In that case we would open a chat with a small dataset and load more data if the user arrives at the top of the list. It still will be tricky to solve #602 in that case.

nayooti commented 4 years ago

Thaaaank youuuuuu!

cyBerta commented 4 years ago

implemented in https://github.com/deltachat/deltachat-ios/pull/892