Commit graph

500 commits

Author SHA1 Message Date
Michael Kirk cb9aa6304c find -E . -type f -regex ".*\.(m|h)" -exec sed -i "" -e "s/try_/throws_/" {} \; 2018-10-30 11:35:34 -06:00
Michael Kirk 3a6aafc454 Swift Exception wrap NSData+keyVersionByte 2018-10-30 11:35:34 -06:00
Michael Kirk ce9ca1bdaa audio player type 2018-10-24 07:46:27 -06:00
Michael Kirk 3b4188f34b hoist audio session singleton to Environment 2018-10-24 07:46:25 -06:00
Michael Kirk 3d022adf4e WIP: audio activities 2018-10-24 07:44:50 -06:00
Matthew Chen 0b4ed1175d Create AppEnvironment. 2018-10-15 15:08:37 -04:00
Matthew Chen f1d93d4472 Merge remote-tracking branch 'origin/release/2.30.2' 2018-10-12 16:00:42 -04:00
Matthew Chen 0b41e5e240 Rework profile fetch to reflect UD changes. 2018-10-04 11:56:37 -04:00
Michael Kirk f243914fe5 NSTemporaryDirectory -> OWSTemporaryDirectory/AccessibleAfterFirstAuth
Remove redundant move - AFNetworking alread moves the CFNetwork tmp file for
us.
2018-10-03 14:01:36 -06:00
Michael Kirk 006021ea41 Fix: group color change doesn't immediately apply
Because we were fetching a new thread instance, instead of updating the
existing thread instance, classes which were bound to the old thread instance
weren't updating. This affected the HeaderView.AvatarView.thread and the
ConversationStyle.thread.
2018-10-01 17:06:09 -06:00
Matthew Chen 0125535d4d Pull out SignalCoreKit. 2018-10-01 09:06:40 -04:00
Michael Kirk 06eae47e09 ConversationViewItem -> protocol 2018-09-28 12:58:33 -06:00
Matthew Chen ebae75af00 Revert 'new sort id'. 2018-09-27 19:40:51 -04:00
Michael Kirk c21020d7e7 Use received date for footer-collapse supression 2018-09-26 09:52:34 -06:00
Michael Kirk 6f8eddc955 unread indicator uses sortId
- removed timestamp parameter. This wasn't totally obvious, previously we were tracking two pieces of state

1. `unreadIndicator.firstUnseenTimestamp`:
    the first unseen timestamp for a conversation that exists in the database
2. `unreadIndicator.timestamp`:
    the timestamp of the first interaction *after* the unread indicator that fits in the loading window

We don't actually need to track `2` because it was only used in a comparison like:

   viewItem.interaction.timestampForSorting >= unreadIndicator.timestamp

But by definition, unreadIndicator.firstUnseenTimestamp is always less than or
equal to unreadIndicator.timestamp. Put into terms of the `sortId` corallary,
the sortId of the first unseen interaction in the database is always less than
or equal to the sortId of the first unseen interaction that fits in the loading
window.

In other words, there's no situation where

   viewItem.interaction.sortId >= unreadIndicator.firstUnseenSortId
2018-09-26 09:52:34 -06:00
Michael Kirk 3240e0d9d0 Be explicit about receivedAt time
We were often using `timestampForLegacySorting`, which is convoluted for when
we actually just want received time.

In some sense this is a superficial change, but it's part of auditing that
we've completed moved away from timestampForLegacySorting.
2018-09-26 09:52:34 -06:00
Michael Kirk b281b37637 replace thread.lastMessageDate/archivalDate -> thread.lastSortId, thread.archivedAsOfSortId
Update migration accordingly

Date shown on home view cell is message.receivedAt
2018-09-26 09:52:34 -06:00
Michael Kirk 90aa593dcd sortId vs. Read status 2018-09-26 09:52:33 -06:00
Michael Kirk d6d6c4fca4 ConversationVC - lastSeenSortId 2018-09-26 09:52:33 -06:00
Michael Kirk ab55e85304 step 1: timestampForSorting audit, change signature
No change in functionality in this commit, I just broke the signature to have a
systematic audit of the callsites. Added TODO's with the plan for each call.
2018-09-26 09:52:33 -06:00
Michael Kirk df61316495 minimize diff senderTimestamp -> timestamp 2018-09-26 09:52:33 -06:00
Michael Kirk 00d0d1e002 Remove legacy Error backdating - no changes in functionality
Historically we would backdate the SN change messages, but since adopting
non-blocking SN changes long ago, they're already sorted properly by creation
time, so backdating has been unnecessary for a while.

I also audited that all other error messages are saved directly after creation.

I applied deprecation attributes as appropriate as I audited.
2018-09-26 09:52:33 -06:00
Michael Kirk eef1368ad3 Timestamp audit step1: change signature
There is no change in functionality in this commit.

Apart from clarifying what the timestamp means (it's the timestamp of the
*sender*), this intentionally breaks all the call sites, so I could have a sane
way to thoroughly audit wherever we're passing in timestamps, to see where
we're depending on them to affect sort order.

For the sake of a cleaner diff of meaningful changes, instead of "fixing"
everything in this commit, I've just added comments and renamed signatures.
2018-09-26 09:52:33 -06:00
Matthew Chen 29bb69032a DRY up the debounce of db extension version increment. 2018-09-20 08:55:19 -04:00
Matthew Chen e1db60c1c0 Rework creation of singletons. 2018-09-19 15:11:26 -04:00
Michael Kirk 920a82564f Merge tag '2.29.3.3' 2018-09-15 09:17:08 -05:00
Michael Kirk 2eca462efc can view conversation settings for left group 2018-09-12 19:16:14 -05:00
Michael Kirk b1da5e93d9 group blocking v. conversation view 2018-09-12 19:16:14 -05:00
Michael Kirk eadb04efcc WIP: ContactViewHelper incorporates group blocking
-[ ] UI
  -[ ] Conversation Settings
    -[x] Show switch for group
    -[ ] localize
    -[ ] migrate existing localizations? (nice to have)
    -[ ] can view conversation settings (but not edit them) in left group
    -[ ] special block copy for groups
    -[ ] special unblock copy for groups
  -[ ] ConversationViewHelper
   -[x] Track blocked groups
   -[ ] HomeView
   -[ ] ConversationView
   -[ ] Any others?
   -[ ] Rename? Extract BlockList cache?
  -[ ] Block List
    -[ ] Group Section
    -[ ] Unblock group
  -[ ] Interstitial interacting with blocked threads (e.g. thread picker)
    -[ ] BlockListUIUtils w/ thread
        -[x] Block
        -[x] Unblock
        -[ ] Replace usages where possible
        -[x] block manager
-[ ] Sync
  -[x] tentative protos
  -[ ] confirm protos w/ team
  -[x] send new protos
-[ ] Message Processing
  -[ ] Drop messages from blocked groups
2018-09-12 19:16:14 -05:00
Matthew Chen df7acfeed3 Simplify OWSPreferences access. 2018-09-07 16:28:21 -04:00
Matthew Chen 3a12446be8 Modify environment accessors to use our 'shared' convention. 2018-09-07 16:20:41 -04: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 dc3467dcda Tidy up attachment usage. 2018-09-06 16:03:29 -04:00
Matthew Chen 498828f93c Rename AttachmentStream methods. 2018-09-06 15:30:00 -04:00
Michael Kirk 5d9cd86d13 size toolbar WRT draft 2018-09-04 10:38:43 -06:00
Matthew Chen fac7f6932f Rename TSGroupMetaMessage enum values. 2018-09-04 09:30:01 -04:00
Matthew Chen 1cc0fbcb12 Elaborate logging around 'perform updates' crash. 2018-08-28 15:41:58 -04:00
Matthew Chen f473f60111 Apply OWS log functions in Objective-C. 2018-08-27 12:58:52 -04:00
Matthew Chen cc5a480baa Apply OWS log functions in Objective-C. 2018-08-27 12:58:52 -04:00
Matthew Chen 03829779cc Apply OWS log functions in Objective-C. 2018-08-27 12:58:52 -04:00
Matthew Chen c0d486b1f1 Apply OWS log functions in Objective-C. 2018-08-27 12:58:52 -04:00
Matthew Chen 3a50377902 Apply OWS log functions in Objective-C. 2018-08-27 12:58:52 -04:00
Matthew Chen 713606271c Rename fail macros in Obj-C. 2018-08-27 10:29:51 -04:00
Michael Kirk 7e8b2e3034 Faster conversation presentation.
There are multiple places in the codebase we present a conversation.

We used to have some very conservative machinery around how this was done, for
fear of failing to present the call view controller, which would have left a
hidden call in the background. We've since addressed that concern more
thoroughly via the separate calling UIWindow.

As such, the remaining presentation machinery is overly complex and inflexible
for what we need.

Sometimes we want to animate-push the conversation. (tap on home, tap on "send message" in contact card/group members)
Sometimes we want to dismiss a modal, to reveal the conversation behind it (contact picker, group creation)
Sometimes we want to present the conversation with no animation (becoming active from a notification)

We also want to ensure that we're never pushing more than one conversation view
controller, which was previously a problem since we were "pushing" a newly
constructed VC in response to these myriad actions. It turned out there were
certain code paths that caused multiple actions to be fired in rapid succession
which pushed multiple ConversationVC's.

The built-in method: `setViewControllers:animated` easily ensures we only have
one ConversationVC on the stack, while being composable enough to faciliate the
various more efficient animations we desire.

The only thing lost with the complex methods is that the naive
`presentViewController:` can fail, e.g. if another view is already presented.
E.g. if an alert appears *just* before the user taps compose, the contact
picker will fail to present.

Since we no longer depend on this for presenting the CallViewController, this
isn't catostrophic, and in fact, arguable preferable, since we want the user to
read and dismiss any alert explicitly.

// FREEBIE
2018-08-24 08:54:23 -06:00
Matthew Chen b75bc27d55 Respond to CR. 2018-08-22 16:37:01 -04:00
Michael Kirk 93cb378f7a constantize toast inset 2018-08-21 10:18:13 -06:00
Michael Kirk 75ead2ac09 quoted reply: distinguish "not found" vs. "no longer available" 2018-08-20 14:59:52 -06:00
Michael Kirk c6f77ec6ea "Tap to retry" retries, rather than maybe deletes.
Attachment downloads can fail on slow networks or if the app crashes.
It's unlikely that the users response to this would be to delete the
attachment pointer, so it doesn't make sense to surface that as a
primary action.

If a user does want to delete the attachment, as always they can
long-press to delete.

// FREEBIE
2018-08-20 12:25:23 -06:00
Matthew Chen decb0c54ca Theme review. 2018-08-16 17:30:08 -04:00