Commit Graph

88 Commits (2861fa26a7046981b141240246de8665f420b84b)

Author SHA1 Message Date
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
10 years ago
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
10 years ago
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
10 years ago
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
10 years ago
lilia 4c4b875348 Fix displaying contact names as 'Unknown Group'
// FREEBIE
10 years ago
lilia c64fe8410e Convo list shows 'Media message' when appropriate
// FREEBIE
10 years ago
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
10 years ago
lilia c77391b3f2 Sinewave animation for pending requests
Tryin it on for size.

// FREEBIE
10 years ago
lilia e68b84ad9a Fix saving TypeErrors
// FREEBIE
10 years ago
lilia a32f3ff1f6 More work on replayable errors
Expose a button that does that retries outgoing messages if possible.

// FREEBIE
10 years ago
lilia 7ec4700431 Handle saving errors when none exist already
// FREEBIE
10 years ago
lilia ae25d62ef2 Fix up post-conflict resolution error processing
// FREEBIE
10 years ago
lilia fbb65d1988 Add replayable network errors
Support for manual message retry.

// FREEBIE
10 years ago
lilia 19423bf909 Abstract message error handling
// FREEBIE
10 years ago
lilia 569d0655fa Fix test failure
// FREEBIE
10 years ago
lilia 876e11c19b Fix sync messages not getting displayed on arrival
// FREEBIE
10 years ago
lilia 7d6adc4879 Save outgoing error codes when messages fail
// FREEBIE
10 years ago
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
10 years ago
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
10 years ago
lilia c1b9f3235f Save all errors
But clean up objects created by the Error constructor, as they contain
non-serializable properties, like functions.

// FREEBIE
10 years ago
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
10 years ago
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
10 years ago
lilia 6364cda7cb Create requires an object
// FREEBIE
10 years ago
lilia 2bc65c2ab4 Let messages fetch references to senders
The conversation's contactCollection only contains references to the
current membership, and will not provide contact info for people who
have left the group, causing their messages to render without numbers or
avatars.

// FREEBIE
10 years ago
lilia e8edbe53bc Improve notification behavior
Only allow one notification at a time. Use a basic notification for
normal messages, and image notification for image messages, and a list
notification when there are multiple unread messages.

// FREEBIE
10 years ago
lilia 59313b5177 Let message models manage blob urls for attachments
// FREEBIE
10 years ago
lilia d6d1a7da55 Don't notify on sync messages
// FREEBIE
10 years ago
lilia f764445c86 Remove erroneous license file and headers
We only use GPLV3 around here.

// FREEBIE
10 years ago
lilia 89f5f216ed Fix new conversation with no lastMessage 10 years ago
lilia 21aaf0fab5 Clean up notification and unread indicator behavior 10 years ago
lilia baa55c9018 Refactor for less model duplication 10 years ago
lilia 98a14e9a6a Fix bug in message model
conversation.changedAttributes returns false when there are no changes.
10 years ago
lilia 3e73f8f0ba Resolve conflicts in series
Attempting to resolve outgoing conflicts in parallel triggers multiple
requests for new keys from the server and causes it to return a 500
error.
10 years ago
lilia fd5b0aeb85 Set lastmessage text on convo's with no timestamp 10 years ago
lilia 9dfff879b6 Remove usage of extension.trigger
This trigger function uses chrome's runtime message passing api, which
traverses between different windows in our runtime, but we only trigger
the updateInbox event from the backgroud page, so we don't need to use
that api, which requires some extra cpu/memory overhead.

// FREEBIE
10 years ago
lilia b44c12807c Mark messages sent after resolving outgoing key conflicts 10 years ago
lilia cfc3b8e6a5 Fix phantom outgoing messages
This bug was caused by a race between indexeddb requests and sending
messages. Order of events to repro was roughly:

1. send async idb request for current message list
2. add new message(s)
3. idb request returns with now incomplete message list
4. message collection gets reset to list from 3, removing messages
added in 2, but not removing their phantom views/dom elements. (bug)
5. send another idb request for current message list
6. idb request returns bearing all messages including those from 2.
7. messages from 2 are added and rendered a second time.

The fix was simply to not remove messages in 4, which means we reuse the
original message model object rather than recreating it in 7.

Fixes #243

// FREEBIE
10 years ago
lilia 3cbe4f1f46 remove unused argument 10 years ago
lilia 6a5f923cac Don't set attributes redundantly
By the time we get here, these should have already been set in
background.js.

// FREEBIE
10 years ago
lilia 18433419c9 PushMessageContent is now DataMessage 10 years ago
lilia a833d62a71 Implement sync protocol changes
Update protobuf definitions and refactor message receive and decrypt
codepath to support new protocol, including various flavors of sync
messages (sent messages, contacts, and groups).

Also cleans up background.js and lets libtextsecure internalize
textsecure.processDecrypted and ensure that it is called before handing
DataMessages off to the application.

The Envelope structure now has a generic content field and a
legacyMessage field for backwards compatibility. We'll send outgoing
messages as legacy messages, and sync messages as "content" while
continuing to support both legacy and non-legacy messages on the receive
side until old clients have a chance to transition.
10 years ago
lilia b83ce7a015 Delay conversation creation til post-decrypt 10 years ago
lilia 08878b3dc8 Update inbox after sending a message
Also change the event name to reflect how its being used, and stop
passing the message object around since it is not being used.

// FREEBIE
10 years ago
lilia e9d7864f75 Set conversation type when creating from sync message
When a conversation is created as the result of a sync message, and it
is not a group, we need to set its type to private.

// FREEBIE
10 years ago
lilia 1b83932a29 Update open conversations on sync messages 10 years ago
lilia 1ed0ef5bc3 Process group updates before sync delivery receipts
Because we need to know the group members to find early-arrival
receipts.
10 years ago
lilia 654373d743 Fix null conversationId on group sync messages 10 years ago
lilia 65a6068003 Fix for out-of-order message/receipt arrival
In a multi device world, it's possible to receive a receipt for a sync
message before the sync message actually arrives. In this case we need
to keep the receipt around and the process it when the message shows up.
10 years ago
lilia c4fa2cb935 Fix sync message timestamps 10 years ago
lilia a2d88b4fad Don't trigger notifications for sync messages 10 years ago