Commit Graph

21 Commits

Author SHA1 Message Date
Nora Trapp
e262b45b26 Tune message paging 2020-06-16 12:31:00 -07:00
Nora Trapp
f26385f065 Apply diffs to conversation view when loading additional messages 2020-06-12 13:42:51 -07:00
Nora Trapp
3698125424 Track reaction read state 2020-04-20 10:25:31 -07:00
Michael Kirk
519c1ca53c fix intermittent failure to load search items
If the load result is contiguous with the already loaded items, we append
rather than replace.

background:

We have 4 load flavors:
    - load older (scrolling up)
    - load more recent (scrolling down after unload)
    - load most recent (initial page load or scroll down button)
    - load around (arbitrary jump from search results or tapping quoted reply)

Previously only "load earlier" and "load later" would append their results to
the existing loaded items, trimming if necessary.

"load most recent" and "load around" would not append, instead they'd replace
the existing loaded items, since the loaded items might not be contiguous with
the existing loaded items.

An optimization we have is that when given a load request, we compare to the
already-loaded items to determine which "unfetched" items from the request
actually need to be fetched.

The error: we consulted the already-loaded items for "load most recent" and
"load around" modes, which discard the previously-loaded items to avoid
introducing a discontinuity in case the fetched items are far away in message
history.

Pseudo code example:

    // given these already loaded items
    alreadyLoaded = [1, 2, 3, 4, 5]

    // if we have a search result for message 5, we'll request to "load around" 5
    requestLoadedAround(5) ->
      // we'll generate a request set around 5
      requestSet = (3..<8)

      // The problem is here, when we remove already-loaded items
      unfetched = requestSet - alreadyLoaded // == [6, 7, 8]

      // Since "load around" replaced the loaded set, rather than appending to
      // it, we inadverently lost some important items (3, 4, 5) from our
      // request set.
      alreadyLoaded = unfetched

A simple solution would be to not consider alreadyLoaded when replacing rather than appending -
for "load around" or "load most recent" but not for "load older" and "load more recent".

    alreadyLoaded = [1, 2, 3, 4, 5]

    requestLoadedAround(5) ->
      requestSet = (3..<8)

      // fetch everything rather than worry about removing the
      // already-fetched-items
      unfetched = requestSet

      alreadyLoaded = unfetched

When we're making large discontiguous jumps in the conversation history this
behavior of replacing rather than appending is unavoidable, but when doing
short hops it's wasteful to lose the already loaded items.

So now, whether the load be via "load older", "load more recent", "load most
recent", or "load around" - whenever the fetched items are contiguous with the
already loaded items, we append rather than replace.
2020-03-12 11:43:32 -06:00
Michael Kirk
896b53a32d Fix crash in message mapping when deleting lots of messages in a smallish conversation 2020-01-07 18:36:30 -07:00
Michael Kirk
bf3d17ef36 Fix media zoom crash vs. thread details 2020-01-02 17:45:48 -07:00
Michael Kirk
fdcbf274bc fixup overzealous assert 2020-01-02 14:09:57 -07:00
Michael Kirk
884f09ea5a Windowed conversation loading 2019-12-31 14:29:32 -08:00
Michael Kirk
c165d31d13 Explanatory text for Note To Self 2019-12-05 10:45:32 -07:00
Nora Trapp
129535f2d7 Merge branch 'release/2.42.0' 2019-08-29 15:21:40 -07:00
Nora Trapp
686e439106 Restore contact offer 2019-08-29 10:15:30 -07:00
Michael Kirk
8e73133ffe reload ThreadDetails ViewItem whenever its present 2019-08-22 11:22:03 -06:00
Michael Kirk
952fa2823f perf: Avoid repeated re-fetching of interactions
Previously:
- ConversationMapping determines which uniqueIds are in the conversation window
- ConversationViewModel fetched (and frequently refetched) interactions from those ids

Now:
- ConversationMapping determines which interactions are in the conversation window
- ConversationViewModel grabs the already fetched interactions from the conversation mapping
2019-08-22 11:22:03 -06:00
Nora Trapp
86c3211609 Don't show thread details in note to self 2019-08-15 14:09:01 -07:00
Michael Kirk
f1eac5c0ef Fix crash when presenting media.
ThreadDetailView has a cell, but wasn't accounted for in the conversation
mapping, so our index calculations were off-by-one.
2019-08-09 13:51:23 -06:00
Michael Kirk
e66a38e12b remove try from methods which no longer throw 2019-05-22 16:03:07 -04:00
Michael Kirk
3c7f994b34 DB updates UI
-[x] uiRead from Snapshot
-[x] update snapshot after writes
-[x] notify observers of change
-[x] external notifications
2019-05-02 14:22:53 -06:00
Michael Kirk
ee3697793a GRDB adapter for message mapping 2019-04-10 16:28:18 -06:00
Michael Kirk
71dd4eb151 in-conversation search
- use MediaTime for computing benchmarks
2019-02-28 16:19:16 -07:00
Matthew Chen
f90e49226d Respond to CR. 2019-01-07 12:47:15 -05:00
Matthew Chen
c775dbcd66 Introduce conversation view mapping; rework conversation view scrolling. 2019-01-07 12:47:15 -05:00