Commit graph

193 commits

Author SHA1 Message Date
lilia
b2bed9c51c Fix display of empty group updates
Group updates in which nothing change should still display 'Updated the
group'. Previously they would display as empty message bubbles. Fixed by
ensuring that the 'group_update' attribute is set on the model, even if
it is an empty object.

// FREEBIE
2016-01-12 10:44:52 -08:00
Karel Bilek
557d33bf88 Fixing upper bounds on contact search (fixes #545) 2016-01-02 04:23:21 -08:00
lilia
1d6e391dd6 Prefer single quotes
// FREEBIE
2016-01-02 02:51:25 -08:00
lilia
bc576e18d5 Fix no delivery receipts on close session messages
// FREEBIE
2015-12-11 12:06:45 -08:00
lilia
dabe51fd68 Mark message sent iff at least 1 recipient got it
Previously, we would always mark a message sent even if all our network
requests failed.

Fix #484

// FREEBIE
2015-12-10 16:21:21 -08:00
lilia
63135a2337 Fix race between sync messages and receipts
Previously, when processing a backlog of sync messages and their
delivery receipts, we would fail to mark some messages as delivered even
though we got a receipt. This was due to an async race condition between
saving a sync message and fetching it after the receipt arrives.

Fix by re-ordering idb requests such that we save the message first and
fetch it after.

Fixes #479

// FREEBIE
2015-12-10 10:36:15 -08:00
lilia
720032bb8e Remove id from search tokens
Instead, just strip the leading + from search queries that look like
numbers.

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
a258f1a66b Refactor number parsing and validation
Refactor libphonenumber.validateNumber into libphonenumber.parseNumber,
which encapsulates the try-catch pattern used in number parsing and
returns an object of info about the input number rather tha throwing
since we expect to get some invalid number inputs the user is typing.

In the conversation model,
  * Separate phone number validation from search token updating.
  * Perform token update before save if the number was valid.
  * Stop storing unneeded number variants as conversation properties.

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
65c13adf5e Fix searching for numbers with parens or dashes
Strip some punctuation from search queries

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
af64784d64 Let search match on full e164 format numbers
// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
0b7742ecd7 Create contact by number with no country code or +
Search box finds or creates a conversation given a phone number in
local (to the user's region) or international format.

Previously you had to enter e164 format to set up the conversation
correctly.

If the number is not valid, do not open the conversation.

TODO: user feedback on invalid numbers.

// FREEBIE
2015-12-09 18:58:50 -08:00
lilia
0b95606eff Display nicely formatted phone numbers
In conversation headers and as titles for contacts with no name. Updated
tests accordingly.

// FREEBIE
2015-12-09 18:58:50 -08:00
lilia
0620f08a7c Save single errors returned from send functions
// FREEBIE
2015-12-04 12:02:19 -08:00
lilia
2f469835d9 Handle group quit sync messages
Previously, we would incorrectly reject group updates originating from a
linked device instructing us to remove ourselves from the group.

// FREEBIE
2015-12-04 11:25:19 -08:00
Georg Semmler
1a6cedac56 Fix #402
Remove messages which are read from the notification
2015-12-01 13:31:02 -08:00
lilia
7bf94c33d5 Show all contacts when inbox is empty 2015-11-27 22:26:55 -08:00
lilia
07702c4ee5 Let the application layer send sync messages
Previously, libtextsecure would send a sync message automatically
when appropriate. This fails if any recipient has a key conflict
or if our network connection fails mid-send.

Instead, when appropriate, return a the DataMessage encoded as an array
buffer for later syncing. This lets the application choose when to send
it, which we now do after any successful send to a recipient, rather
than after all recipients are successfully sent to.

Eventually we should move the DataMessage protobuf construction and
group sending logic to the application layer entirely, in which case
we wouldn't need libtextsecure to construct the sync message either.

Fixes #408
2015-11-24 17:11:03 -08:00
lilia
5c37c3d6ce Change return type from sending messages
Pass the whole result from the outgoing message callback on to the
caller, and preserve the names of the members.

// FREEBIE
2015-11-24 17:05:25 -08:00
lilia
4615e730ca Save ReferenceErrors on messages
// FREEBIE
2015-11-17 16:22:30 -08:00
lilia
2861fa26a7 Implement infinite scrolling message lists
Only load the most recent messages when initially rendering a
conversation. Scrolling to the top of a message list loads older
messages.

This required some slight refactoring of how we insert message elements
into the dom. If the message is added to the end of the collection,
append it at the end. Otherwise, assume it is an older message and
prepend it.

When adding elements to the top, reset the scrollPosition to its
previous distance from scrollHeight. This keeps the current set of
elements fixed in the viewport.

// FREEBIE
2015-11-15 14:56:58 -08:00
lilia
b59b702eb3 Clear the lastMessage when deleting a conversation
Leave no trace. Fixes #397.

// FREEBIE
2015-11-08 11:14:21 -08:00
lilia
a569e34b33 Refactor new message notification and frontend updates
Create a cleaner seperation between generating notifications
and updating frontend conversation views. The former is now
handled by `conversation.notify` while the latter is achieved
by triggering an event on the conversation model, which will
only be acted on if there are any views listening for it.

Additionally, instead of re-fetching the entire message history,
which is overkill, just add or update the new/modified message.
This will help speed up the newmessage event handler and also
help avoid unnecessary re-rendering when resolving key conflicts.

// FREEBIE
2015-11-07 14:11:13 -08:00
lilia
4136e3633c Fix incoming key conflict behaviors
Follow up to ddd2e67eb5
but for incoming messages.

* Conflict state sometimes failed to be removed even though the
  conflict was resolved.
* Messages failed to re-render after a conflict. We want to
  re-render only the error state on outgoing messages, to avoid
  flickering attachments. On incoming messages, we need to call
  render to populate the message text, avatar, etc...

// FREEBIE
2015-11-06 17:50:43 -08:00
lilia
9c8933c3d0 Resolve conflicts one at a time
Previously, with a mix of text and media messages in conflict,
asynchronous callbacks aligned so as to fail to remove some of
the conflict objects on messages.

Fix by serializing conflict processing, but making sure to move
on through the message list even if some conflict resolutions fail.

Fixes #370

// FREEBIE
2015-11-05 19:42:55 -08:00
lilia
4c4b875348 Fix displaying contact names as 'Unknown Group'
// FREEBIE
2015-11-05 16:30:36 -08:00
lilia
c64fe8410e Convo list shows 'Media message' when appropriate
// FREEBIE
2015-11-02 16:50:46 -08:00
lilia
503509fc8f Fix blank lastMessage for non-text messages
For non text messages (ex: media messages and group updates), the
lastMessage field was being populated with empty string, resulting in an
empty message preview in the conversation list. Instead, display 'Media
message' or 'Updated the group', etc...

// FREEBIE
2015-11-02 16:27:42 -08:00
lilia
c77391b3f2 Sinewave animation for pending requests
Tryin it on for size.

// FREEBIE
2015-10-28 13:57:32 -07:00
lilia
e68b84ad9a Fix saving TypeErrors
// FREEBIE
2015-10-22 10:12:34 -07:00
lilia
ee393bfa03 Ensure that tokens get updated on initial save
// FREEBIE
2015-10-16 13:01:14 -07:00
lilia
82ce76265d Remove stray log statement
// FREEBIE
2015-10-16 12:32:06 -07:00
lilia
f70c22f898 Add search field to inbox
Using the search field produces a filtered view of all contacts and
groups containing the input. To make this fast and scalable, add an
index on a 'tokens' array containing words from the conversation name
and different forms of phone number.

Closes #365

// FREEBIE
2015-10-15 13:33:07 -07:00
lilia
a32f3ff1f6 More work on replayable errors
Expose a button that does that retries outgoing messages if possible.

// FREEBIE
2015-10-02 18:31:07 -07:00
lilia
7ec4700431 Handle saving errors when none exist already
// FREEBIE
2015-10-02 12:35:28 -07:00
lilia
ae25d62ef2 Fix up post-conflict resolution error processing
// FREEBIE
2015-10-02 12:14:34 -07:00
lilia
fbb65d1988 Add replayable network errors
Support for manual message retry.

// FREEBIE
2015-10-01 18:43:20 -07:00
lilia
19423bf909 Abstract message error handling
// FREEBIE
2015-10-01 18:21:20 -07:00
lilia
569d0655fa Fix test failure
// FREEBIE
2015-09-30 19:32:25 -07:00
lilia
876e11c19b Fix sync messages not getting displayed on arrival
// FREEBIE
2015-09-30 17:52:13 -07:00
lilia
7d6adc4879 Save outgoing error codes when messages fail
// FREEBIE
2015-09-30 17:13:59 -07:00
lilia
a802322d44 Display a default message for incoming message errors
An exception to the previous commit, for incoming messages we should not
show a mysterious empty bubble. Instead there is some generic
non-technical error message.

// FREEBIE
2015-09-30 15:24:34 -07:00
lilia
929c16090b Move error messages to message detail view
Change how message errors are rendered. Errors associated with a number
will be shown under that number in the detail view rather than piling up
in the message bubble.

// FREEBIE
2015-09-30 14:27:18 -07:00
lilia
c1b9f3235f Save all errors
But clean up objects created by the Error constructor, as they contain
non-serializable properties, like functions.

// FREEBIE
2015-09-30 14:22:07 -07:00
lilia
04c5f83485 Un-nest libtextsecure errors
Fix inconsistency in error format, where we sometimes get an unexpected
Error object and sometimes get a wrapper object containing an Error.

Also start saving network errors.

// FREEBIE
2015-09-30 12:44:11 -07:00
lilia
8453424ebd Fix stuck pending messages state
Refactor outgoing message error handling to use the same success and
error handlers. This creates a somewhat strange pattern, where we call
send and pass in the promise that resolves when sending is complete, but
there's enough variety in the libtextsecure syntax for different message
sending routines that it belongs at the conversation level and only the
post-processing stuff is really shared by all messages.

// FREEBIE
2015-09-28 13:33:26 -07:00
lilia
9ff95c7e61 DRY up group update sending
// FREEBIE
2015-09-23 16:45:07 -07:00
lilia
f6b35ffbfc Log error stack traces
// FREEBIE
2015-09-23 16:30:30 -07:00
lilia
213dbdefd2 Reorder functions
// FREEBIE
2015-09-23 16:30:30 -07:00
lilia
d1191c509c Log outgoing errors individually
// FREEBIE
2015-09-21 11:48:57 -07:00
lilia
ada3d999e0 Log outgoing errors
// FREEBIE
2015-09-21 11:02:33 -07:00