Commit graph

330 commits

Author SHA1 Message Date
Michael Kirk
df15c904bc Rework push registration
== Account Registration ==

Not complete until push tokens are uploaded

== Remote Notifications Registration ==

Extracted from PushManager

- wait for notification-settings registration to complete before
  requesting push tokens, otherwise it's possible token requests will
  be ignored.

- Less state required for push notification callbacks, specifically, we
  no longer need to ensure we've created a promise before the
  registration delegate methods get called.

- no more TOCFuture in Signal-iOS (still in SSK for now). It's not in
  cases of inexplicable behavior - one a recently, push notification
  premature free, in redphone, and more popular use, and I've seen two
  futures inexplicably being nil.  Instead, let's consolidate around
  PromiseKit for popularly used, maintained, strongly-typed futures.

- separate logic for registering for vanilla push/voip notifications
  (few dependencies) from responding to UILocalNotifications (lots of
  dependencies). Ultimately I'd like to consolidate the remaining
  UILocalNotifications logic with the existing NotificationsManager

== Misc ==

more debug logging
more uniform logging
remove stale logic around newly registered user

// FREEBIE
2017-10-12 12:02:22 -04:00
Michael Kirk
703d4df9e5 Avoid phantom notifications for group info requests
// FREEBIE
2017-10-12 08:56:02 -04:00
Joshua Lund
8ff14a3f6a Enable censorship circumvention in Qatar.
// FREEBIE
2017-10-04 17:56:22 -04:00
Matthew Chen
0c46b770e9 Ignore group info requests if sender and recipient aren't both known group members.
// FREEBIE
2017-10-04 10:19:19 -04:00
Matthew Chen
13a6657991 Respond to CR.
// FREEBIE
2017-10-04 10:06:38 -04:00
Matthew Chen
2a5a0929e6 Create & access groups more carefully.
// FREEBIE
2017-10-04 09:45:09 -04:00
Matthew Chen
380ed0f82b Create & access groups more carefully.
// FREEBIE
2017-10-04 09:45:09 -04:00
Matthew Chen
a31b1aeea6 Respond to "sync block list" request.
// FREEBIE
2017-10-04 09:23:14 -04:00
Michael Kirk
462a6e4456 Persist read receipts to proper collection
// FREEBIE
2017-10-03 16:06:11 -04:00
Michael Kirk
2125dbe72c CR: Avoid potential transaction nesting
also clean up description method

// FREEBIE
2017-10-03 11:11:15 -04:00
Michael Kirk
5d62741a3c Sync read receipt configuration upon set
// FREEBIE
2017-10-03 09:17:08 -04:00
Michael Kirk
ab5b090338 Sync read receipt config to linked devices
// FREEBIE
2017-10-02 16:35:53 -04:00
Michael Kirk
be197621ac Add read receipts field/configuration protos
Also converge with Android protos where possible

// FREEBIE
2017-10-02 16:03:17 -04:00
Michael Kirk
a2421d5b3e Fix "unknown attachment" notifications
The transaction in which the attachments were created hasn't been
committed yet.

// FREEBIE
2017-09-29 15:57:54 -04:00
Matthew Chen
08e560f969 Respond to CR.
// FREEBIE
2017-09-29 14:38:34 -04:00
Matthew Chen
0a081f7dcc Use longer delay when batch processing incoming messages.
// FREEBIE
2017-09-29 14:36:22 -04:00
Matthew Chen
69c9a5a49b Use longer delay when batch processing incoming messages.
// FREEBIE
2017-09-29 14:36:22 -04:00
Matthew Chen
46d2b7a891 Refine read receipt processing cycle.
// FREEBIE
2017-09-29 14:35:12 -04:00
Matthew Chen
6b3c0377cf Refine read receipt processing cycle.
// FREEBIE
2017-09-29 14:35:12 -04:00
Matthew Chen
c3dca21a69 More thread safety fixes.
// FREEBIE
2017-09-29 10:16:42 -04:00
Matthew Chen
65957c932d Respond to CR.
// FREEBIE
2017-09-28 14:49:58 -04:00
Matthew Chen
8b15dba4e7 Fix "mark as read on linked device".
// FREEBIE
2017-09-28 14:49:58 -04:00
Matthew Chen
facbc56062 Move more work off the main thread.
// FREEBIE
2017-09-28 14:30:27 -04:00
Matthew Chen
9573e0e16d Move more work off the main thread.
// FREEBIE
2017-09-28 14:30:27 -04:00
Matthew Chen
1df1144e43 Respond to CR.
// FREEBIE
2017-09-28 09:18:38 -04:00
Matthew Chen
33376f66d2 Simplify processing of messages from linked devices.
// FREEBIE
2017-09-27 20:41:12 -04:00
Matthew Chen
9b5affb390 Send silent messages where appropriate.
// FREEBIE
2017-09-27 17:13:29 -04:00
Matthew Chen
d557817bb4 Format message statuses with date if possible.
// FREEBIE
2017-09-27 16:38:48 -04:00
Matthew Chen
834ad3f8e1 Respond to CR.
// FREEBIE
2017-09-27 14:22:01 -04:00
Matthew Chen
01bda556c8 Fix class rename.
// FREEBIE
2017-09-27 14:22:01 -04:00
Matthew Chen
6b8c9b6bcf Iterate the names of the incoming message queue extensions.
// FREEBIE
2017-09-27 14:22:01 -04:00
Matthew Chen
eec0efa3c8 Fix class rename.
// FREEBIE
2017-09-27 14:22:01 -04:00
Matthew Chen
a4d285f50d Respond to CR.
// FREEBIE
2017-09-27 14:19:26 -04:00
Matthew Chen
aa7329013d Handle new-style delivery receipts.
// FREEBIE
2017-09-27 14:09:47 -04:00
Matthew Chen
25c40ea3cf Handle new-style delivery receipts.
// FREEBIE
2017-09-27 14:09:47 -04:00
Matthew Chen
ee13084d5c Respond to CR.
// FREEBIE
2017-09-27 14:05:21 -04:00
Matthew Chen
ffe44e68be Refactor linked device read receipts.
// FREEBIE
2017-09-27 13:17:43 -04:00
Matthew Chen
16d4256e99 Address deadlocks in profile manager.
// FREEBIE
2017-09-27 13:00:01 -04:00
Matthew Chen
19e010645e Respond to CR.
// FREEBIE
2017-09-26 09:32:48 -04:00
Matthew Chen
9f9ac746d1 Sketch out message metadata view.
* Show message metadata view from conversation view.
* Pull out MediaMessageView class.
* Track recipient read timestamps.
* Add per-recipient status to message metadata view.
* Add share button to message metadata view.

// FREEBIE
2017-09-25 17:25:49 -04:00
Matthew Chen
f001e8c225 Respond to CR.
// FREEBIE
2017-09-25 17:22:27 -04:00
Michael Kirk
ce2a4422e3 fix desktop linking for some users
// FREEBIE
2017-09-25 17:00:50 -04:00
Matthew Chen
b74da07f7e Respond to CR.
// FREEBIE
2017-09-22 15:15:04 -04:00
Matthew Chen
825503210b Remove extraneous database view.
// FREEBIE
2017-09-22 14:24:17 -04:00
Matthew Chen
11cadf4200 Send, receive & show read receipts to senders/from receivers.
* Send read receipts to senders.
* Honor "send read receipts" preference.
* Process read receipts from recipients.
* Refactor "mark as read" logic.
* Serialize and apply recipient read receipts received before sync transcript.
* Show recipient read receipts in conversation view.

// FREEBIE
2017-09-22 14:24:17 -04:00
Matthew Chen
f2d19ffe09 Respond to CR.
// FREEBIE
2017-09-22 14:21:15 -04:00
Matthew Chen
7268bde506 Add stress group to debug UI.
// FREEBIE
2017-09-22 10:30:35 -04:00
Matthew Chen
bd416176ae Add stress group to debug UI.
// FREEBIE
2017-09-22 00:31:13 -04:00
Matthew Chen
77e0c9664c Respond to CR.
// FREEBIE
2017-09-21 17:25:13 -04:00
Matthew Chen
edd63164d7 Fix build breaks.
// FREEBIE
2017-09-21 17:09:55 -04:00
Matthew Chen
874ebf7038 Use private queues in message decrypter and batch processor.
// FREEBIE
2017-09-21 17:06:08 -04:00
Matthew Chen
077b74a0aa Fix handling of edge cases around groups.
// FREEBIE
2017-09-21 17:06:08 -04:00
Matthew Chen
2b0b49b7f6 Don't batch message decryption.
// FREEBIE
2017-09-21 17:06:08 -04:00
Matthew Chen
bfb03c0db4 Fix message processing edge cases.
// FREEBIE
2017-09-21 17:06:08 -04:00
Matthew Chen
35a2470cb7 Post notifications asynchronously.
// FREEBIE
2017-09-21 17:03:57 -04:00
Matthew Chen
1c8dbcd223 Respond to CR.
// FREEBIE
2017-09-21 16:58:07 -04:00
Matthew Chen
3eaeb4e0ec Add read receipts manager.
* Simplify read receipts plumbing.
* Rework incoming read receipts handling.
* Rework outgoing read receipts handling.
* Make "database view registration complete" check thread-safe.
* Don't send sync messages to self if no linked devices.

// FREEBIE
2017-09-21 16:23:03 -04:00
Matthew Chen
2cfa24ba7b Respond to CR.
// FREEBIE
2017-09-21 14:42:05 -04:00
Matthew Chen
b28c4b74b2 Pull out TSMessageDecrypter class.
// FREEBIE
2017-09-21 14:38:30 -04:00
Matthew Chen
f1b7d895e2 Modify precommit script to clean up includes and forward declarations.
// FREEBIE
2017-09-20 15:33:17 -04:00
Matthew Chen
993df25f3f Respond to CR.
// FREEBIE
2017-09-20 11:48:37 -04:00
Matthew Chen
46f17a02cb DRY up decryption logic.
// FREEBIE
2017-09-20 10:56:04 -04:00
Matthew Chen
e39b9169b9 Decrypt and process messages in batches.
// FREEBIE
2017-09-20 10:56:04 -04:00
Matthew Chen
9987ebb3c0 Decrypt and process messages in batches.
// FREEBIE
2017-09-20 10:56:04 -04:00
Matthew Chen
023c804a61 Decrypt and process messages in batches.
// FREEBIE
2017-09-20 10:56:04 -04:00
Matthew Chen
fa353259c3 Process messages in a single transaction (wherever possible).
// FREEBIE
2017-09-20 10:56:04 -04:00
Matthew Chen
6fce2c26b7 Process messages in a single transaction (wherever possible).
// FREEBIE
2017-09-20 09:40:46 -04:00
Matthew Chen
afc753e7ed Add batch message processor.
// FREEBIE
2017-09-20 09:24:49 -04:00
Matthew Chen
c498e4b354 Decouple message decryption and processing.
// FREEBIE
2017-09-20 09:24:49 -04:00
Matthew Chen
bfd50a9e0e Make "database view registration complete" check thread-safe.
// FREEBIE
2017-09-20 09:21:05 -04:00
Matthew Chen
8a4d67a6e4 Respond to CR.
// FREEBIE
2017-09-20 09:19:15 -04:00
Matthew Chen
183f0f1ccd Respond to CR.
// FREEBIE
2017-09-19 17:45:18 -04:00
Matthew Chen
74b2f30523 Revert "Modify read receipt photos to support sending read receipts to both linked devices and senders."
This reverts commit 37e67179c8a8d6ebfdfa124ef0c1229f220ed11d.
2017-09-19 17:30:48 -04:00
Matthew Chen
a7546aee63 Modify read receipt photos to support sending read receipts to both linked devices and senders.
// FREEBIE
2017-09-19 17:30:48 -04:00
Matthew Chen
39a961e376 Rework incoming read receipts handling.
// FREEBIE
2017-09-19 17:30:48 -04:00
Matthew Chen
737503549d Rework incoming read receipts handling.
// FREEBIE
2017-09-19 17:30:48 -04:00
Matthew Chen
2b1ea19960 Modify read receipt photos to support sending read receipts to both linked devices and senders.
// FREEBIE
2017-09-19 17:30:48 -04:00
Matthew Chen
0e7eaf7c62 Modify read receipt photos to support sending read receipts to both linked devices and senders.
// FREEBIE
2017-09-19 17:30:48 -04:00
Matthew Chen
a5ece18e6c Fix build break.
// FREEBIE
2017-09-19 09:35:33 -04:00
Matthew Chen
400f536e37 Respond to CR.
// FREEBIE
2017-09-19 09:30:01 -04:00
Matthew Chen
872ce17dd6 Clean up data source temp files when complete.
// FREEBIE
2017-09-19 09:30:01 -04:00
Matthew Chen
05b1818874 Don't "scroll to bottom" when messages are sent from desktop.
// FREEBIE
2017-09-18 15:49:33 -04:00
Matthew Chen
d3ad0950ba Clean up the data source class.
// FREEBIE
2017-09-11 10:20:48 -04:00
Matthew Chen
9dfebb2d4b Apply OWSFail() in more places.
// FREEBIE
2017-09-11 10:20:48 -04:00
Matthew Chen
c21a7673c8 Rework preservation of attachment filenames.
// FREEBIE
2017-09-11 10:20:48 -04:00
Matthew Chen
0746b1300d Apply DataSource to message sender.
// FREEBIE
2017-09-11 10:20:48 -04:00
Matthew Chen
b95b5f69de Apply DataSource to message sender.
// FREEBIE
2017-09-11 10:20:48 -04:00
Matthew Chen
20e5013aae Convert DataSource to Objective-C.
// FREEBIE
2017-09-11 10:20:48 -04:00
Matthew Chen
69816cdf0e Convert DataSource to Objective-C.
// FREEBIE
2017-09-11 10:20:48 -04:00
Michael Kirk
2eaaba9082 crashfix: on addObject, presumably it's nil.
I'm not sure how this is happening, but this will prevent the crash and
give us additional diagnostic data in the cases where it is happening.

// FREEBIE
2017-09-01 12:56:50 -04:00
Matthew Chen
bb1681f965 Respond to CR.
// FREEBIE
2017-08-30 12:53:02 -04:00
Matthew Chen
cc048b3971 Respond to CR.
// FREEBIE
2017-08-30 12:46:21 -04:00
Matthew Chen
d032339472 Modify debug builds to use production service.
// FREEBIE
2017-08-30 10:49:49 -04:00
Michael Kirk
01d0117f9b provisioning cipher: Fix memory leak, handle failure
Explicitly malloc'd buffer should either be explicitly free'd or
ownership given to NSData via `freeWhenDone:YES`

Instead I opted to avoid the explict malloc altogether, and avoided some
unnecessary allocations.

Also made sure encryption failures propogate to error handler

// FREEBIE
2017-08-30 09:47:29 -04:00
Michael Kirk
1f7b6f61c6 Regression test for provisioning cipher
// FREEBIE
2017-08-30 09:47:29 -04:00
Michael Kirk
bdb75fa596 infer when group has been whitelisted on linked device
// FREEBIE
2017-08-29 17:09:28 -04:00
Matthew Chen
b00db33d12 Don't ignore attachments.
// FREEBIE
2017-08-29 16:35:52 -04:00
Michael Kirk
3ffb321e2a fix assert
// FREEBIE
2017-08-29 12:02:24 -04:00
Michael Kirk
d71b7684a6 cleanup logging
// FREEBIE
2017-08-29 10:46:10 -04:00
Michael Kirk
ec0cf36abb Don't print empty bubbles.
e.g. if we add another "invisible" flag message in the future we want to
be able to roll it out immediately.

// FREEBIE
2017-08-29 10:39:36 -04:00
Michael Kirk
69e8ca8eac Handle receiving profile key messages
(don't print empty bubble)

// FREEBIE
2017-08-29 10:35:54 -04:00
Michael Kirk
9c56660618 profile key flag and debug action
// FREEBIE
2017-08-29 10:35:54 -04:00
Michael Kirk
0feb966a1c comment cleanup / code formatting
// FREEBIE
2017-08-29 10:35:18 -04:00
Michael Kirk
6cde79c568 Assert profile key length on sending/receiving
// FREEBIE
2017-08-29 10:35:18 -04:00
Michael Kirk
6235e7fe5c Don't send profile key with every sync message since we explicitly sync
upon update/create.

Following Signal-Android's lead here.

// FREEBIE
2017-08-29 10:35:18 -04:00
Michael Kirk
526d5e33b9 Sync profile key to sibling devices when updating contact
// FREEBIE
2017-08-29 10:35:18 -04:00
Michael Kirk
46919e4702 Add own profile key to multidevice provisioning message
// FREEBIE
2017-08-29 10:35:18 -04:00
Michael Kirk
1f3d2d1ed6 Send any profile key in contact sync
// FREEBIE
2017-08-29 10:35:18 -04:00
Michael Kirk
f0a57edde0 proto update: multiDevice profileKey sync
Also:

- minimize diff between Signal-Android's protos
- comment whereever we diverge from Signal-Android

// FREEBIE
2017-08-29 10:35:18 -04:00
Michael Kirk
1e51bf4899 extract event names
// FREEBIE
2017-08-25 17:19:31 -04:00
Michael Kirk
251e206b6d profiles vs. censorship circumvention
// FREEBIE
2017-08-25 17:17:43 -04:00
Michael Kirk
bde40a1f9c Ensure avatar upates right after profile change.
// FREEBIE
2017-08-25 12:40:19 -04:00
Matthew Chen
703b348091 Respond to CR.
// FREEBIE
2017-08-23 09:55:53 -04:00
Matthew Chen
a9b55675cd Add assert to ensure that we don't use write transactions before sync database view registration is complete.
// FREEBIE
2017-08-23 09:46:26 -04:00
Matthew Chen
97f74ca5b4 Only use staging service in debug builds.
// FREEBIE
2017-08-22 17:19:44 -04:00
Matthew Chen
a825fad47b Start reworking the contact offers.
// FREEBIE
2017-08-21 17:05:42 -04:00
Matthew Chen
98eb4693c5 Rework the contact offers.
// FREEBIE
2017-08-21 17:05:42 -04:00
Michael Kirk
0ab958f03a cleanup per codereview
- reference OWS OpenSSL
- clarify comments
- fix typo

// FREEBIE
2017-08-21 16:37:16 -04:00
Michael Kirk
0f9f26a577 handle remote user's profile key has changed
// FREEBIE
2017-08-21 16:37:16 -04:00
Michael Kirk
72fbb02028 aes-gcm via openssl
// FREEBIE
2017-08-21 16:37:16 -04:00
Matthew Chen
164bf19b47 Respond to CR.
// FREEBIE
2017-08-17 11:22:25 -04:00
Matthew Chen
622c0c3f5f * Add debug UI tools for clearing and logging the profile whitelist.
* Auto-add new contact threads to profile whitelist when local user sends first message to that thread.
* Ensure dynamic interactions have a non-negative timestamp even if the conversation was empty.
* Only call updateMessageMappingRangeOptions _after_ beginLongLivedReadTransaction and updating messageMappings.
* Improve documentation around how to avoid corrupt mappings in conversation view.
* Fix edge cases around large initial range sizes.
* Always treat dynamic interactions as read.
* Rebuild the “unseen” database views to remove dynamic interactions (see above).

// FREEBIE
2017-08-17 11:22:25 -04:00
Matthew Chen
d476bc286d * Add debug UI tools for clearing and logging the profile whitelist.
* Auto-add new contact threads to profile whitelist when local user sends first message to that thread.
* Ensure dynamic interactions have a non-negative timestamp even if the conversation was empty.
* Only call updateMessageMappingRangeOptions _after_ beginLongLivedReadTransaction and updating messageMappings.
* Improve documentation around how to avoid corrupt mappings in conversation view.
* Fix edge cases around large initial range sizes.
* Always treat dynamic interactions as read.
* Rebuild the “unseen” database views to remove dynamic interactions (see above).

// FREEBIE
2017-08-17 11:22:25 -04:00
Michael Kirk
97afa4d48a verification on decrypt
// FREEBIE
2017-08-15 15:19:40 -04:00
Michael Kirk
135243e383 CR: variable rename, better comments, fix up tests
// FREEBIE
2017-08-14 15:18:12 -04:00
Michael Kirk
7499b3aaf0 Avatar API integration / WIP crypto scheme
Crypto Scheme:

- Name (un)padding
- WIP AES-GCM (funtioning, but need to verify against android
  implementation, and tag functionality)

Changes to avatar API:

- hard code avatar domain (cdn.signal.org)
- avatar form hands out new avatar key, invalidating old avatar
- preliminary aes-gcm integration

Also:

- New type to represent AES128 keys, rather than passing around opaque
  data blobs everywhere, we can use the compiler to help us make sure
  we're passing compliant keying material.

- Started using factory pattern for API requests. This is intended to be
  a lighter weight way to implement new API requests, rather than the
  current 1-method class ceremony.

// FREEBIE
2017-08-14 12:45:37 -04:00
Michael Kirk
fc3f9ae396 Replace server sent avatar URL with hardcoded
// FREEBIE
2017-08-11 11:19:05 -04:00
Michael Kirk
9fdc3202af White listing must happen on main thread
followup to: ee613e4889

Again, this solves a crash, but we'll want to revisit the perf
implications.

// FREEBIE
2017-08-11 09:11:55 -04:00
Michael Kirk
40b99a15ed Fix up some tests
Included plausible test implementation for an in-memory profile manager.

Note two tests remain failing (they've been failing for a while)

// FREEBIE
2017-08-09 12:17:03 -04:00
Michael Kirk
a3ae22c84f Upload profile avatar to service
WIP, this currently lacks crypto pending further discussion.

// FREEBIE
2017-08-09 11:44:34 -04:00
Michael Kirk
45a1f534ba Rename method to make way for new method.
No behavioral changes.

// FREEBIE
2017-08-08 15:03:48 -04:00
Michael Kirk
72b3f3779b Discard GroupInfoRequest from unknown group
// FREEBIE
2017-08-08 12:17:26 -04:00
Michael Kirk
ee613e4889 Can only set whitelist on main thread
As written solves a crash, but we'll probalby want to revisit the perf
implications.

// FREEBIE
2017-08-07 16:48:12 -04:00
Michael Kirk
e07ed50170 define avatar form URL
// FREEBIE
2017-08-07 15:17:34 -04:00
Matthew Chen
e01fbc247e Refine profile logic.
// FREEBIE
2017-08-04 17:35:22 -04:00
Matthew Chen
21304c18a6 Once we've shared our profile key with a user (perhaps due to being a member of a whitelisted group), make sure they're whitelisted.
// FREEBIE
2017-08-04 17:34:27 -04:00
Matthew Chen
98def41782 Respond to CR.
// FREEBIE
2017-08-04 17:33:16 -04:00
Matthew Chen
823927685d Update profile on service.
// FREEBIE
2017-08-04 15:25:17 -04:00
Matthew Chen
83e2fbe28c Rework where profile key is attached in photos.
// FREEBIE
2017-08-04 15:23:17 -04:00
Matthew Chen
b5fdc05b91 Move profile key to data, call, sync and null protos.
// FREEBIE
2017-08-04 15:23:02 -04:00
Matthew Chen
37ce388eb6 Add “add to profile whitelist” offer.
// FREEBIE
2017-08-04 15:23:02 -04:00
Michael Kirk
ed4de7e8af Simplify code / pre-cache localNumber
Now that localNumber is read from a dedicated dbConnection we don't have
to worry about it blocking.

// FREEBIE
2017-08-04 15:19:26 -04:00
Michael Kirk
f99d4e9df9 Merge branch 'hotfix/2.15.2' 2017-08-04 13:11:53 -04:00
Michael Kirk
3856f3dfb1 Improve asserts/logging
// FREEBIE
2017-08-04 12:14:43 -04:00
Michael Kirk
52bd682565 fix some recently broken tests
// FREEBIE
2017-08-04 11:33:51 -04:00
Matthew Chen
6ec756de44 Move profile manager to Signal.
// FREEBIE
2017-08-04 09:45:33 -04:00
Matthew Chen
540a0a8e48 Refine UserProfile class. Move local user properties to UserProfile.
// FREEBIE
2017-08-04 09:45:33 -04:00
Michael Kirk
935b51aa19 Fixup tests
// FREEBIE
2017-08-03 13:27:09 -04:00
Michael Kirk
01e808febe localNumber persistance from Category -> TSAccountManager
Following the pattern that singleton methods for effectively global
state should get/set on their own dedicated dbConnection for consistency
and to avoid being blocked by unrelated writes.
2017-08-03 13:27:09 -04:00
Michael Kirk
8a4712bf4c Only access localNumber on AccountManager and cache it
// FREEBIE
2017-08-03 13:27:09 -04:00