Commit Graph

361 Commits (272955b9d632ea71af152e94b6cb650596082370)

Author SHA1 Message Date
lilia bd7f4febaa
Remove dead code
These are all unused, obsolete, or no-op functions at this point.

// FREEBIE
8 years ago
lilia 859d49b3f4
Use relative paths
// FREEBIE
8 years ago
Scott Nonnenberg 1e694fe8d7 Log entry max to 2k, remove logging in hot codepaths (#1459)
On a recent trip through a CPU profile taken while Signal Desktop
churned through a large backlog of messages, it was clear that
console.log was a major source of time spent, primarily the sort
operation required after every new entry is added to the Backbone
collection. So, three different techniques to combat this:

1) Reduce the maximum number of entries in the collection from 5k to 2k
2) No more logging of add/update/remove queue in MessageReceiver
3) No more log entries in Message.handleDataMessage main codepath

FREEBIE
8 years ago
Scott Nonnenberg 69af8d2651 Don't show notification for verified state change with yourself (#1454)
* Don't show notifications for verified state change with yourself

It's confusing to users, and it really doesn't mean anything anyway.

FREEBIE

* Add log statement that we've suppressed a verified notification

FREEBIE
8 years ago
Scott Nonnenberg 4cba16cb61 Fetch all conversations on startup of app, not on inbox load (#1437)
* Fetch all conversations on startup of app, not on inbox load

A recent change to fetch conversations less didn't take into account all
that can happen in the app without the inbox loaded. That only happens
when the window is shown, and messages can come in with the app in the
background. In that case, the conversation wouldn't have been loaded
from the database, but would be saved to the database anyway, losing
data.

This change fetches all conversations as soon as the the data store is
ready for a fetch. It also introduces failsafe throws to ensure that
synchronous ConversationController accesses don't happen until the
initial fetch is complete. A new getUnsafe() method was required to
account for some of the model setup that happens during that initial
conversation fetch.

Fixes #1428

FREEBIE

* Fix tests: ConversationController.load() required before get()

FREEBIE
8 years ago
Scott Nonnenberg d8ce198f55 Fetch conversations once, clean up ConversationController API (#1420)
* Fetch conversations once, clean up ConversationController API

Race conditions around re-fetching have caused some problems recently,
so this removes the need to re-fetch conversations. They are fetched
once or saved once, and that is it. All interaction goes through the
ConversationController, which is the central source of truth.

We have two rules for Conversations:

1. If a conversation is in the ConversationController it doesn't need
   to be fetched, but its initial fetch/save might be in progress. You
   can wait for that fetch/save with conversation.initialPromise.
2. If a conversation is not already in the ConversationController, it's
   not yet in the database. It needs to be added to the
   ConversationController and saved to the database.

FREEBIE

* Remove Conversation.fetch() call in Message.handleDataMessage()

FREEBIE

* ConversationController.API cleanup: Fix two missing spots

FREEBIE
8 years ago
Scott Nonnenberg 680f7d8b57 Additional logging for perf analysis and cross-device debuging
- How long it takes to get a message through the pre-send checks
- How long it takes to open a conversation for the first time
- The timestamp of any message we send to corellate with other logs
- Add conversation ID to 'decrypt old identity key errors' start/end

FREEBIE
8 years ago
Scott Nonnenberg 7e9ed1481b Set receivedAt after decrypt, sort by received then sent
FREEBIE
8 years ago
Scott Nonnenberg 8700112f6d Decrypt any IncomingIdentityKeyError still sticking around
FREEBIE
8 years ago
Scott Nonnenberg e57f155403 Handle rejections from protocol layer (due to missing records)
isVerified and isUntrusted both went to the protocol layer, but were not
prepared for rejected promises resulting from missing records. This
prevented send in large groups where there has never been a message
exchanged with one of the members.

FREEBIE
8 years ago
Scott Nonnenberg 559619eb49
Fix sync'd disappearing messages; prevent double-save
FREEBIE
8 years ago
Scott Nonnenberg 7e0bd82bd3 handleDataMessage: Remove if(confirm) checks, add try/catch
FREEBIE
8 years ago
Scott Nonnenberg 32e12f7d3c Conversation.notify(): introduce a promise to track completion
FREEBIE
8 years ago
Scott Nonnenberg 92ba295d52 Better logging for sync sent messages, and new (disappeared) msgs
FREEBIE
8 years ago
Scott Nonnenberg 6f1a2a9b3e Conversation.markRead() - wait for all database saves are complete
FREEBIE
8 years ago
Scott Nonnenberg 65283d2794 Unload conversations and old messages every half-hour
FREEBIE
8 years ago
Scott Nonnenberg 4ea457a01c Fix second fetchConversation call if unread > 0
FREEBIE
8 years ago
Scott Nonnenberg 53f2bfbb57 Animated loading screens on startup and first conversation load
FREEBIE
8 years ago
Scott Nonnenberg 3e0fa995dd When finding all groups involving a number, load from DB not memory
FREEBIE
8 years ago
Scott Nonnenberg 0adc398a6f Fetch conversation before saving in all sync handlers
FREEBIE
8 years ago
Scott Nonnenberg 9db0a58260 Whenever adding something to a queue, include a timeout
No more wedged queues!

FREEBIE
8 years ago
Scott Nonnenberg 1eb450ca35 Conversation: Start w/DEFAULT verified state, avoid null timestamp
Fix too-aggressive verification notifications on startup by starting a
conversation with the right initial verified state, and then making sure
to fetch() before setting a new verified state.

FREEBIE
8 years ago
Scott Nonnenberg bd0050b6c6 Cache messages on receipt, remove from cache when processed
FREEBIE
8 years ago
Scott Nonnenberg e6859a3684 Ensure that promises always resolve, or that rejections are okay 8 years ago
Scott Nonnenberg 4da1722ee8 Bullet-proof _setVerified and handleDataMessage against rejections
And the weird behavior we get from $.Deferred.

FREEBIE
8 years ago
Scott Nonnenberg 5bba6d3f17 setTrusted() -> setApproved() to dismiss the five-second warning
This change makes sense, since there was already a reference in the code
to the then-nonexistent setApproved()!

FREEBIE
8 years ago
Scott Nonnenberg ff4fde651c Make it clear in conversation just some recipients failed
FREEBIE
8 years ago
Scott Nonnenberg 12914307f1 Improve experience when discovering identity key error on send
New experience in the Message Detail view when outgoing identity key
errors happen, matching the Android View.

'View' button is only shown on outgoing key errors right now.

When a contact with an outgoing identity key error is clicked, they are
taken to a view like the popup that comes up on Android: an explanation
of what happened and three options: 'Show Safety Number', 'Send Anyway',
and 'Cancel'

Contacts are now sorted alphabetically, with the set of contacts with
errors coming before the rest.

FREEBIE
8 years ago
Scott Nonnenberg b6cca41a0c Update verification-related strings to better match mobile app
FREEBIE
8 years ago
Scott Nonnenberg f654532fa8 Handle UNVERIFIED sync verification messages (via contact sync)
FREEBIE
8 years ago
Scott Nonnenberg 20451cc827 Show verified/keychange notifications when actually relevant
FREEBIE
8 years ago
Scott Nonnenberg e91f2d0377 Miscellaneous wire-up to ensure that failures propagate
FREEBIE
8 years ago
lilia aa83bc1dab Ensure all sessions are archived on profile fetch
If the key has changed, saveIdentity will archive sibling sessions, but not the
session for the device it was called on. Therefore we have to archive that one
by hand.

Also switch from saving the identity of an OutgoingIdentityKeyError to just
triggering a profile fetch, mostly for consistency, simplicity, and DRYness.

// FREEBIE
8 years ago
Scott Nonnenberg e2ee63efaa m.get('sender') -> m.isIncoming(), filter in getLoadedUnreadCount
FREEBIE
8 years ago
Scott Nonnenberg 5b46ef3562 Show last seen indicator for keychange/verification notifications
FREEBIE
8 years ago
Scott Nonnenberg 78094102bd Message.send: Add promise to array for consistency
FREEBIE
8 years ago
Scott Nonnenberg 4ee4ad80c3 Message.send - check for missing identityKey, also add logging
FREEBIE
8 years ago
Scott Nonnenberg 5e62d0cfd8 Update identity key after a send error tells us it has changed
FREEBIE
8 years ago
Scott Nonnenberg 22208ec3f8 Fix: Conversation.updateVerified fails when convo not yet in db
FREEBIE
8 years ago
Scott Nonnenberg 7bfb66b13b processVerifiedMessage: Archive all sessions when key changes
FREEBIE
8 years ago
lilia d7054f4b63 Archive sessions whenever an identity key changes
Sessions established with the previous identity should no longer be used for
sending, so we should close them.

Since we've added this call to saveIdentity, we can omit the call to it after
profile fetches.

// FREEBIE
8 years ago
Scott Nonnenberg 0db2ef9e7f Refactor: combine Conversation.setVerified/setVerifiedDefault
FREEBIE
8 years ago
Scott Nonnenberg 1e8ae774a2 Differentiate between local and remote trust decisions
FREEBIE
8 years ago
lilia 3acfda3a56 Archive sessions on key changes after profile fetch
// FREEBIE
8 years ago
lilia 4f2f622598 Apply special handling to verification sync messages
// FREEBIE
8 years ago
Scott Nonnenberg fc39241003 Ensure that we pull verified state only after getting profiles
FREEBIE
8 years ago
Scott Nonnenberg 4a1dc46ab3 Fixes to get local verification and sync messages working
FREEBIE
8 years ago
Scott Nonnenberg c43d96904d Move to the real verify/trust APIs
This wires up verification sync messages, verification and trust checks
to the trust store instead of using mocked data.

FREEBIE
8 years ago
Scott Nonnenberg 475d607fd0 Prepare for verification sync messages: receiver, ready to send
FREEBIE
8 years ago
Scott Nonnenberg aebf4b32d6 Conversation.updateLastMessage: fix indent, use of null message
FREEBIE
8 years ago