Commit Graph

75 Commits

Author SHA1 Message Date
Ehren Kret
9b6526545e Remove unused variables 2022-05-27 00:13:17 -05:00
Evan Hahn
d2836235af Show additional details for subscription charge failures
In c5bdf6c094, we started to show errors
when a subscription failed to renew because of a charge failure.

Now, we show additional text depending on what the charge failure was.
For example, if you had an invalid card number, we show a special string
for that.
2022-05-25 18:17:53 +00:00
Evan Hahn
baddc85564 Add first gift badge screen
This adds the first screen for badge gifting. It lets you see the gift
badge, pick the currency, and advance to the next screen.

It also adds a skeleton for the next screen, so there's somewhere to
advance to, but that screen is unfinished.

All of this is behind disabled flags, so this should have no user
impact.
2022-05-19 14:07:23 +00:00
Evan Hahn
4c0e511793 Fix typos in localization string comments
I noticed a few typos in localization string comments while working on
c5bdf6c094. This fixes those.

This should have no (direct) user impact.
2022-05-16 12:26:31 -05:00
Evan Hahn
c5bdf6c094 Improve subscription charge error UI
Currently, when your subscription expires due a charge failure, we
incorrectly tell you that it's due to inactivity. This fixes that, by
telling you about the charge failure.

This is a bit difficult to test on its own, so I:

- Faked out the smallest pieces I could in an effort to test states
  manually
- Created `BadgeErrorSheetState` which is pretty thoroughly tested
2022-05-12 18:28:14 -05:00
Jordan Rose
182e97f02c Revert "MediaGallery: Separate the lazy loading logic into a testable MediaGallerySections"
This reverts commit 4e37af097b.
2022-05-10 10:34:57 -07:00
Jordan Rose
4e37af097b
MediaGallery: Separate the lazy loading logic into a testable MediaGallerySections
MediaGallery models a list of GalleryDate-based sections (in practice, months), each of which has a certain number of items. Sections are loaded on demand (that is, there may be newer and older sections that are not in the model), and always know their number of items. Items are also loaded on demand, potentially non-contiguously. This model is designed around the needs of UICollectionView (a thread's All Media view), but it also supports flat views of media (swiping between items in the media detail view, which can cross album boundaries).

This model is a result of refactoring I did last year to improve the performance and UX of the All Media view, but the implementation in MediaGallery.swift is entangled with the actual attachments and messages in the database, making it hard to test. This commit pulls the state management part out into its own struct, MediaGallerySections, which wraps the OrderedDictionary of items-by-section. Our MediaGalleryItem model references TSAttachmentStream directly and our queries go straight to the database, so to avoid having to set up real attachments in testing, MediaGallerySections is generic over a loader (delegate? data source?) of items with "gallery dates" and unique IDs. Now all the basic section- and item-loading APIs can be unit-tested.
2022-05-09 18:04:12 -07:00
Jordan Rose
1689aec8c6 Don't linkify a truncated URL until the user expands the message body
This is implemented by seeing if a data-detected item is at the very
end of a truncated string, in which case it isn't trusted to be
complete. This applies not only to URLs, but to other data-detected
items as well like emails and addresses. It's also specific to
truncated text since a user could very well type an ellipsis in their
actual message, and *that* shouldn't prevent linkification.

It's possible that an item at the very end of a truncated string *is*
complete (i.e. the truncation point was just *after* the URL), but we
can't be sure without comparing to the full text or storing additional
information, and that's trickier for a number of reasons. The user can
still expand the message and get the linkification in this case.
2022-05-06 10:56:45 -07:00
Matthew Chen
9176ce6309 Add SignalUI framework target. 2021-10-19 09:39:54 -03:00
Michelle Linington
744c527233 Fix tests 2021-08-26 22:47:07 -07:00
Michelle Linington
6417494bc3 Fix tests 2021-08-19 16:54:29 -07:00
Matthew Chen
69d89a0f7f Respond to CR. 2021-08-09 21:29:58 -03:00
Matthew Chen
8e076223aa Respond to CR. 2021-08-09 21:29:58 -03:00
Eugene Bistolas
1dd962d9f7 Multi-Select Animations 2021-06-29 15:36:50 -10:00
Matthew Chen
e9f8f8486f Fix broken and failing tests. 2021-06-07 11:41:52 -04:00
Matthew Chen
010b135ab0 Add CVBodyTextLabel. 2021-06-02 20:42:55 -04:00
Matthew Chen
50e83385d5 Fix chat color stability. 2021-05-25 16:22:34 -03:00
Nora Trapp
d0da9422ec System message wallpaper styling. 2021-01-21 17:00:17 -08:00
Nora Trapp
6f096e85db Fix text measurement bug 2020-12-23 10:49:48 -08:00
Nora Trapp
53c56d3ce6 Fix text measurement 2020-12-22 12:27:07 -08:00
Matthew Chen
111338b59d Rewrite conversation view. 2020-12-10 12:44:13 -03:00
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