Commit Graph

270 Commits (768007a2692f49214bafdc1a2f8e35b2d7418252)

Author SHA1 Message Date
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
lilia a7079206f4 Nicer looking end-session and group control messages 10 years ago
lilia 06f4d4456d Fix empty notification on key conflicts 10 years ago
lilia 718f1a5e3d Improve notification contents
Include sensible descriptions of non-content messages. For group
messages, display the sender's name and avatar rather than the group's.
10 years ago
lilia 11b822eaf3 Allow unknown groups
Save groups even if we've never heard of them. Previously
we would fail to save due to a missing 'type' attribute.
10 years ago
lilia 9930937707 Move handlePushMessageContent to message model
And retool message handling flow to helps us avoid instantiating
duplicate message and conversation models.
10 years ago
lilia 897d391817 Improve identity key conflict ux
Clicking on a key conflict message opens the message detail view,
which displays the contact(s) in this conversation. If the message
contains a key conflict with any of these contacts, a button is
displayed which attempts to resolve that conflict and any other
conflicts in the conversation that are related to that contact.
10 years ago
lilia 857eee5003 Divorce identity wipe from tryAgain functions
We'd like to live in a world where we can retry all the pending
conflicts in a conversation as a batch, which means we don't want to
wipe the identity key before processing each message. Thus, remove that
step from these handlers and encapsulate in a method on the conversation
model.
10 years ago
lilia 04796e56d1 Fix tests 10 years ago
lilia 8e54aa1401 Plumb contact avatars into conversations 10 years ago
lilia 2ee34343a8 Use consistent boiler plate throughout js files 10 years ago
lilia c08c29bd4a Render group members in the message detail view
This requires that we fetch contact info when opening a conversation
so that's available for rendering contact names and avatars.
10 years ago
lilia ec43a0b633 jshint all the things
Small style fixes here and there. Removed one unused file.
10 years ago
lilia 1bdb42b67e Fix bug loading conversation upsidedown
Sometimes a conversation's messages would be reverse-ordered on first
load, correcting themselves after a refresh. This is an artifact of the
order we load messages from the database. To fix, load them in the
opposite order.

The alternative solution would be to reset the collection every time we
fetch new messages, but this would create an entirely new set of model
objects each time, which seems unnecessary.
10 years ago
lilia 94c94eb7c9 Refactor message view
The message view has three flavors so far, a normal text+attachments
message, a group update, and an end session message. This changeset
extracts the normal message rendering into its own subview, and adds
some convenience functions to the message model in order to simplify
some of that flavoring logic.
10 years ago
lilia cfd4ccc803 Move index querying logic to /models 10 years ago
lilia 6cbde7894a Delivery receipts 10 years ago
lilia 006653ed8e DB/Index Redux
This change removes the timestamp field from messages and conversations
in favor of multiple semantically named timestamp fields: sent_at,
received_at on messages; active_at on conversations. This requires/lets
us rethink and improve our indexing scheme thusly:

The inbox index on conversations will order entries by the
conversation.active_at property, which should only appear on
conversations destined for the inbox.

The receipt index will use the message.sent_at property, for effecient
lookup of outgoing messages by timestamp, for use in processing delivery
receipts.

The group index on conversation.members is multi-entry, meaning that
looking up any phone number in this index will efficiently yield all
groups the number belongs to.

The conversation index lets us scan messages in a single conversation,
in the order they were received (or the reverse order). It is a compound
index on [conversationId, received_at].
10 years ago
lilia 99a2685f93 Store attachments as binary blobs
Move base64 encoding of attachments to an AttachmentView. This makes
image rendering an asynchronous task so we fire an update event to
indicate to the parent MessageListView that its content has changed
height and it is time to scroll down.
11 years ago
lilia bf22da209f Fix tests 11 years ago
lilia fd3a72d435 Destroy all globals
Well, not *all* globals..
11 years ago
lilia ced295a630 Move message and conversation storage to IndexedDB
Getting up and running with IndexedDB was pretty easy, thanks to
backbone. The tricky part was making reads and writes asynchronous.
In that process I did some refactoring on Whisper.Threads, which
has been renamed Conversations for consistency with the view names.

This change also adds the unlimitedStorage permission.
11 years ago
lilia 735737f0bc Merge Whisper.Messages into Whisper Threads
Eliminates the global Whisper.Messages object and consolidates shared
send/receive logic in Whisper.Threads.

To the latter end, note that the decrypted array buffer on an attachment
pointer is now named data instead of decrypted, in order to match the
format of outgoing attachments presented by
FileReader.readAsArrayBuffers and let us use the same handler to base64
encode them.
11 years ago
Arlo Breault bc5dea62c3 Use FileReader to base64 encode attachments
* Implements #82
11 years ago
lilia 9c568ed0b8 Don't warn on missing message bodies
A message can be blank if it has an attachment
11 years ago
lilia eebb14599f Well that's handy 11 years ago
lilia 6db3eeb52e Convert incoming timestamps into numbers
Fixes #59

protip: don't use << for anything over 2^32. The operands of all bitwise
operators are converted to signed 32-bit integers
11 years ago
lilia c034ac8267 Refactor components for the main content section
Each conversation views now manages its own separate elements
rather than all binding to a shared #conversation element, and
similarly for message composition ui.

Also includes the beginnings of group creation UI (not working yet),
featuring bootstrap-tagsinput field for entering group recipients
11 years ago
lilia 06ff6c3087 Let thread collection double as contacts db
When a thread is 'destroyed' from the UI we delete its messages and mark
the thread as inactive, (in other words, keep it around as contact info).
Additionally, we only load active threads when initializing the UI, and
reactivate threads when new messages are added to them.

Conflicts:
	js/models/messages.js
	js/models/threads.js
	js/views/conversations/show.js
11 years ago
lilia ebf1b3352f Use separate message collections for each thread to facilitate lookup and lazy loading 11 years ago
lilia ec900e0ea4 Fix double display of outgoing messages 11 years ago
lilia a09a4776d3 Fix incoming message display/storage
There were a few problems.

1. The message event was being triggered in background, not popup
2. The initial message/thread fetches from localStorage were mis-ordered
3. The timestamp wasn't being extracted from the right place
4. #3 caused messages to fail validation and not be saved

1-3 are fixed. To address 4 I switched validate() to log a warning
instead of preventing save.
11 years ago
Matt Corallo d0fd3e94d8 sendMessage refactor, initial group stuff (breaks message storage) 11 years ago
lilia 83508abab8 Thread model and UI improvements
Adds thread model/collection for managing conversation-level state, such
as unreadCounts, group membership, thread order, etc... plus various UI
improvements enabled by thread model, including an improved compose
flow, and thread-destroy button.

Adds Whisper.notify for presenting messages to the user in an orderly
fashion. Currently using a growl-style fade in/out effect.

Also some housekeeping:
Cut up views into separate files.
Partial fix for formatTimestamp.
Tweaked buttons and other styles.
11 years ago
Matt Corallo 9aae93fc99 textsecure.protos 11 years ago
Matt Corallo ee2f43aba4 Fix, display (image) attachments 11 years ago
lilia 3bd559bbaa DRY up PushMessageContentProtobuf construction
Messages now know how to protobuf-ify themselves.
11 years ago
lilia 2601c3cc3a Rename some things to be a little more semantic
The 'sender' field actually holds the recipient for outgoing
messages. Rename that field to 'person', indicating the 2nd
party generically.

Also decouples the thread name from thread recipients at the
view layer, in preparation for group support.
11 years ago
lilia b852e68290 Backbone message storage and views
Adds Backbone-based Whisper.Messages model/collection with local storage
extension. Saves sent and received messages in Whisper.Messages instead
of message map. This will assign a unique id to the message and save it
to localStorage.

Adds Backbone-based view to popup.html
  Automatically updates itself when new messages are saved to
  Whisper.Messages db from the background page.

Added some shiny new styles, and started splitting up css into multiple
files for sanity's sake.
11 years ago