Commit graph

253 commits

Author SHA1 Message Date
Matthew Chen
04a3e4323c Respond to CR.
// FREEBIE
2017-03-21 13:00:48 -04:00
Matthew Chen
8231f79977 Don’t check content length header until we’ve received at least one byte of the attachment download.
// FREEBIE
2017-03-21 09:49:51 -04:00
Matthew Chen
2c61943537 Abort attachment downloads of excessive size.
// FREEBIE
2017-03-20 18:16:57 -04:00
Michael Kirk
d3af0d3a27 Merge pull request #135 from WhisperSystems/mkirk/fix-attachment-dispatch
Only call sendMessage on main thread.
2017-03-20 16:07:57 -04:00
Michael Kirk
29a0597b0c Only call sendMessage on main thread.
The proximate cause for this change was a failing assert in the recently
introduced call to `setBackgroundTaskIdentifier` which is synchronized
on the main thread.

But generally, to keep things simple, we prefer calling back on main
thread unless performance dictates otherwise.

// FREEBIE
2017-03-20 15:59:45 -04:00
Michael Kirk
ca5bcaf3c2 Merge branch 'mkirk/refactor_country_code_search' 2017-03-20 15:23:01 -04:00
Michael Kirk
c8fa47d9c9 Added some tests per CR
// FREEBIE
2017-03-20 15:22:34 -04:00
Michael Kirk
d3ecbba0e8 Keep unit tests with their class files
Moved from Signal-iOS and updated to use standard XCTest macros vs. our
test-util's

// FREEBIE
2017-03-20 15:11:11 -04:00
Thomas Guillet
478b5b247a Remove convoluted dependency
of PhoneNumberUtil to ContactsManagerProtocol

Also moved tests from Signal-iOS repository here.
2017-03-20 15:11:11 -04:00
Michael Kirk
778d3dd2bc Merge branch 'mkirk/background-sending' 2017-03-20 15:00:20 -04:00
Michael Kirk
58829e2162 ensure we don't interrupt sending by being backgrounded
// FREEBIE
2017-03-20 15:00:09 -04:00
Michael Kirk
15f5c078a1 Merge branch 'mkirk/nsoperation-sending-queue' 2017-03-20 14:57:26 -04:00
Michael Kirk
e68ee28e51 Add clarifying asserts per code review
// FREEBIE
2017-03-20 14:57:05 -04:00
Michael Kirk
db15ff5e87 Save message before sending starts.
Otherwise the message doesn't get saved until it's in the queue.
Interestingly, this could also address some of the perceived lag
mentioned in: https://github.com/WhisperSystems/Signal-iOS/pull/1850

// FREEBIE
2017-03-20 14:53:42 -04:00
Michael Kirk
df51523a84 Serialize message sending and generalized retry logic.
Previously messages could be sent out of order if (e.g.)

1. You're on a slow network
2. You send a big attachment
3. You immediately send text

Generally in this scenario, the text will be sent before the attachment.

Also, introduced a more general retry loop to retry on *any* failure
during sending.

Previously the only retry logic was around the messages API on the
Signal Server.

Now we'll also retry failures when allocating an attachment, or
uploading an attachment.

TODO: remove the now redundant retry logic in the message sender?

TODO: there is still one place where we send messages directly through
the MessageSender, rather than via the operation - when resending to a
group due to a safety number change. This is separate logic because we
were being sure to *only* resend to that one recipient. Cleaning this up
would move a lot of code around.

Once Signal-Desktop implements timestamp based de-duping we could shave
that wart by having this troublesome codepath use NSOperation like
everything else.

// FREEBIE
2017-03-20 14:53:42 -04:00
Michael Kirk
d6af5028ca Fix receiving attachments from old clients
Protobuf's null-object pattern provides an empty NSData when no digest
is provided rather than nil.

// FREEBIE
2017-03-20 14:48:45 -04:00
Matthew Chen
312f398ddd Merge branch 'charlesmchen/nonUSNonContactSearch' 2017-03-16 13:53:32 -03:00
Matthew Chen
332833da7b Respond to CR.
// FREEBIE
2017-03-16 13:53:06 -03:00
Matthew Chen
60e0ddfb92 Fix non-contact lookup for non-US users.
// FREEBIE
2017-03-16 13:31:14 -03:00
Matthew Chen
e12bd4773a Fix non-contact lookup for non-US users.
// FREEBIE
2017-03-16 13:31:14 -03:00
Matthew Chen
7368c5f754 Merge branch 'charlesmchen/fixFilterCallingCodes' 2017-03-16 13:21:34 -03:00
Matthew Chen
d63a519c43 Fix filtering of country codes in registration flow.
// FREEBIE
2017-03-16 13:21:21 -03:00
Matthew Chen
ca81e139bb Merge branch 'charlesmchen/attachmentDownloadErrors' 2017-03-15 18:10:33 -03:00
Matthew Chen
c8efd83c39 Respond to CR.
// FREEBIE
2017-03-15 12:37:59 -03:00
Matthew Chen
88f343a0aa Attempt to fix the "frequent attachment download errors with low server ids".
// FREEBIE
2017-03-15 12:17:54 -03:00
Matthew Chen
7867ce27a8 Merge branch 'charlesmchen/messageStateIndicators' 2017-03-15 10:55:06 -03:00
Matthew Chen
25ab52caf2 Respond to CR.
// FREEBIE
2017-03-15 10:54:45 -03:00
Matthew Chen
865d9d7b96 Add "is uploaded" property to attachment streams.
// FREEBIE
2017-03-15 10:17:41 -03:00
Matthew Chen
27fb0dd34c Merge branch 'charlesmchen/websocketState' 2017-03-14 14:10:22 -03:00
Matthew Chen
e4636e8336 Respond to CR.
// FREEBIE
2017-03-14 14:09:57 -03:00
Matthew Chen
958dbd199b Minor clean up.
// FREEBIE
2017-03-14 13:34:20 -03:00
Matthew Chen
f40629ffa0 Improve alignment between socket state and socket manager state.
// FREEBIE
2017-03-14 13:34:20 -03:00
Michael Kirk
b21c628d56 Merge branch 'mkirk/attachment-digest'
// FREEBIE
2017-03-13 12:33:22 -04:00
Michael Kirk
8f1412d502 comment constant time compare per code review
// FREEBIE
2017-03-13 12:32:35 -04:00
Michael Kirk
452110b687 Include digest in attachments
- constant time compare
- free buffer passed to NSData

// FREEBIE
2017-03-13 12:32:35 -04:00
Matthew Chen
32ac0fb7c9 Merge branch 'charlesmchen/paste' 2017-03-12 09:09:59 -03:00
Matthew Chen
e05b687438 Respond to CR.
// FREEBIE
2017-03-12 09:08:50 -03:00
Matthew Chen
270a10a62a Add UTIType methods to MIMETypeUtil.
// FREEBIE
2017-03-11 20:36:21 -03:00
Michael Kirk
1e6925ebc1 Fix crash-on-launch for older installs
populating the de-duping index assumes authorId is always set for
incoming messages, but this was not always the case.

// FREEBIE
2017-03-03 15:32:18 -05:00
Michael Kirk
0393e4f0b4 fix tests
// FREEBIE
2017-02-24 19:20:35 -08:00
Michael Kirk
168639597f Merge branch 'mkirk/dedupe-incoming-messages' 2017-02-24 19:18:15 -08:00
Michael Kirk
a92158ef16 CR: fix register async where specified
* fix thread test
* add IncomingMessageFinder test
* use constants
* clearer comments

// FREEBIE
2017-02-24 19:15:35 -08:00
Michael Kirk
b389bb3bb8 Code cleanup.
No need to use contactThread method to get recipient ID since we still
have the envelope.

And with that, it's pretty easy to justify getting rid of one of our now
barely used IncomingMessage initializers.

// FREEBIE
2017-02-24 19:15:35 -08:00
Michael Kirk
975726e022 Dedupe incoming messags
// FREEBIE
2017-02-24 19:15:35 -08:00
Matthew Chen
d6e1e81a8a Merge branch 'charlesmchen/callkitPrivacy' 2017-02-23 07:01:49 -08:00
Matthew Chen
52bb939fc1 Respond to CR.
// FREEBIE
2017-02-23 07:01:24 -08:00
Matthew Chen
71b804ba52 Add and honor the “CallKit Privacy” setting.
// FREEBIE
2017-02-22 09:52:38 -05:00
Matthew Chen
286f72d273 Merge branch 'charlesmchen/webrtcByDefault' 2017-02-22 09:52:00 -05:00
Matthew Chen
2741fd4bdc Enable WebRTC-based audio and video calls by default.
// FREEBIE
2017-02-22 09:51:45 -05:00
Matthew Chen
254a247ba0 Revert "Add WebRTC setting."
This reverts commit 0f45f292a1.

// FREEBIE
2017-02-22 09:51:45 -05:00