[lib] Introduce ChatThreadItemLoaderCache
Summary:
This is the core of the work to address ENG-9952.
Prior to this stack, we would kick off Promises for each thread. At the end of the stack, we want to only kick off enough Promises to generate the "guaranteed top N", which can be thought of "if every Promise was resolved, which would be in the top N"?
We are able to achieve this guarantee using the "at most time", which was introduced in D14136. Most of the magic is in the loadMostRecent function.
Depends on D14139
Test Plan: I tested this task by playing around with the ChatThreadList on mobile while using a stopwatch to measure how long various operations took. I tested the updated code 3 times against both the most recent Testflight build as well as master. I found that performance was approximately the same as before. I tested scrolling down, selecting threads that were read, selecting threads that were unread, and search.
Reviewers: tomek, angelika
Reviewed By: tomek
Differential Revision: https://phab.comm.dev/D14140