Commit Graph

260 Commits (ac401c78b30a6c1d064e3ff8a3bdabb53b36e9d2)

Author SHA1 Message Date
lilia d20e23402d Refactor RecipientsInputView from NewConversationView
For reuse on group update screen.
10 years ago
lilia 36319d6458 Fix crash when sending :invalid_emoji: 10 years ago
lilia f1309b71c1 Don't scale or compress gifs
If a gif is too large, it's too large.

Fixes #196
10 years ago
lilia 8e54aa1401 Plumb contact avatars into conversations 10 years ago
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.
10 years ago
lilia ed707db4ba Support :emoji_name: syntax for emoji text input 10 years ago
lilia 254131488e Render emoji in conversation and inbox views. 10 years ago
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.
10 years ago
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.
10 years ago
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.
10 years ago
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.
10 years ago
lilia dc1b09f59d Auto-link urls in message bodies
And watch out for xss.

Closes #187
10 years ago
lilia 01d5881a71 Remove unneeded if-gaurd 10 years ago
lilia b65190e101 Break a long line 10 years ago
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.
10 years ago
lilia dfe7813e7f Fix multiple from address in message detail 10 years ago
lilia 2ee34343a8 Use consistent boiler plate throughout js files 10 years ago
lilia f89cf890df Clean up older views, mostly whitespace 10 years ago
lilia 44a31f3ed9 Remove unneeded function 10 years ago
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.
10 years ago
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
10 years ago
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.
10 years ago
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.
10 years ago
lilia 258a872ce3 Trigger update events after attachments load
Mostly so we can ensure we're scrolled to the bottom when the
conversation is loaded.
10 years ago
lilia f9ca13a86f DRY up audio and video views 10 years ago
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
10 years ago
lilia 4cefd17ac6 Remove unused view 10 years ago
lilia 9d94bce92a After clearing messages, leave conversation open
Fixes #178
10 years ago
lilia 0778854cc4 Attachments should be in spans, not divs 10 years ago
lilia 1311f7c9ae Fix attachment previews for audio/video files 10 years ago
lilia 6fe262ceed Lazy init file input's FileReader 10 years ago
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.
10 years ago
lilia ddc0ed1b9a Add audio and video players
Basic implementation using html5 audio/video tags and data URIs.
10 years ago
lilia aa659877be Fix broken file input view 10 years ago
lilia dcc1588219 Add key verification screen
Accessible from the menu on private conversations.
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 fd30dc6f1a Add message detail view 10 years ago
lilia 368cd2f79a Refactor back button style
Make it easier to reuse these styles.
10 years ago
lilia 55c46d1bb6 Close conversation menu when clicking outside it 10 years ago
lilia e853c21c98 Remove unused code
There is no .settings-btn or .go-back in this view.
10 years ago
lilia ec43a0b633 jshint all the things
Small style fixes here and there. Removed one unused file.
10 years ago
lilia 09704444e9 Fix missing delivery receipt checkmarks
The delivered class should be updated on each render to ensure it is
up to date.
10 years ago
lilia 3292177a96 Remove resize logic in favor of pure css 10 years ago
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.
10 years ago
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.
10 years ago
lilia 1c589f2fad Fix list_view.js and message_view.js whitespace 10 years ago
lilia 4716754209 Refactor content message class names 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 85bec04010 Render leave-group messages correctly 10 years ago
lilia 367421d40a Style end session messages
Also add a missing call to render()
10 years ago
lilia f00a8f1e81 Render end session messages correctly 10 years ago
lilia 488f25635d Wire up end session and leave group
Closes #136
Closes #137
10 years ago
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.
10 years ago
lilia 44f9ea5d49 Fix identity key error rendering 10 years ago
lilia 9fe99adf0c Get scrolling right on conversation load 10 years ago
lilia f5c7be7d35 Add some resizes 10 years ago
lilia 5a302271b3 Remove unneeded listeners 10 years ago
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.
10 years ago
lilia 5e064db28f Render the message list view. 10 years ago
lilia 5ad5464dd1 Fetch messages in the background 10 years ago
lilia 52b3114970 Simplify list view resizing 10 years ago
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.
10 years ago
lilia a5bc261365 Clear selected files after each sent message 10 years ago
lilia 2de682ef7b Don't create a group without a name 10 years ago
lilia d5c85dfbd8 Resize inbox listview after it finishes loading
Ensures that scrollbars are properly setup on load.
10 years ago
lilia 4422582ab7 Fixup opening existing private conversations 10 years ago
lilia 200981e022 Avoid adding empty-string numbers to recipients 10 years ago
lilia 3a099657e6 Untangle select vs open events 10 years ago
lilia 9087918500 Don't add new convos to inbox until a message is sent 10 years ago
lilia af49ad9b90 Dry up new contact init and handling 10 years ago
lilia 63d232dedb Draw attention to invalid numbers 10 years ago
lilia 746e6530b9 WIP pill view for selected recipients 10 years ago
lilia 5e3ed1658b Show phone numbers in contact selector 10 years ago
lilia 9e245e67e0 Fix double-opening exsisting conversations from typeahead 10 years ago
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
10 years ago
lilia db5e7fd6b6 Fix list view scrolling
Resize handlers are ugly. But not as ugly as scroll handlers. :p
Normalized some whitespace along the way.
10 years ago
lilia 0f29cf2043 Put spaces between joined members in group updates 10 years ago
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.
10 years ago
lilia acc2c6f536 Sort contact selector by title 10 years ago
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.
10 years ago
lilia b3e32a2642 Only load contacts (not groups) in the typeahead 10 years ago
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.
10 years ago
lilia 0d6fbabb3e Trigger a checkbox event from conversation list items 10 years ago
lilia 3d5553df09 Remove listener for model open event 10 years ago
lilia 87cd3f5053 Save and open new contact on click 10 years ago
lilia 17f3263a21 Listen for escape key anywhere in the inbox 10 years ago
lilia 070393170c Auto-focus new conversation input field 10 years ago
lilia b1ad04298f Add title bar label to new conversation view 10 years ago
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.
10 years ago
lilia 9a6c6bcd98 Reset the typahead before showing it 10 years ago
lilia b13e36a11c Style conversation menu 10 years ago
lilia 80ce2d95e0 Sort contacts by name in compose flow 10 years ago
lilia 6d81011f6a Add back button to compose view 10 years ago
lilia fedfdcdd7e Style elements for compose flow 10 years ago
lilia 17deb69a91 Make conversation panel work with a new contact
Prevent view from fetching messages without an id, as this causes a
crash.
10 years ago
lilia 5762724709 Don't show new contact unless input may be a phone number 10 years ago
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.
10 years ago
lilia 00e9e3b757 Setup loading gif on conversation list
TODO: get actual gif asset in there.
10 years ago
lilia cc0acc56dd Initially hide newConversationView 10 years ago
lilia 613dc3bedd Start on support for messaging a brand new contact 10 years ago