Commit Graph

53 Commits

Author SHA1 Message Date
Michael Kirk
97f93eef7e only assert queues in debug
// FREEBIE
2017-04-07 12:46:42 -04:00
Michael Kirk
513c275107 Log when we delete sessions
// FREEBIE
2017-04-06 20:30:07 -04:00
Michael Kirk
9e74f38095 deprecate unused method
I'd want to spend time validating correctness if we ever wanted to use
this.

// FREEBIE
2017-04-06 18:54:03 -04:00
Michael Kirk
9a444f4288 Assert that session mutation occurs on serial queue
// FREEBIE
2017-04-06 17:32:15 -04:00
Matthew Chen
cd4134c9da Apply assert to ensure singletons are only created once.
// FREEBIE
2017-03-31 18:36:08 -04:00
Michael Kirk
2dbcfed3ba Mark a stored session as unfresh
in case of YapDB object cache.

// FREEBIE
2017-03-31 12:37:06 -04:00
Michael Kirk
f4dfd65840 Debug method to print stored sessions
// FREEBIE
2017-03-31 12:37:06 -04:00
Matthew Chen
49a24a4e6a Improve handling of incomplete and failed attachment downloads.
// FREEBIE
2017-03-29 12:33:17 -04:00
Michael Kirk
d31cfe6fd6 Ensure existing sessions are invalidated when saving new identity
// FREEBIE
2017-03-22 22:02:30 -04:00
Matthew Chen
7f681e964b Improve logging around decryption exceptions.
// FREEBIE
2017-03-22 09:52:12 -04: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
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
975726e022 Dedupe incoming messags
// FREEBIE
2017-02-24 19:15:35 -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
Michael Kirk
14a104b1b2 fix tests, and off by one in keeping old, accepted keys
// FREEBIE
2017-02-17 14:34:30 -05:00
Matthew Chen
c72e8f8e2f Merge remote-tracking branch 'origin/release/2.7.1'
// FREEBIE
2017-02-17 12:34:03 -05:00
Matthew Chen
686fe679bd Respond to CR.
// FREEBIE
2017-02-16 20:32:19 -05:00
Matthew Chen
7bd4d26532 Add “received at” timestamp to all TSMessages so that they may be sorted properly.
// FREEBIE
2017-02-15 18:04:37 -05:00
Matthew Chen
8acc496a39 Clean up the prekeys.
// FREEBIE
2017-02-14 17:40:44 -05:00
Matthew Chen
54736426f9 Avoid crashes when signed prekey lookup fails.
// FREEBIE
2017-02-14 15:48:49 -05:00
Matthew Chen
351a010fe0 Clean up prekey usage.
// FREEBIE
2017-02-14 13:39:52 -05:00
Matthew Chen
821c96cc6b Mark "attempting out" messages as "unsent" on app launch.
// FREEBIE
2017-02-13 17:16:18 -05:00
Michael Kirk
e0688e16a7 Clean up prekey logic.
// FREEBIE
2017-02-10 16:12:28 -05:00
Michael Kirk
311d80fb2e Missed calls increment unread counter/badge
This affects:
- per-thread badge in the inbox view
- app badge when viewed from springboard.

// FREEBIE
2017-02-07 17:00:55 -05:00
Michael Kirk
fe3ec457fa Disable resetting unreadable storage
Until we have better data on why this occurs, we don't want to risk
blowing users message archive.

// FREEBIE
2017-01-25 16:39:26 -05:00
Michael Kirk
b5429595ac Better logging per CR
// FREEBIE
2017-01-23 18:00:34 -05:00
Michael Kirk
a45ab9fe40 We need to know if the DB password is accessible *before* we init the db
So method can't be *on* the instance.

// FREEBIE
2017-01-23 17:52:49 -05:00
Michael Kirk
dd1aa26827 Prevent destroying user database after resetting device.
// FREEBIE
2017-01-23 17:15:40 -05:00
Matthew Chen
c5cf79c399 Detect, warn about and try to recover from database password retrieval and database load errors.
// FREEBIE
2017-01-10 16:55:54 -05:00
Michael Kirk
5ccbd4ca6d Bail if we can't build a database.
* Something is irrecoverably wrong at this point.
* Constantize error names

// FREEBIE
2016-12-16 14:49:39 -06:00
Sam Vevang
f8bb46c46c check for errors in the keychain password retrieval
// FREEBIE
2016-12-16 14:32:30 -06:00
Michael Kirk
70e536ca8f Privacy preferences for blocking identity change
// FREEBIE
2016-11-10 16:28:36 -05:00
Michael Kirk
1ebb82f987 Contacts don't have safety numbers until they've exchanged keys.
// FREEBIE
2016-11-09 12:57:54 -05:00
Michael Kirk
47cad611e5 Fix register w/o background fetch & stale push tokens
* Separate account registration from push token registration
* Provide better errors when validation fails (e.g. numbers don't match, numbers blank)
* More logging during registration
* Call success after setting phone number to avoid any future race condition

  This isn't currently causing problems, but it's unexpected that we'd
  mutate the state *after* calling a callback which might inuitively rely
  on that state.

* Don't throw exception off thread when device keys 404's
* Better async startup handling
  - move processing off main thread
  - reduce code duplication
  - don't wrap it in a transaction in the future case where we want to
    further access the DB

// FREEBIE
2016-11-03 16:10:06 -04:00
Michael Kirk
4ba1e86ec1 Explain send failures for text and media messages
Motivation
----------
We were often swallowing errors or yielding generic errors when it would
be better to provide specific errors.

We also didn't create an attachment when attachments failed to send,
making it impossible to show the user what was happening with an
in-progress or failed attachment.

Primary Changes
---------------
- Funnel all message sending through MessageSender, and remove message sending
  from MessagesManager.
  - Record most recent sending error so we can expose it in the UI
  - Can resend attachments.
  - Update message status for attachments, just like text messages
- Extracted UploadingService from MessagesManager
  - Saving attachment stream before uploading gives uniform API for send vs.
    resend
  - update status for downloading transcript attachments
- TSAttachments have a local id, separate from the server allocated id
  This allows us to save the attachment before the allocation request. Which is
  is good because:
  1. can show feedback to user faster.
  2. allows us to show an error when allocation fails.

Code Cleanup
------------
- Replaced a lot of global singleton access with injected dependencies to make
  for easier testing.
- Never save group meta messages. Rather than checking before (hopefully) every
  save, do it in the save method.
- Don't use callbacks for sync code.
- Handle errors on writing attachment data
- Fix old long broken tests that weren't even running. =(
- Removed dead code
- Use constants vs define
- Port flaky travis fixes from Signal-iOS

// FREEBIE
2016-10-24 09:36:51 -04:00
Michael Kirk
40cdc7f224 disappearing messages
* Support for disappearing messages
* update inbox thread preview when receiving message

// FREEBIE
2016-10-11 09:24:40 -04:00
Michael Kirk
c1ade86a8b New fingerprint format
In coordination with Desktop and Android, iOS will be using all-numeric
fingerprints, aka "Safety Numbers".

Furthermore, the concept of verifying one identity and then the other
has been removed. Instead we ask users to exchange a single number, or
scan a single QR code. These credentials are built by combining the
users identities.

// FREEBIE
2016-10-11 09:24:40 -04:00
Michael Kirk
ce1aa04b61 Fix device listing (#38)
broken while refactoring to async

// FREEBIE
2016-09-30 09:16:23 -04:00
Michael Kirk
ff9729f421 Avoid blocking app launch
// FREEBIE
2016-09-28 12:09:37 -04:00
Michael Kirk
f256617636 If we can't find a class definition, don't explode, just log.
If we have a serialized object in our data store that wasn't properly
removed, we can be faced with an exception when enumerating objects in
the database, e.g. when we add a new Yap Index.

// FREEBIE
2016-09-28 12:07:22 -04:00
Michael Kirk
5b06b4351f Fix timeout on launch for some users (#36)
This would especially affect users with large databases on older
devices.

Some of these database extensions aren't strictly necessary to launch
the app. Theoretically we could see weird read receipt behavior for
the initial 10-30 seconds after the app is launched for first time.

// FREEBIE
2016-09-28 00:07:42 -04:00
Michael Kirk
1098bc203e Fix crash on boot (#33)
A botched migration 6 months ago left some lingering TSRecipients
serialized in our data store, laying in wait to explode the next time we
enumerate every object in the database (e.g. when we add an index).

// FREEBIE
2016-09-26 21:23:06 -04:00
Michael Kirk
800e2a9541 Log exception rather than crash upon failed deserialization
while populating secondary indexes

// FREEBIE
2016-09-13 15:17:57 -04:00
Michael Kirk
0933b92128 Fix race condition with read receipts before incoming message
// FREEBIE
2016-09-09 15:11:41 -04:00
Michael Kirk
c8a5f50763 Fixup DevicesManager
* By providing a view extension for secondary devices we can use that in
  a view mapping to power our devices view controller, and avoid any race
  conditions with uncommitted transactions.

* Fix crash when you're not in your own contacts

* New device appears on top

* Don't show "edit" button unless there are devices, or rather, the helpers to do so.

* Fix glitchy refresh

  Saving unchanged records was causing the tableview to redraw, which was
  mostly invisible, except that if the refresh indicator were running, it
  would twitch.

// FREEBIE
2016-09-09 15:11:40 -04:00
Michael Kirk
9093be2b0d Device provisioning
// FREEBIE
2016-09-02 12:28:58 -04:00
Michael Kirk
f3a91c2629 Avoid collision with iOS10 SSKeychain framework (#24)
Our pod SSKeychain was renamed to -> SAMKeychain to avoid collision with
the iOS10 library SSKeychain.

* log failure to write keychain (this seems to only happen on simulator)
* ensure we exit if we fail to set DB cipher key

// FREEBIE
2016-08-18 13:40:48 -04:00
Michael Kirk
baf564db2e Fixup e61c81 by migrating old schema
// FREEBIE
2016-08-01 09:09:12 -07:00
Michael Kirk
0f9a3334c1 Ensure interactions removed when thread is deleted
In theory, this should have already been handled by the
YapDatabaseRelationship extension via edges.

However, in practice, there were situations (cause unknown) where
interactions would exist without an edge to their corresponding thread.

Rather than being clever with the edge/callback machinery, now threads
explicitly delete all their interactions, and interactions delete all
their attachments (when applicable).

Also, a class to clean up spurious interactions / attachments

In the process:
- refactored TSYapDatabaseObject init to specify designated initializer
- added some testing niceties to TSYapDatabaseObject

// FREEBIE
2016-07-31 08:49:01 -07:00