Commit graph

380 commits

Author SHA1 Message Date
lilia
e8cb4efaa4 Allow key conflict resolution for group updates
Creating a group with a member who's identity key has changed would
previously fail silently. Now, we catch and save the error, allowing the
same conflict resolution process as with regular messages.

Fixes #205
2015-03-24 10:11:39 -07:00
lilia
4bd46f80e7 Allow empty group avatar file input 2015-03-23 19:24:26 -07:00
lilia
ce36c36bd0 Include outgoing control messages in message history
So you know it worked.
2015-03-23 19:24:12 -07:00
lilia
6c3ac2de02 Collapse two views into one
We used to have a subview that branched on content/control messages, but
no more.
2015-03-23 18:30:16 -07:00
lilia
caddb8dc09 Smoother group create experience
Previously there was a long pause between confirming the group details
and opening the conversation. Fix by first saving/opening the
conversation, rather than waiting for the initial group update to finish
transmitting.
2015-03-23 17:33:46 -07:00
lilia
74e01c2a95 Re-render control messages if necessary 2015-03-23 16:41:03 -07:00
lilia
48b0e8832d Fix message detail contacts for incoming group message
Previously the From-field displayed all the group contacts.
2015-03-23 16:12:26 -07:00
lilia
bd82591b6c Remove extraneous listener 2015-03-23 16:05:55 -07:00
lilia
a7079206f4 Nicer looking end-session and group control messages 2015-03-23 15:49:31 -07:00
lilia
20baa795ad Fixes #198 Squished avatars
Refactor all avatar views to use a shared partial, then change it to a
background image. Requires allowing unsafe-inline styles in the CSP.
2015-03-23 14:01:18 -07:00
lilia
5ffa265559 Revert "Popout inbox"
This reverts commit 31e7d285e3.

This seemed like a nice feature, but the popup bubble isn't very
conducive to nontrivial user inputs, e.g. file inputs.

Fixes #211
2015-03-23 12:19:32 -07:00
lilia
c526dbda5f Set up production build task
`grunt copy`

Closes #191
2015-03-19 18:34:56 -07:00
lilia
43ec4099c9 Reset the name field on new group form 2015-03-19 13:55:13 -07:00
lilia
9930937707 Move handlePushMessageContent to message model
And retool message handling flow to helps us avoid instantiating
duplicate message and conversation models.
2015-03-18 16:29:03 -07:00
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.
2015-03-18 16:29:02 -07:00
lilia
31e7d285e3 Popout inbox
Rather than opening the inbox in its own window, let it appear as a
browser action popup by default, but allow promotion to its own window
if requested.
2015-03-18 16:29:01 -07:00
lilia
cecb438a52 Simplify avatar rendering 2015-03-18 16:29:01 -07:00
lilia
f86d6d51e3 Only init emoji map once.
`emoji.init_colons` creates and populates `emoji.map.colons`, a global
map from common names to emoji code points. It's safe to call
repeatedly, but unecessary.
2015-03-16 17:44:49 -07:00
lilia
651b6341fa Unbind frontend listeners when window closes 2015-03-14 20:46:00 -07:00
lilia
69d5a6a33c Improve group update ui/ux
Promote group update to its own screen. Add typeahead contact selector
from new conversation view. Restyle to match android (more or less).

Closes #186
2015-03-13 17:33:02 -07:00
lilia
d20e23402d Refactor RecipientsInputView from NewConversationView
For reuse on group update screen.
2015-03-13 17:29:28 -07:00
lilia
36319d6458 Fix crash when sending :invalid_emoji: 2015-03-12 11:03:11 -07:00
lilia
f1309b71c1 Don't scale or compress gifs
If a gif is too large, it's too large.

Fixes #196
2015-03-11 20:20:54 -07:00
lilia
8e54aa1401 Plumb contact avatars into conversations 2015-03-11 17:49:01 -07:00
lilia
019a9d1fbc Unread counts
Update unreadCounts per-conversation on incoming messages. Render unread
conversations with font-weigh: bold in the inbox view.

To ensure that the inbox and conversation views remain in sync, the
background page now ensures that the same models objects are used for
both views.
2015-03-11 15:13:36 -07:00
lilia
ed707db4ba Support :emoji_name: syntax for emoji text input 2015-03-10 18:54:07 -07:00
lilia
254131488e Render emoji in conversation and inbox views. 2015-03-10 18:15:31 -07:00
lilia
c73f4d71a7 DRY up scrollable pattern
Switch to using gutter class instead of id since there is potentially
more than one usage on the page.
2015-03-09 16:05:06 -07:00
lilia
a72ea7966d Clean up inbox/compose view rendering and swapping
Templatize the inbox view and use the same pattern for in-window view
switching as is now used with the conversation/message detail views.
This means doing more with markup and less jquery manipulation of
individual subelements of the inbox view.
2015-03-09 16:05:06 -07:00
lilia
fd6e2954f7 Curtail over-zealous websocket reconnects
Closes #173

Previously, in the event of a failed websocket auth, we would attempt to
reconnect once a second ad infinitum. This changeset ensures that we
only reconnect automatically if the socket closed 'normally' as
indicated by the code on the socket's CloseEvent. Otherwise, show a
'Websocket closed' error on the inbox view.

Ideally we would show a more contextual error (ie, 'Unauthorized'), but
unfortunately the actual server response code is not available to our
code. It can be observed in the console output from the background page,
but programmatically, we only receive the WebSocket CloseEvent codes
listed here:
https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes

The websocket error message is displayed by a normally-hidden but ever
present socket status element. Clicking this element will immediately
refresh the background page, which will try again to open the websocket
connection.
2015-03-09 16:04:26 -07:00
lilia
1321a90667 Rename Whisper.View#attributes
Avoid colliding with Backbone.View attributes, which is a list of attrs
to set on the html element for a view.
2015-03-06 17:05:36 -08:00
lilia
dc1b09f59d Auto-link urls in message bodies
And watch out for xss.

Closes #187
2015-03-06 17:01:04 -08:00
lilia
01d5881a71 Remove unneeded if-gaurd 2015-03-05 17:48:07 -08:00
lilia
b65190e101 Break a long line 2015-03-05 16:30:59 -08:00
lilia
99787753a8 Stop re-rendering attachments on delivery receipt
Only re-render a message if the body changed. Re-render only the
delivery receipt checkmark if the delivered property changes.

Fix a bug where attachments flash in and out of existance when a
delivery receipt arrives.
2015-03-05 16:14:51 -08:00
lilia
dfe7813e7f Fix multiple from address in message detail 2015-03-05 15:54:23 -08:00
lilia
2ee34343a8 Use consistent boiler plate throughout js files 2015-03-05 15:45:35 -08:00
lilia
f89cf890df Clean up older views, mostly whitespace 2015-03-05 15:39:44 -08:00
lilia
44a31f3ed9 Remove unneeded function 2015-03-05 15:36:48 -08:00
lilia
1bb480f6ea DRY up a common view pattern
Define a Whisper.View base class that automatically parses and renders
templates and attributes defined by the subclass. This saves us a good
number of lines of code as well as some marginal memory overhead, since
we are no longer saving per-instance copies of template strings.
2015-03-05 15:36:35 -08:00
lilia
7c9ad975bb Unravel image processing recursion and fix bugs
Although I find the previous implementation more elegant, it results in
a deeper nesting of Promises than necessary, which can make debugging
more complicated. The canvas scaling and compression apis are actually
synchronous, so the callback structure isn't really recessary here.
Converting to a loop also makes this process easier to understand at
a glance.

Fixed some bugs along the way:
* accidentally scaling small images up to 1920px
* jpeg compressing gifs and other formats even if unnecessary
2015-03-04 18:43:38 -08:00
lilia
0da04632f2 Scale large images even if they are small
Previously we would not scale large resolution images with small file
sizes, but in fact, both resolution and file size constraints should be
enforced.
2015-03-04 16:07:02 -08:00
lilia
8bc77fa02b Automatically compress and scale large images
Do nothing to other file types. Continue to block files that are too
large even after scaling and compression.
2015-03-04 13:59:30 -08:00
lilia
258a872ce3 Trigger update events after attachments load
Mostly so we can ensure we're scrolled to the bottom when the
conversation is loaded.
2015-03-03 13:23:55 -08:00
lilia
f9ca13a86f DRY up audio and video views 2015-03-03 13:05:39 -08:00
lilia
df06499a19 Use blob urls to display attachments
Converting attachment data to base64-encoded data uris takes O(n) and
there's no need! URL.createObjectURL returns a magic link that can be
set as the `src` attribute to `img`, `video`, and `audio` tags to load
blob data directly without copying.

https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL
2015-03-03 13:05:24 -08:00
lilia
4cefd17ac6 Remove unused view 2015-03-03 10:55:04 -08:00
lilia
9d94bce92a After clearing messages, leave conversation open
Fixes #178
2015-03-03 10:39:10 -08:00
lilia
0778854cc4 Attachments should be in spans, not divs 2015-03-02 18:37:20 -08:00
lilia
1311f7c9ae Fix attachment previews for audio/video files 2015-03-02 18:27:14 -08:00
lilia
6fe262ceed Lazy init file input's FileReader 2015-03-02 18:01:59 -08:00
lilia
db7dee9a8a Fixup file size warning
Add contentType-specific limits, switch to lazy-init iff we encounter an
oversized file, and restyle as a toast, factoring out a generic
ToastView along the way.
2015-03-02 17:50:03 -08:00
lilia
ddc0ed1b9a Add audio and video players
Basic implementation using html5 audio/video tags and data URIs.
2015-03-02 15:49:14 -08:00
lilia
aa659877be Fix broken file input view 2015-03-02 15:35:04 -08:00
lilia
dcc1588219 Add key verification screen
Accessible from the menu on private conversations.
2015-02-26 22:26:46 -08:00
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.
2015-02-26 13:35:04 -08:00
lilia
fd30dc6f1a Add message detail view 2015-02-23 14:03:35 -08:00
lilia
368cd2f79a Refactor back button style
Make it easier to reuse these styles.
2015-02-23 12:52:15 -08:00
lilia
55c46d1bb6 Close conversation menu when clicking outside it 2015-02-19 11:55:31 -08:00
lilia
e853c21c98 Remove unused code
There is no .settings-btn or .go-back in this view.
2015-02-19 11:00:29 -08:00
lilia
ec43a0b633 jshint all the things
Small style fixes here and there. Removed one unused file.
2015-02-19 00:22:23 -08:00
lilia
09704444e9 Fix missing delivery receipt checkmarks
The delivered class should be updated on each render to ensure it is
up to date.
2015-02-18 23:57:19 -08:00
lilia
3292177a96 Remove resize logic in favor of pure css 2015-02-18 23:09:34 -08:00
lilia
07e44ccf21 Revisit resize and scroll logic once more
Wait a little longer on initial scroll down. Previous timeout sometimes
triggered before all text is finished rendering.

Remove redundant resize calls.
2015-02-18 16:54:43 -08:00
lilia
955ef60292 Fix list_view-related error in background page
Background page conversations were trying to trigger events on the inbox
list view which had been destroyed, resulting in a background page
console error of "can't read innerHeight of null".

Avoid this by removing listeners when the inbox window is closed.
2015-02-18 11:26:18 -08:00
lilia
1c589f2fad Fix list_view.js and message_view.js whitespace 2015-02-18 00:11:35 -08:00
lilia
4716754209 Refactor content message class names 2015-02-18 00:11:35 -08:00
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.
2015-02-17 12:07:46 -08:00
lilia
85bec04010 Render leave-group messages correctly 2015-02-16 12:47:36 -08:00
lilia
367421d40a Style end session messages
Also add a missing call to render()
2015-02-13 16:21:39 -08:00
lilia
f00a8f1e81 Render end session messages correctly 2015-02-13 14:25:16 -08:00
lilia
488f25635d Wire up end session and leave group
Closes #136
Closes #137
2015-02-13 14:25:16 -08:00
lilia
85b4643e9b Fixes #161
The first message sent to a new contact was throwing 'Unknown Group'.
This was because we didn't wait for the initial save to sync the `type`
attribute to indexedDB. Instead, don't trigger the conversation to open
until it has finished saving.
2015-02-13 12:57:19 -08:00
lilia
44f9ea5d49 Fix identity key error rendering 2015-02-12 13:36:19 -08:00
lilia
9fe99adf0c Get scrolling right on conversation load 2015-02-12 13:21:18 -08:00
lilia
f5c7be7d35 Add some resizes 2015-02-12 13:21:18 -08:00
lilia
5a302271b3 Remove unneeded listeners 2015-02-12 13:21:18 -08:00
lilia
0463e385e8 Remove uneeded render
This is an artifact of a time when conversation elements would pop in
and out of the dom at a moment's notice, and thus needed to rebind their
event listeners regularly.
2015-02-12 13:21:18 -08:00
lilia
5e064db28f Render the message list view. 2015-02-12 13:21:17 -08:00
lilia
5ad5464dd1 Fetch messages in the background 2015-02-12 13:21:17 -08:00
lilia
52b3114970 Simplify list view resizing 2015-02-12 13:21:17 -08:00
lilia
44b1e5c88e Move inbox collection to the background page
No more waiting, no more messy fetch logic. Background page
bootstraps the inbox and keeps it up to date.
2015-02-12 13:21:17 -08:00
lilia
a5bc261365 Clear selected files after each sent message 2015-02-12 13:21:17 -08:00
lilia
2de682ef7b Don't create a group without a name 2015-02-12 13:21:17 -08:00
lilia
d5c85dfbd8 Resize inbox listview after it finishes loading
Ensures that scrollbars are properly setup on load.
2015-02-12 13:21:17 -08:00
lilia
4422582ab7 Fixup opening existing private conversations 2015-02-12 13:21:17 -08:00
lilia
200981e022 Avoid adding empty-string numbers to recipients 2015-02-12 13:21:17 -08:00
lilia
3a099657e6 Untangle select vs open events 2015-02-12 13:21:17 -08:00
lilia
9087918500 Don't add new convos to inbox until a message is sent 2015-02-12 13:21:16 -08:00
lilia
af49ad9b90 Dry up new contact init and handling 2015-02-12 13:21:16 -08:00
lilia
63d232dedb Draw attention to invalid numbers 2015-02-12 13:21:16 -08:00
lilia
746e6530b9 WIP pill view for selected recipients 2015-02-12 13:21:16 -08:00
lilia
5e3ed1658b Show phone numbers in contact selector 2015-02-12 13:21:15 -08:00
lilia
9e245e67e0 Fix double-opening exsisting conversations from typeahead 2015-02-12 13:21:15 -08:00
lilia
aca3db97da New messages auto-update the inbox & conversation
When a new message arrives, if its conversation is not already opened,
the background page opens it. If it is alrady open the window is
focused. Finally, the 'message' event is triggered, resulting in
   1. the inbox refetches conversations
   2. all conversations fetch new messages

TODO: only send this event to the target window
2015-02-11 17:38:03 -08:00
lilia
db5e7fd6b6 Fix list view scrolling
Resize handlers are ugly. But not as ugly as scroll handlers. :p
Normalized some whitespace along the way.
2015-02-11 17:38:03 -08:00
lilia
0f29cf2043 Put spaces between joined members in group updates 2015-02-11 17:38:01 -08:00
lilia
d435ff003b Improve typeahead contact selector experience
Store and match on various phone number formats. Still not perfect, as
occasionally all the models are returned for a non-matching query.
2015-02-11 17:38:01 -08:00
lilia
acc2c6f536 Sort contact selector by title 2015-02-11 17:38:01 -08:00
lilia
a00632c728 Hook up group creation flow UI
Checkboxes add and remove members as well as exposing the group update
ui. The conversation window is opened after saving the group.
2015-02-11 17:38:01 -08:00
lilia
b3e32a2642 Only load contacts (not groups) in the typeahead 2015-02-11 17:38:01 -08:00
lilia
2f93fb9fbc Remove unneeded comparator
This collection is just an in-memory indexer used for typeaheads. For
display, the matching models are added to a separate collection. Thus,
the order of the elements in the typeahead collection does not matter.
2015-02-11 17:38:01 -08:00
lilia
0d6fbabb3e Trigger a checkbox event from conversation list items 2015-02-11 17:38:01 -08:00
lilia
3d5553df09 Remove listener for model open event 2015-02-11 17:38:01 -08:00
lilia
87cd3f5053 Save and open new contact on click 2015-02-11 17:38:00 -08:00
lilia
17f3263a21 Listen for escape key anywhere in the inbox 2015-02-11 17:38:00 -08:00
lilia
070393170c Auto-focus new conversation input field 2015-02-11 17:38:00 -08:00
lilia
b1ad04298f Add title bar label to new conversation view 2015-02-11 17:38:00 -08:00
lilia
d26dc8c7e6 Move openConversation handler to InboxView
Removes the background page ref to inbox which should fix view tests.
Prep for handling new contact creation.
2015-02-11 17:38:00 -08:00
lilia
9a6c6bcd98 Reset the typahead before showing it 2015-02-11 17:38:00 -08:00
lilia
b13e36a11c Style conversation menu 2015-02-11 17:38:00 -08:00
lilia
80ce2d95e0 Sort contacts by name in compose flow 2015-02-11 17:38:00 -08:00
lilia
6d81011f6a Add back button to compose view 2015-02-11 17:38:00 -08:00
lilia
fedfdcdd7e Style elements for compose flow 2015-02-11 17:37:59 -08:00
lilia
17deb69a91 Make conversation panel work with a new contact
Prevent view from fetching messages without an id, as this causes a
crash.
2015-02-11 17:37:59 -08:00
lilia
5762724709 Don't show new contact unless input may be a phone number 2015-02-11 17:37:59 -08:00
lilia
4ee4872b27 Stop matching typeahead against group members
It feels a little weird when you can't see the matching member. Would
consider putting this back in if we display the member list in the
contact list item view.
2015-02-11 17:37:59 -08:00
lilia
00e9e3b757 Setup loading gif on conversation list
TODO: get actual gif asset in there.
2015-02-11 17:37:59 -08:00
lilia
cc0acc56dd Initially hide newConversationView 2015-02-11 17:37:59 -08:00
lilia
613dc3bedd Start on support for messaging a brand new contact 2015-02-11 17:37:59 -08:00
lilia
d3d84f3124 Let typeahead surface groups with matching members 2015-02-11 17:37:59 -08:00
lilia
e149650d94 Refactor typeahead into new conversation view 2015-02-11 17:37:58 -08:00
lilia
f207137b35 Customize typeahead tokenizer 2015-02-11 17:37:58 -08:00
lilia
c6a19afd29 Tweak contact style in typeahead
Remove message snippets and dates.
Add checkboxes.
2015-02-11 17:37:58 -08:00
lilia
7bcceacf69 Implement typeahead (first pass) 2015-02-11 17:37:58 -08:00
lilia
79b4c89ce4 Fixup attachment preview 2015-02-11 17:37:58 -08:00
lilia
bd86546cea Make chat window titles match contact list 2015-02-11 17:37:58 -08:00
lilia
1a553fef17 Hide file modal until it's needed 2015-02-11 17:37:58 -08:00
lilia
58e7f3c7e1 Fix file input click zone
Previously, the ugly file input was hidden with opacity, and styled as a
square paperclip icon, but its drop and click zones were not constrained
to the visible square. They remained active across the whole 'Choose
File' button, which overlapped with the textarea. Instead, hide the file
input complete (display: none) and transmit click events from the
paperclip to the input programmatically.

Eventually, we'll need to address drag and drop events, but I want to do
that at the window level. Otherwise dropping a file outside the file
input drop zone causes the browser to navigate to the file://... url.
2015-02-11 17:37:57 -08:00
lilia
8498d7ad1f Fixup conversation page styles and functionality
Render the entire conversation from a template, because some parts of it
must be rendered conditionally if it is a group vs private conversation.

Also apply some style fixes and restore lost functionality:
  * Make conversation title bar fixed.
  * Widens message bubbles.
  * Unhide message list.
  * Restore attachment rendering.
  * Restore message sending and attachment file selection.
  * Style attachments file input as a paperclip.
  * Style send button like on Android and make it a submit input.
2015-02-11 17:37:57 -08:00
lilia
34d5f3e88a Cleanup inbox view
Don't auto open the last conversation. It doesn't make sense now that we
no longer have two column layout.

Don't trigger/listen for selected events. There's no need since the list
item opens a new popup now.
2015-02-11 17:37:57 -08:00
lilia
607d5d3307 Abstract chrome browser action and windows stuff 2015-02-11 17:37:56 -08:00
Riley Shaw
94ce4d4b91 Simplify panel state management and message passing 2015-02-11 17:37:56 -08:00
Riley Shaw
9071d98395 Update styles to material design to match Android client (first pass) 2015-02-11 17:37:56 -08:00
Riley Shaw
783a3f7c15 Prevent duplicate conversations and refocus on click (still buggy) 2015-02-11 17:37:56 -08:00
Riley Shaw
7ec27f814f Get conversations loading through localStorage 2015-02-11 17:37:56 -08:00
Riley Shaw
2cbcb28ee3 Start on panels 2015-02-11 17:37:56 -08:00
lilia
8097db9af7 Micro refactor group update setup in message view 2015-01-21 13:53:41 -10:00
lilia
94e14f2c85 Add license headers
Closes #75
2015-01-18 14:21:22 -10:00
lilia
5d044bd00e Fire an event on phone number validation
Fix a bug introduced by recent phone number input work that prevented
the call and sms buttons from being clickable.
2015-01-17 22:51:32 -10:00
lilia
f6376c0fa2 Rename event
'open' seems a better name for an event that triggers the open function.
2015-01-17 22:33:55 -10:00
lilia
f73596c240 Add a view for attachment previews 2015-01-16 13:39:01 -10:00
Emily Chao
bb2b53035e Restyled message attachments
Added a size limit, added functionality to delete the attachments before sending in a more user-friendly way
2015-01-16 13:06:49 -10:00
lilia
9baafddb14 Add license to file input view 2015-01-16 13:06:38 -10:00
lilia
d470b0eb53 Less jquery, more templating in conversation view
`if (foo) then jquery-dom-insert...` is a poor pattern to follow.
Instead, let mustache do the work.
2015-01-15 22:34:52 -10:00
Emily Chao
e74cba8a92 Restyled country dropdown
Added jquery plugin that allows for flags and country codes to be
displayed in a user-friendly way, on top of the existing phone view
2015-01-15 15:24:36 -10:00
Emily Chao
5d3020b9ed Refactor phone number input view
Moves validation logic to its own view to be shared on index and options
pages.
2015-01-15 11:51:32 -10:00
lilia
44007ca58f Add rudimentary ui for sending a group update 2015-01-15 09:23:13 -10:00
lilia
d119bdff01 restore default avatars 2015-01-14 01:37:41 -10:00
lilia
3d6c251fd1 Group avatars 2015-01-11 01:27:22 -10:00
lilia
d52db8fe6f Render group updates
Not pretty, but it works. Also allows for later localization.
Copy/behavior is borrowed from the Android client.

Closes #104
Fixes #65
2015-01-10 08:08:20 -10:00
lilia
0ea176dfa0 Don't require a conversation name
Just display a sensible default in the frontend if it's unset.
For private conversations this should be the phone number, for
groups, the list of numbers.
2014-12-24 14:32:11 -08:00
Dave Sescleifer
441962abc6 Fixed date format 2014-12-22 23:38:26 -08:00
lilia
ccc98d2f3d Fixup delivery receipts
Uses app-level timestamps for outgoing messages.
Adds timestamp property to the outgoing jsonData.
Triggers a runtime event to notify frontend on delivery receipts.
Renders delivered messages with a 'delivered' class.
2014-12-21 21:36:40 -08:00
lilia
3795ea5070 Fix message view using the wrong attribute 2014-12-19 17:59:23 -08:00
lilia
cfd4ccc803 Move index querying logic to /models 2014-12-19 17:59:18 -08:00
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].
2014-12-19 17:39:40 -08:00
lilia
5762e59c41 DRY up registration event callbacks
This was just a special case of the extension.on/trigger interface.
2014-12-19 14:02:52 -08:00
lilia
e68720f07f Frontend support for ReplayableErrors
Eventually we'll store errors on the message model, and this change will
let us render and process them.
2014-12-18 20:07:45 -08:00
lilia
8c93101989 Don't store conversationType on messages
This was used to conditionally render messages in the group style, but
it's actually unnecessary. We can render the same markup in both cases
and change the appearance with css.
2014-12-18 19:45:53 -08:00
lilia
8257fa7478 Add support for deleting a conversation
Note that the conversation record is not actually destroyed,
merely marked inactive, preserving the contact name, photo,
etc...
2014-12-03 01:37:06 -08:00
lilia
ccbe837ca2 Rebind events when opening a previously opened conversation 2014-11-25 13:54:44 -08:00
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.
2014-11-25 12:42:44 -08:00
lilia
bf22da209f Fix tests 2014-11-24 19:25:03 -08:00
lilia
d1c5b6da7a Get rid of Layout global
Instead, trigger and listen for events on the conversation collection
object.
2014-11-24 19:25:03 -08:00
lilia
a835887459 Fix scroll when re-opening a conversation 2014-11-24 19:25:03 -08:00
lilia
fd3a72d435 Destroy all globals
Well, not *all* globals..
2014-11-24 19:25:03 -08:00
lilia
c0681beca7 Consolidate message callbacks
Register the runtime callback at the top level view rather than having
each conversation view register independently.
Also refactors Layout into InboxView.
2014-11-24 19:25:03 -08:00
lilia
470346c9c4 Save incoming messages and pass to frontend asynchronously
After a message is saved asynchronsly, fire an event and pass the
message attributes to frontend listeners via the chrome-runtime API.

This behavior is similar to the 'storage' event fired by localStorage.
2014-11-24 19:25:03 -08:00
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.
2014-11-24 19:25:03 -08:00
lilia
b9859ad9d4 Add some license headers 2014-11-13 15:53:57 -08:00
lilia
28290477f4 Nicer timestamps with momentjs
This dependency may be a little heavy for our current use case, but we can
roll with it for now and find something slimmer if it turns out yagni.

Closes #77
Closes #40
2014-11-12 11:45:58 -08:00
lilia
0956d328da Fixes #71 Autoscroll
Conversation view autoscroll triggers on dom change, not storage change,
ensuring that we don't scroll before the new element is inserted.
2014-11-10 23:19:03 -08:00
lilia
aa937ae1d1 Add attachment inputs to new conversation form
Fixes reference error to 'map' on undefined attachments list.
2014-11-03 17:51:57 -08:00
lilia
987744cd79 Default avatars
Someday you'll be able to edit your avatar. Until then, put a bird on
it.
2014-10-29 16:05:51 -07:00
lilia
229007040c Basic frontend support for image attachments 2014-10-24 18:53:55 -07:00
lilia
d362d0d978 Autoscroll conversation views
Scroll to the bottom (most recent) message in the conversation when it
is opened, when we send a message, and when we receive a message.
2014-10-24 14:49:42 -07:00
lilia
d67b723f4f Highlight the selected thread 2014-10-22 17:26:37 -07:00
lilia
19dac1f3df Decorate incoming group messages
with numbers and image placeholders, so you know who's saying what.
2014-10-22 16:30:27 -07:00
lilia
78166365c7 Fix new message number validation 2014-10-22 16:07:16 -07:00
lilia
6e2a85ccf1 wip new message phone number validation 2014-10-22 12:05:33 -07:00
lilia
4f21bbd21f Use textsecure.messaging to create groups
Not textsecure.storage. Sigh. Also accomodate the fact that
the group id is not returned directly, but rather at the end
of a promise chain.
2014-10-16 14:15:13 -07:00
lilia
43f4f6cf99 Open a group's view after it's created 2014-10-14 21:35:40 -07:00
lilia
01f9fc1f17 More frontend groups fixes 2014-10-14 19:06:35 -07:00
lilia
dc41ebf701 Small frontend fixes for the new group view 2014-10-14 15:47:51 -07:00
lilia
81e4af5827 Move phonenumbery utils to libphonenumber object
Slowly whittling away at helpers.js...
2014-10-13 22:49:39 -07:00
lilia
0f4b53c176 Update records list in BBLocalStorage on fetch
Previously, would only update the known messages.
2014-10-09 20:08:28 -07:00
lilia
2288f8adc1 Fix new group ui not showing 2014-10-09 19:02:52 -07:00
lilia
ef066ea9d2 Make conversations open when they are created 2014-09-04 00:21:18 -07:00
lilia
230d24a69e Views already have a #remove() 2014-09-04 00:21:02 -07:00
lilia
db86abdf70 Add list view tests
Also,
 * moved fetch out of the list view
 * removed unused #last() function
 * put test setup lines in their own tiny file.
 * added data-cover to view script tags for code coveage reports.
2014-09-04 00:18:15 -07:00
lilia
ad7456b367 Refactor away this poorly named and overloaded file 2014-08-31 18:18:13 -07:00
lilia
b9640a54bd Move new convo stuff to its own file 2014-08-31 18:02:39 -07:00
lilia
9af18ce6ae Encapsulate page layout js
The layout class is the only class that should have knowledge of
page-level constant markup, such as #gutter and #contacts, and
should be pretty much the only place we find elements by id (with
the exception of template elements).

This change removes references to #gutter from views. Rather than
hardcoding assumptions about page layout, view elements should
ask the layout to insert themselves into the main content area by
calling Whisper.Layout.setContent.
2014-08-31 17:46:01 -07:00
lilia
5ddcc516e4 remove extra insertion, it's already happening 2014-08-25 19:01:18 -07:00
lilia
2f0b0f7a1b Get overflow scrolls working
Had to resort to a resize event handler.
A bit slow at times, but it works.
2014-08-25 19:01:13 -07:00
lilia
546cdf82cb Fix some markup issues
* Remove spurious search div
* Fix nested uls
* Use class name selected, not closed (the inverse)
* Restor nacl div
2014-08-25 18:59:22 -07:00
lilia
c2beda8e40 Get single recipient message composition working again 2014-08-25 18:55:51 -07:00
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
2014-08-25 18:54:55 -07:00
lilia
5f74a60364 Format thread timestamps 2014-08-25 18:48:12 -07:00