Commit Graph

54 Commits

Author SHA1 Message Date
Matthew Chen
5cee24cef9 Refine group migrations. 2020-10-30 09:20:51 -03:00
Matthew Chen
ad6bda8a44 Rename singleton accessors. 2020-09-17 21:11:07 -03:00
Nora Trapp
18e19088a5 Fix broken tests 2020-08-28 13:10:47 -07:00
Fumiaki Yoshimatsu
e57724fa23 Wait async calls complete before moving on. 2020-08-28 09:42:44 -07:00
Michael Kirk
f927ef1b4b Batch Select / Delete 2020-03-20 19:36:48 -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
f406de7797 plumb through messageRequest circumstance when marking as read 2020-02-16 13:13:12 -07: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
Nora Trapp
4e0dd580c3 Fix iOS 13 SDK NSData scrubbing 2019-12-27 15:53:47 -08:00
Matthew Chen
f3286b755b Fix broken tests. 2019-12-11 20:41:57 -08:00
Matthew Chen
29150102cb Revert group and profile changes. 2019-12-11 20:41:54 -08:00
Matthew Chen
3d88f68cfb Rework new group new creation & group updates. 2019-12-04 15:40:54 -03:00
Matthew Chen
aefba8e0f5 Fix broken tests. 2019-08-23 09:44:16 -03:00
Michael Kirk
7e3f03d03f Swift interop: throwable method for DRY composable error handling 2019-08-15 09:36:57 -06:00
Matthew Chen
2a5683b843 Introduce storage coordinator. 2019-08-13 16:52:38 -03:00
Michael Kirk
7d4bfb8709 rename portion of DataSource -> Protocol 2019-08-12 15:11:40 -06:00
Matthew Chen
ebd45743c6 Convert interactions to BaseModel. Add typed 'any update with...' methods. 2019-07-18 15:44:36 -03:00
Michael Kirk
f8828958fa fixup broken attachments test 2019-07-03 15:31:34 -05:00
Nora Trapp
7d94af3287 Migrate TSContactThread to support UUIDs 2019-06-27 13:12:52 -07:00
Matthew Chen
7053b86f08 Respond to CR. 2019-06-25 16:00:58 -04:00
Matthew Chen
c8359fc932 Convert message sending to use any transactions. 2019-06-25 16:00:58 -04:00
Matthew Chen
3c112b7da5 Respond to CR. 2019-06-24 15:52:26 -04:00
Matthew Chen
e26a8e1bd4 Convert attachments to be any-only. 2019-06-24 15:34:02 -04:00
Michael Kirk
cd400e2912 convert factories to AnyWrite 2019-05-30 18:28:06 -06:00
Michael Kirk
691209e25e Decrypt Messages with AnyTransaction
- Migrate protocol stores to KVStores
- Introduce AnyDatabaseQueue
- Move messaging pipeline to AnyTransactions
- Migrate specialized PushDecrypt job to generic JobQueue
2019-05-21 16:20:22 -04:00
Matthew Chen
0024705254 Add sticker suggestions for emoji input. 2019-05-03 09:22:41 -04:00
Matthew Chen
a81acfa788 Apply asAnyRead/Write convenience methods. 2019-04-30 10:11:19 -04:00
Matthew Chen
a5a50e572d Add simple unit test around SDSDatabaseStorage, serialization, etc. 2019-04-11 11:58:44 -04:00
Michael Kirk
b95dcd4ae3 fix broken test 2019-01-07 12:51:35 -07:00
Michael Kirk
e2ad9d81bb attachment factory
flesh out other factory builders
2018-11-11 11:28:59 -06:00
Michael Kirk
06eae47e09 ConversationViewItem -> protocol 2018-09-28 12:58:33 -06:00
Matthew Chen
98630cca50 Respond to CR; add db utility methods to test base classes. 2018-09-21 09:21:34 -04:00
Matthew Chen
3935b019f4 Add base class for tests. 2018-09-10 17:30:18 -05:00
Matthew Chen
f9eab5cd24 Merge remote-tracking branch 'origin/release/2.29.2' 2018-09-07 15:27:50 -04:00
Michael Kirk
c7662b5a86 Step 2/2 %s/OWSAssert/OWSAssertDebug for existing previous assert semantics
Going forward, we want to prefer safer asserts, but we don't want to blindly
apply crashing asserts across the codebase
2018-09-07 10:00:48 -06:00
Matthew Chen
498828f93c Rename AttachmentStream methods. 2018-09-06 15:30:00 -04:00
Matthew Chen
2c9c028504 Clean up. 2018-08-09 09:51:23 -06:00
Matthew Chen
03a9b21cfd Respond to CR. 2018-08-03 14:35:22 -04:00
Michael Kirk
c19a8ce07e Fixup tests
// FREEBIE
2018-07-17 18:17:17 -06:00
Matthew Chen
1607aa7f57 Image content types. 2018-06-20 17:13:31 -04:00
Matthew Chen
9085609087 Fix interaction initializers and tests. 2018-04-05 09:36:52 -04:00
Michael Kirk
00e5e1b0d6 Fixup some tests
// FREEBIE
2018-04-03 11:29:05 -04:00
Michael Kirk
05035e40a6 Fixup tests
// FREEBIE
2018-01-25 11:00:38 -05:00
Michael Kirk
71bafcc8f0 Search SignalAccounts by profile name
...and fixup some tests
2017-12-04 12:52:59 -05:00
Matthew Chen
ddf4bf28cc Load attachments for conversation view items using long-lived db connection. 2017-11-16 13:16:18 -05:00
Matthew Chen
c8c09ec19c Respond to CR.
// FREEBIE
2017-10-25 16:21:10 -04:00
Matthew Chen
3927815a35 Fix tests broken by the JSQ rewrite.
// FREEBIE
2017-10-25 16:08:15 -04:00
Matthew Chen
fb408f980c Remove JSQ.
// FREEBIE
2017-10-12 16:23:48 -04:00
Matthew Chen
1e67bb52e3 Respond to CR.
// FREEBIE
2017-07-12 13:18:03 -04:00
Matthew Chen
f584c4b434 Fix broken tests.
// FREEBIE
2017-07-12 12:14:15 -04:00