Commit graph

1910 commits

Author SHA1 Message Date
lilia
1e93b12b90 Update protos with support for null messages
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
6e758fc1ea Randomly pad all sync messages
WhisperSystems/libsignal-service-java@c46cdc0aa5

// FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
7bfb66b13b processVerifiedMessage: Archive all sessions when key changes
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
827addf628 Log on receipt of verified sync after we've processed the state
FREEBIE
2017-08-04 12:03:25 -07:00
lilia
d7054f4b63 Archive sessions whenever an identity key changes
Sessions established with the previous identity should no longer be used for
sending, so we should close them.

Since we've added this call to saveIdentity, we can omit the call to it after
profile fetches.

// FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
0056cbefc1 processVerifiedMessage: Trigger keychange event when key differs
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
0db2ef9e7f Refactor: combine Conversation.setVerified/setVerifiedDefault
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
d1fa28b706 Object.assign -> _.extend(), for to make Chrome 45 and below work
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
1e8ae774a2 Differentiate between local and remote trust decisions
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
20f4d48991 Protos: Move to latest iteration of verification protos
FREEBIE
2017-08-04 12:03:25 -07:00
lilia
3acfda3a56 Archive sessions on key changes after profile fetch
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
4232f5711c Handle identity key change errors on encrypt
We need to capture key change errors from the protocol library when we call
encrypt. Previously we would only see these on session init.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
4f2f622598 Apply special handling to verification sync messages
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
1614a6f1b8 Add special handling for verification sync
processVerifiedMessage checks the current state of the database against the
identity key from an incoming verification sync message to determine whether or
how to update our local record.

When syncing a DEFAULT status and we have no local record, it's a no-op, but
we'll log it.

When syncing a DEFAULT status and we have non-default record with the same key,
mark it as default.

When syncing a VERIFIED status and either:
  1. we have no key on record,
  2. we have have a different key on record, or
  3. we have the same key on record, but not verified
mark it as verified.

Otherwise do nothing.

References: https://github.com/WhisperSystems/Signal-Android/blob/master/src/org/thoughtcrime/securesms/util/IdentityUtil.java#L129

// FREEBIE

Ensure processVerified resolves
2017-08-04 12:03:25 -07:00
lilia
c60919ca0e Update setVerified to take an optional key argument
If specified, the existing local key must match the given one or we will not
update the record.

// FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
16433d661a Show call to action on group member list when verifying
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
31bf05e14a Add verified state summary to top of safety number screen
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
11372b4e00 Add icons for keychange and expiration timer in-conversation items
The shield matches the Android app's key change notification, and the
clock icon was easy to do and makes it easier to visually distinguish
those items in the conversation history.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
c714fb6dbf Shadow/icon/blue for banner, better verify advisories in dark theme
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
1d7cbc14fd Fix a couple bind()) issues when getting verified state
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
b0dbecb4e2 Check trust store for identity key information on every new message
It's debounced so it doesn't go too crazy.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
782c484680 Check trust store for latest identity key info before sending
We definitely want the latest information from our local database before
attempting to send.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
fc39241003 Ensure that we pull verified state only after getting profiles
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
4a1dc46ab3 Fixes to get local verification and sync messages working
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
c43d96904d Move to the real verify/trust APIs
This wires up verification sync messages, verification and trust checks
to the trust store instead of using mocked data.

FREEBIE
2017-08-04 12:03:25 -07:00
lilia
52481d1d13 Support for sending and receiving verification sync messages
This adds a new method to message sender for sending verification sync messages
and a new event to message receiver representing incoming verification sync
messages. Currently the event handler just logs the message.

// FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
475d607fd0 Prepare for verification sync messages: receiver, ready to send
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
aebf4b32d6 Conversation.updateLastMessage: fix indent, use of null message
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
36c28296e9 Remove extraneous logging
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
9b864c8675 Re-render verified change conversation items when convo changes
If the contact's name changes, for example.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
1cf9289b1a Add items to conversation history when user verifies/unverifies
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
a827334c3e Allow re-send of messages in msg detail view on OutgoingKeyError
We also show more errors than we used to in the MessageDetail screen
to help make it clear what is happening, and why the user would need to
re-send.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
688cae6374 Remove empty string class passed to contact template
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
8264f3ba33 Make the term 'Verified' fully localizable
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
e9968c3118 Remove comments after NewGroupUpdateView investigation
It doesn't run today - it depends on RecipientsInputView, which depends
on Backbone.TypeaheadCollection which doesn't currently exist in the
product.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
8d29cb9830 Prevent access to Safety Number when talking to yourself
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
c7e385eb38 Remove 'safety number approval' option from settings dialog
Also sync templates in test/index.html and background.html

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
9204188aa3 A bit of cleanup after some early code review
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
2955c36b3e Confirmation dialog: Make keyboard-accessible: escape to cancel
And proper tab order. Then some more work to re-focus on the message
composition field after the dialog shows up and steals focus.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
243cbd8123 Confirmaton on send, banner when 'unverified'
Not yet using the new APIs, but ready to. Still to do:
- Send sync messages on trust decisions
- Respond to received trust decision sync messages
- Show trust decisions in the conversation history
- In that rare situation where a sent message ends up with a key error
  make it easy to retry the send.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
bedf10056b Support for group-member verifications via second-level panel
Also:
- All the necessary wire-up to update things in real time. If you have
a safety number page up via a group member view as well as via a 1:1
conversation with that contact, they'll both be updated as the
underlying model changes. Similarly, the overall group will update
in real-time as members change.
- A bit of special-casing for yourself in a group conversation - you're
shown as 'me' and are not clickable, where normally that would take you
to the Safety Number screen for that contact. You are also not included
in the trust calculations for a given group.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
ae3587f05e Move all instances of 'verify identity' to 'show identity'
As discussed in standup this morning - only the act of verifying or a
statement about current status should use that word 'verify.'

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
ee0b0f5ffb Remove all concept of 'key conflict' from the app 2017-08-04 12:03:25 -07:00
lilia
0e0f14723e Rename model IdentityKey -> IdentityRecord
Reduce ambiguity in between the record itself, which now stores other
information besides the public key, and its `publicKey` attribute, which
contains an ArrayBuffer of key material.

This model is internal to SignalProtocolStore.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
aa6dbb2e59 Preserve UNVERIFIED status on key change
Don't revert it to default, which would effectively downgrade the security model
for that contact.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
12d9bb61c3 Let removeIdentityKey delete the entire record
Previously we would only clear the publicKey since that was the only attribute,
but now we should delete the entire record. This method is currently only called
from tests.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
d1858de39b Default nonblockingApproval to false
saveIdentity is invoked with only two arguments from the protocol layer, in
which case we should default nonblockingApproval to false.

76c28cfa7a/src/org/thoughtcrime/securesms/crypto/storage/TextSecureIdentityKeyStore.java (L87)

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
261ec003ee Account manager calls saveIdentityWithAtttributes
saveIdentityWithAtttributes allows directly setting all properties of an
identity key record. In AccountManager we use it to save our own identity
key after a new registration.

Previously we would remove the existing key first in order to coerce firstUse to
true, but now we can simply set it explicitly, along with a VERIFIED status.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
2a76bb6fc2 Add new methods to identity store
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
50dd9c6772 Add identityKey model validation
This will enforce that all identity record attributes are valid and present
before allowing the record to be saved. This is necessary since we will be
exposing a lower-level method to save an identity with explicit values for
firstUse, nonblockingApproval, and verified status.
2017-08-04 12:03:25 -07:00
lilia
b93042f12f Add verified status
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
c6bfdec84d Remove blockingApproval
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
53e7e1be3a Fix libsignal-protocol using wrong direction flag
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
6fdd0f1625 Handle identity errors on decrypt
Previously we only expected these errors to occur when decrypting prekey
messages, so we need to add handling for them in the case of a normal message.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
f095a1583e Fetch profiles whenever conversations are opened
For a group, fetch everyone's profile.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
d295fa7057 Update libsignal-protocol
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
1b9eb83422 Update isTrustedIdentity for directional trust
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
4e4aedd4ba Pass in non/blockingApproval args to saveIdentity
Multiple cases here:
1. setting our own key on registration
1. changing identities from a safety number change dialog

Note that removeIdentityKey runs before saveIdentity, so we'll always end up
with firstUse: true on our own key.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
3ca511a10a Unwrap removeIdentityKey from calls to saveIdentity
saveIdentity is now reponsible for determining firstUse, so we must not remove
the existing key before updating it.

Previously, the implementation provided an extra check against overwritting an
existing key, but that should be done via isTrustedIdentity instead.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
82469713d2 Update saveIdentity
Add support new blockingApproval and nonblockingApproval arguments
Populate the firstUse property on identity key records
Return whether an existing record was overwritten.

References
https://github.com/WhisperSystems/Signal-Android/commit/39d4a7#diff-69ede72c549da6bcbcd959935995b7e9R45

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
4d4dd3341f Add isBlocking/isNonBlockingApprovalRequired
These analyse the identity key record and user preferences to determine whether
a key requires approval for sending.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
22e907a8d4 Add getProfile to MessageSender
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
0c5a69cce4 Add support for getProfile to TextSecureServer
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
9f4a657e8a Add database migration
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
3afe378063 Remove legacy property from OutgoingMessage 2017-07-05 18:05:56 -07:00
lilia
d47ced1199 Don't recompute outgoing message padding
We can use the same padded plaintext across multiple numbers or attempts rather
than re-creating it every time we encrypt to a particular number.

// FREEBIE
2017-07-05 18:05:56 -07:00
lilia
30201969be Inline some functions in OutgoingMessage
Since we no longer have legacy messages to send, we can simplify things a bit
here.

// FREEBIE
2017-07-05 18:05:56 -07:00
lilia
e8548879db Stop sending legacy DataMessages 2017-06-20 17:57:27 -07:00
Scott Nonnenberg
3fbd1ab618 Use error.stack instead of error for console log
Chrome/V8 give you the error name, message and callstack at that
property, where toString() gives you [object NavigatorUserMediaError]

FREEBIE
2017-06-20 16:57:11 -07:00
Scott Nonnenberg
98f88607a0 Remove recorder UI when we fail to 'getUserMedia'
FREEBIE
2017-06-20 16:57:11 -07:00
Scott Nonnenberg
24174312b9 Fix: Show attachment views; they trigger update syncrhonously
FREEBIE
2017-06-16 10:52:57 -07:00
Scott Nonnenberg
2b5e56f6be Use setElement to ensure that re-parented views listen for events
FREEBIE
2017-06-15 16:28:15 -07:00
Scott Nonnenberg
40651f44ab
MessageView.appendAttachmentView: Remove from proper parent
FREEBIE
2017-06-08 19:59:22 -07:00
Scott Nonnenberg
f602ac462f A little cleanup in ConversationView.resetLastSeenIndicator
FREEBIE
2017-06-08 17:04:07 -07:00
Ikarulus
1021f835fe changes due to feedback 2017-06-07 15:53:14 -07:00
Ikarulus
068cf5092c fix typo 2017-06-07 15:53:14 -07:00
Ikarulus
ec3278ca3a add message length warning for android clients 2017-06-07 15:53:14 -07:00
Scott Nonnenberg
d269751dbc Conversation.markRead: Return a promise so queueJob works
FREEBIE
2017-06-07 15:46:21 -07:00
Scott Nonnenberg
785b117b86 Mark older messages as read when we get out-of-order read receipt
FREEBIE
2017-06-07 15:46:21 -07:00
Scott Nonnenberg
aeefc530d2 Conversation.markRead: Remove checks for unread
We will now always attempt to mark things unread if this method. If the
conversation's unreadCount gets out of date, set to zero, we will still
do it. If we go through the motions, and nothing is newly marked read,
we will still set the unreadCount to zero.
2017-06-07 15:46:21 -07:00
Scott Nonnenberg
6fbdd63e7e Conversation.onReadMessage - queue job, don't send read receipts
We queue the job because we often get a whole lot of read receipts at
once, and their markRead calls could very easily overlap given the async
pull from DB.

We also disable read receipts for any message marked read due to a read
receipt. That's a notification explosion we don't need.

FREEBIE
2017-06-07 15:46:21 -07:00
Scott Nonnenberg
89046484ed Read receipts: Also mark all messages read prior to this one
We mark as read everything older than this message - to clean up old
stuff still marked unread in the database. If the user generally doesn't
read in the desktop app, so the desktop app only gets read receipts, we
can very easily end up with messages never marked as read (our previous
early read receipt handling, read receipts never sent because app was
offline).

FREEBIE
2017-06-07 15:46:21 -07:00
Scott Nonnenberg
f38d8eb4ae Fix: Ensure that attachments are always rendered
Because we only attach AttachmentViews to the DOM when they fire their
'update' event, we were subject to a race condition. If that event fired
after the final Message.render(), then it would be properly attached to
the final DOM node. If it fired early, it would end up missing from
the visible DOM entirely, attached to the old, discarded version of
the message.

This change updates our handling of a second call to loadAttachments().
Instead of bailing out if we've been called before, we attempt to
re-add our child AttachmentViews to the current DOM. But only if the
'update' event has been fired, and if their current parent node is not
what is in the DOM.

FREEBIE
2017-06-07 15:28:30 -07:00
Scott Nonnenberg
da8d49b5ed ConversationView.markRead: Mark all messages read when at bottom
To handle the same 'not quite at the bottom' case that our 30px buffer
gives us for marking messages read, we use the same atBottom() method to
determine whether we should mark everything unread. Saves the effort and
potential missed messages (due to partial pixels, etc.).

FREEBIE
2017-06-07 15:27:27 -07:00
Scott Nonnenberg
6bfeb7ab14 Conversation.sendMessage: Don't set unreadCount to zero
This is no longer guaranteed to be true. If you're scrolled up in a
conversation, you may not have read all messages. Setting the
unreadCount to zero will prevent the user from marking any of their
existing messages as unread until something else happens, like receiving
a read receipt or new message.

FREEBIE
2017-06-07 15:27:27 -07:00
Scott Nonnenberg
bb483474a3 Fix: Show hourglass on incoming disappearing messages once read
FREEBIE
2017-06-06 15:33:55 -07:00
Scott Nonnenberg
9a09e7a16b TimerView: Update only as often as 500ms
FREEBIE
2017-06-06 15:33:55 -07:00
Scott Nonnenberg
5351b60365 TimerView: Remove some unused bits of code
- initialize doesn't need to call update because
  MessageView.renderExpiring() calls it immediately
- we don't need the className because that's already present on
  the el it attaches to, part of the MessageView's template.

FREEBIE
2017-06-06 15:33:55 -07:00
Scott Nonnenberg
fb7e7cf34c TimerView: don't continue to update after expiration
FREEBIE
2017-06-06 15:33:55 -07:00
Scott Nonnenberg
0c2c36c11a loadMoreMessages: Fix broken reference to this.view.outerHeight
:0/

FREEBIE
2017-06-02 12:08:06 -07:00
Ikarulus
ab5489baa0 fixed #1163, dark theme flaw 2017-06-01 16:45:17 -07:00
Scott Nonnenberg
ec22445f75 Bulletproofing of markRead and findNewestVisibleUnread
FREEBIE
2017-06-01 16:09:27 -07:00
Scott Nonnenberg
1775e97bcd Add comment and fine-tune last-seen indicator when not focused
FREEBIE
2017-06-01 16:09:27 -07:00
Scott Nonnenberg
672a517b73 Preserve lastSeenIndicator location when not focused
Also, a couple name changes of ConversationView methods to better
reflect what they do. update -> reset, since the method is destructive.

FREEBIE
2017-06-01 16:09:27 -07:00
Scott Nonnenberg
944ae296eb Prevent 'mark read on scroll' during fetches
FREEBIE
2017-06-01 16:09:27 -07:00
Scott Nonnenberg
b60b20bde4 Mark messages read only when visible, on receipt, focus, scroll
- Only mark messages read when scrolling if in focus and visible
- Remove last seen indicator when scrolling to the bottom with scroll
  down button
- Update last seen indicator when we don't already have one and we're
  scrolled up.

FREEBIE
2017-06-01 16:09:27 -07:00
Scott Nonnenberg
9a0a87ab40 Last seen indicator: dismissed only on open and send
It can be moved if you're not scrolled to the bottom of of the window
or the window doesn't have focus when a new message comes in. Other than
that, it marches up the window until you close and reopen the
conversation, or send a message.

Note that we do NOT mark messages as read if they come in when you are
scrolled up. But we do mark the entire conversation as read if you
switch away from the app and back.

FREEBIE
2017-06-01 16:09:27 -07:00
Scott Nonnenberg
eb1a4b3ac6 loadAttachments: Handle the zero -> some attachments case
FREEBIE
2017-06-01 15:38:26 -07:00
Scott Nonnenberg
0e1b534d3c Make MessageView.render() idempotent
Re-renders happen when we re-fetch messages from the database, and our
previous technique for loading attachments resulted in a new attachment
view added for every call to render()

This change ensures that a second call to render() does not add any more
attachment views.

FREEBIE
2017-06-01 15:38:26 -07:00
Scott Nonnenberg
25ebcc3131 Fix broken reference to i18n string 'mediaMessage'
FREEBIE
2017-06-01 15:38:26 -07:00
Scott Nonnenberg
0b6d5de753 Update the scroll position when 'fetch more messages' is complete
FREEBIE
2017-06-01 15:19:08 -07:00
lilia
3dbb21c53c Fix being re-added to a group you previously left
Negate the flag marking the group as left. Fixes #1207.

// FREEBIE
2017-05-30 10:51:07 -07:00
Scott Nonnenberg
13a91eece8 MessageListView.measureScrollPosition: reuse variables 2017-05-30 10:44:00 -07:00
Scott Nonnenberg
c5530b7235 Increase wiggle room to 30 px, which should ensure text cut off
FREEBIE
2017-05-30 10:44:00 -07:00
Scott Nonnenberg
84397a2ef4 20px at bottom of conversation considered 'at the bottom'
So users who are 'close enough' at the bottom of the conversation won't
get marooned in history.

FREEBIE
2017-05-30 10:44:00 -07:00
Scott Nonnenberg
09791ab7d9 Make last seen indicator more stable, with less forced removal
FREEBIE
2017-05-26 17:26:35 -07:00
Scott Nonnenberg
c3dc9732ef Fix: Don't scroll to last seen indicator on focus
FREEBIE
2017-05-26 17:26:35 -07:00
Scott Nonnenberg
10c2874d19 Fix race condition: Pull from database after add to conversation
Also add some console logs to help us determine whether this ever
happens to people in the wild.

FREEBIE
2017-05-26 16:02:14 -07:00
Scott Nonnenberg
9de384f3b8 Reset last seen indicator timing on focus of window
FREEBIE
2017-05-25 16:41:21 -07:00
Scott Nonnenberg
01918049b4 Keep last seen indicator around for five seconds
Helps calm the user experience a little more, makes it easier to
understand what's happening when messages are coming in quickly.

FREEBIE
2017-05-25 16:41:21 -07:00
Scott Nonnenberg
4e9e811d12 Last seen indicator: Keep scroll position when window loses focus
FREEBIE
2017-05-25 16:41:21 -07:00
Scott Nonnenberg
3beecce94e fetchConversation: Minimize scans across loaded messages
FREEBIE
2017-05-25 16:30:30 -07:00
Scott Nonnenberg
d5d1d58cc2 Exclude Backbone-sourced method from jscs checks
FREEBIE
2017-05-25 16:30:30 -07:00
Scott Nonnenberg
3ceb3a049e Override Message.fetch to ensure that db data overrides local
FREEBIE
2017-05-25 16:30:30 -07:00
Scott Nonnenberg
2c81539042 A guard to prevent infinite loops in fetching of conversation
FREEBIE
2017-05-25 16:30:30 -07:00
r-clancy
66b19d5cf7 Add support for opening the inbox via a shortcut - fixes #1134. 2017-05-24 10:51:38 -07:00
Scott Nonnenberg
fdf04f6229 Ensure that we never show last seen indicator if count is zero
FREEBIE
2017-05-23 15:41:05 -07:00
Scott Nonnenberg
e023c58883 Update last seen indicator even if window doesn't have focus
FREEBIE
2017-05-23 11:08:23 -07:00
lilia
72019eb79c Reuse a variable
FREEBIE
2017-05-23 11:08:23 -07:00
lilia
176339ffe6 Add log to see if we ever fetch while fetching
// FREEBIE
2017-05-23 11:08:23 -07:00
lilia
16f3717824 Move refresh prekeys out of SignalProtocolStore
Use an event/listener instead

// FREEBIE
2017-05-23 11:08:23 -07:00
lilia
017bb56cca Fix some corner casese with last seen indicator
* Remove increment behavior
* Dismiss when new messages arrive but the window is focused
* Update the indicator when window becomes focused.

// FREEBIE
2017-05-23 11:08:23 -07:00
Scott Nonnenberg
bb468e7b01 Wait for scroll before deciding whether to add scroll down button
FREEBIE
2017-05-23 11:08:23 -07:00
Scott Nonnenberg
30b7bf23db Recursively fetch messages until we've loaded all unread
FREEBIE
2017-05-23 11:08:23 -07:00
Scott Nonnenberg
8b4402e8a5 Only show scroll down button if we're not at bottom of convo
FREEBIE
2017-05-23 11:08:23 -07:00
Scott Nonnenberg
4c7bfbe9ff Scroll down button: when scrolled up, or new non-visible message
FREEBIE
2017-05-23 11:08:23 -07:00
Scott Nonnenberg
3cfac58d78 Eliminate all console errors during test run
FREEBIE
2017-05-23 11:08:23 -07:00
Scott Nonnenberg
3e01d78c89 MessageListView remove unused reset-scroll event
FREEBIE
2017-05-23 11:08:23 -07:00
Scott Nonnenberg
73f2a4a0fb Simplify MessageListView.resetScrollPosition: no translation math
FREEBIE
2017-05-23 11:08:23 -07:00
Scott Nonnenberg
bfdb8254a4 Scroll on new message only if we were already at bottom
FREEBIE
2017-05-23 11:08:23 -07:00
Scott Nonnenberg
fed26c36ca Add new Last Seen Indicator with unread count, scroll to it
This is to ensure that when there are a lot of unread messages, the user
is given the chance to see all of them by being scrolled to the oldest
new message.

When a new message comes in, the indicator will be incremented.

When the user sends a message or switches away from the conversation,
the last seen indicator will be removed.

FREEBIE
2017-05-23 11:08:23 -07:00
lilia
3f1d8ee2b8 Fix display name for ios voice messages
iOS populates a filename for voice messages which was overruling our check for
the voice message flag when choosing the display name.

// FREEBIE
2017-05-19 10:25:30 -07:00
lilia
89a7875747 Remove unused function
This was supposed to solve the problem of losing group state after a reinstall
by inspecting member registration ids and pre-emptively sending group updates to
those who appear newly re-registered, but it has been unused since 6123c419.

Nowadays there's a protocol for requesting lost group state from other members.

// FREEBIE
2017-05-16 15:37:05 -07:00
lilia
80bfe18f02 Mark groups left on synced "You left the group"
When leaving a group on mobile, we sync the group quit message to desktop, but
we weren't marking the conversation left.

// FREEBIE
2017-05-16 15:23:29 -07:00
lilia
4842ef6153 Sync end session messages
// FREEBIE
2017-05-16 12:14:07 -07:00
lilia
cfe0c77243 Conversation view blocks sending to left groups
Instead of attempting to send, which will throw an 'Unknown group' exception,
show a toast.

// FREEBIE
2017-05-16 12:10:29 -07:00
lilia
3ea5c0435b Update attachment style
Add names and sizes for all attachments except images, and (as with
arbitrary attachments), clicking on the text will open a save dialog.
In the absence of a filename, choose something that makes sense.

Display different icons for different media types, including distinct icons
for voice notes and audio files.

In iOS theme, audio, video, voice, and files are all encapsulated in bubbles.

Closes #804
Closes #842
Closes #836

// FREEBIE
2017-05-12 15:27:45 -07:00
lilia
6c53605dfd Flag voice note attachment protos as such
// FREEBIE
2017-05-12 09:55:15 -07:00
lilia
8bd7280673 Early read receipts should start expiration timers
Check for early read receipts for an incoming messages *after*
processing the expireTimer on that message. Then we can set
expirationStartTime appropriately if an early receipt is found.

Closes #950

// FREEBIE
2017-05-11 13:47:58 -07:00
Scott Nonnenberg
0496518af4 Bulletproof getCountOfAllMatches against non-global regex input
FREEBIE
2017-05-10 15:51:39 -07:00
Scott Nonnenberg
423a0fef67 Jumbomoji support matching Android support
FREEBIE
2017-05-10 15:51:39 -07:00
lilia
aed5735620 Improve keychange notice reliability/perf
Bind a single listener to keychange events from the storage interface,
which then looks up relevant conversations and adds notices to them,
with tests.

Previously we would need to instantiate a conversation model in order to
start listening to its key change events. In practice this usually
happens at startup but we shouldn't rely on it, and it incurs higher
overhead since it creates a different listener for each conversation.

// FREEBIE
2017-05-09 15:41:41 -07:00
lilia
787c393e1b Log key change advisory creation
// FREEBIE
2017-05-09 15:28:16 -07:00
lilia
8aa2f771a7 Remove self-listener in conversation model
Since there is the only source/listener on this event, it can be called
directly.

// FREEBIE
2017-05-09 15:28:16 -07:00
Scott Nonnenberg
ee00ad0e15 File attachments: show file size, bold filename, make icon bigger
FREEBIE
2017-05-09 15:14:20 -07:00
Scott Nonnenberg
2a04fa02df Introduce new filesize dependency
FREEBIE
2017-05-09 15:14:20 -07:00
lilia
a5a9118c5c Fix empty bubble on accepting a new key
// FREEBIE
2017-05-02 13:50:48 -07:00
r-clancy
499ca5537a Increase max GIF size to match Signal-Android.
Signal-Android had the max GIF size changed to 25MB in
WhisperSystems/Android@ad0f283

This change brings parity to the two projects and fixed #1116.
2017-05-01 11:00:10 -07:00
lilia
7a8f2f0fec Allow sending arbitrary files 2017-05-01 09:58:03 -07:00
lilia
40af226a4a Move Whisper.events out of views and tests 2017-04-21 13:21:18 -07:00
lilia
bab9580c3a Don't fallback to file view for images
Also lengthen the timeout a bit.

// FREEBIE
2017-04-19 18:17:14 -07:00
lilia
267f1f5d93 Use ISO format in log message 2017-04-19 13:58:20 -07:00
lilia
6b531ad342 Fix attachment size
This is already a number.

// FREEBIE
2017-04-18 18:09:21 -07:00
lilia
c98ec91cab Fix tests again 2017-04-18 16:51:56 -07:00
lilia
a2f0d6c739 Fix tests 2017-04-18 16:39:00 -07:00
lilia
c9b4ae6e80 Save 'video/quicktime' files as .mov
Sometimes .mov files arrive with content type video/quicktime, but must
be saved to .mov in order for osx to recognize them as videos and open
the appropriate default program, display thumbnails, etc...

// FREEBIE
2017-04-18 16:27:50 -07:00
lilia
a27ea20f3e Improve unsupported file type handling
Make arbitrary files look nicer and display the filename.

If an audio or video element fails to load for any reason, timeout after
a few seconds and render it as an arbitrary file. Also short circuit to
this treatment for common audio and video file types that we know are
going to fail, e.g., proprietary formats from apple.

// FREEBIE
2017-04-18 16:27:50 -07:00
lilia
27a1c9f18a Populate attachment file size
// FREEBIE
2017-04-18 12:08:37 -07:00
lilia
fc514aa96f Add support for attachment file names
Send, receive, and save attachment filenames. Use them as suggested
names when saving files.

// FREEBIE
2017-04-18 11:48:56 -07:00
lilia
a256f17e19 Cleanup attachment attributes
Convert attachment ids from longs to strings, and byte buffers to
arrays.

// FREEBIE
2017-04-18 11:48:53 -07:00
lilia
b68f438cee Use appendChild instead of append
`append` is only supported in Chrome > 54

Fixes #1127

// FREEBIE
2017-04-15 23:46:02 -07:00
lilia
dcfc4701c2 Tweak socket event logging 2017-04-13 13:15:42 -07:00
lilia
44a4ff3b52 Refactor install view
Let install view manage the connection to the provisioning socket as
well as cleaning up the window on completion, simplifying options.js.
Call `remove` so that the view stops listening when the window closes.
Move view script and template to background page.
Adds ability to hide nav if this isn't our first run.

// FREEBIE
2017-04-13 13:15:42 -07:00
lilia
df65585e71 Network status listens to some global events
Listen for reconnectTimer to display reconnection info. Listen for
unauthorized to update network status immediately after a failed login,
rather than waiting for the normal 5s interval to time out.

// FREEBIE
2017-04-12 20:43:16 -07:00
lilia
d3492960a6 Display info in network status when unlinked
When we can't connect due to being unlinked, network status indicator
will show an appropriate informational message and a button to open the
installer window to relink.

// FREEBIE
2017-04-12 20:43:16 -07:00
lilia
587e5265c5 Only re-render network status when it changes
// FREEBIE
2017-04-12 20:43:16 -07:00
lilia
3f05c8ff87 Rename window.events to Whisper events
// FREEBIE
2017-04-12 20:43:16 -07:00
lilia
fcff07df98 Remove some global refs to window.events
// FREEBIE
2017-04-12 20:43:16 -07:00
lilia
510a5cb7fe Namespace global listeners to Whisper 2017-04-12 20:43:16 -07:00
lilia
3c2b7c8cbd Log missing signed prekey ids
// FREEBIE
2017-04-12 13:02:31 -07:00
lilia
26d97e621b Update libsignal-protocol 2017-04-12 13:02:31 -07:00
lilia
cce1fe5c4b Simplify openConversation
Now that the InboxView is initialized in the background page context, we
can manipulate it more directly, without going through a global function
on the foreground window.

// FREEBIE
2017-04-10 12:45:58 -07:00
lilia
06e53871b2 Fix blank window after unlink
Don't wait for background init before rendering inbox.

If the client detects that it has become unlinked, it will not call
`init()`, never fire the deferredInit, and never render the inbox,
but we want to allow users access to their local messages even if they
have (perhaps temporarily) unlinked the desktop client.

Also, prefer not to extend Backbone.Model until/unless we really need
it.

// FREEBIE
2017-04-10 12:43:14 -07:00
Sam Vevang
ed4991974b set up a new view for displaying the network status
// FREEBIE
2017-04-08 00:10:56 -07:00
Sam Vevang
e4a21d1a53 move main application view over to messageReceiver namespace
The goal here is to allow synchronous property lookup between objects
and mvc/backbone semantics.

// FREEBIE
2017-04-08 00:10:56 -07:00
alecglassford
ef4b4da2a3 Make search clear button ("x") persist w/o hover
This makes the "x" in the search bar always visible when there is
text in the search box, even if the mouse is not hovering, hopefully
making for a clearer UI around search and resolving issue #741

The implementation adds the "x.svg" as a background image to the search
box when it is classed with .active, in addition to the
-webkit-search-cancel-button, which is still there for the actual
functionality but only appears on mouse hover (one tiny snag is that
coloring appears slightly different on hover, at least on my screen -
don't know if this is a problem).

I accounted for both ltr and rtl text-direction by using
getComputedStyle(...).direction to detect from the input's dir="auto"
- if there's a more elegant way to do this, please suggest. An ideal
solution would use the :dir pseudo-class but it's not implemented
in Chrome yet - https://developer.mozilla.org/en-US/docs/Web/CSS/:dir

For now, I added the direction-checking to inbox_view.js. I see that
input.search is also used in new_group_update_view.js and
recipient_input_view.js but neither of these views seem to be in use (?)
and they don't set the .active class anyway, so I ignored them.

Update: Amended version a few hours later - fixed and manually tested
color and spacing for iOS and Android Dark themes. Also made some new
SASS variables to make things DRYer and fixed my tab size.
2017-04-08 00:06:48 -07:00
lilia
a72c2968f2 Handle unknown request types
// FREEBIE
2017-04-07 19:35:25 -07:00
lilia
d1114edcd4 Update libsignal-protocol-javascript 1.1.10
// FREEBIE
2017-03-28 11:37:50 -07:00
lilia
611bbaef35 Don't hardcode the attachment server url
There may come a day when we may need to change this url from the server
side. On that day, clients should continue to operate normally. The
service should be able to change attachment server locations without
requiring a client update.

// FREEBIE
2017-03-10 15:24:19 -08:00
lilia
43de0cc2ec Add attachment digests
// FREEBIE
2017-03-10 14:40:45 -08:00
lilia
f1a1a819ba Stop parsing attachment ids from attachment urls
See 2111294

Attachment ids are now available in string form from the server
response to `putAttachment`.

// FREEBIE
2017-03-10 10:44:26 -08:00
lilia
4c945acb76 Remove unused object store reference
// FREEBIE
2017-03-04 17:57:32 -08:00
lilia
58d2f71e09 Add migration to clean up old expiring messages
Expiring messages received before 0.31.0 may not have an expires_at time
populated. Loading these messages once will update their expires_at if
it wasn't already set. To avoid loading too many messages into memory,
add them individually, and remove them from the collection as soon as
they are added, allowing them to be garbage collected immediately.

// FREEBIE
2017-03-01 18:05:36 -08:00
lilia
25ee61d3cb Fix timers after suspend/resume/pause
We use timers to decide when to query and delete expired messages or
when to perform signed key rotations.

Internally, timers are counters that get updated when the CPU ticks, so
if the CPU sleeps, the timer will stop counting, and start again after
it wakes up, ignoring the intervening passage of wall clock time.

To fix this, without having to query the database or other potentially
high overhead operations too often, use an interval to frequently check
the wall clock time. If time jumps forward, trigger a global event so
other listeners can update their possibly-inaccurate timers.

https://stackoverflow.com/questions/6346849/what-happens-to-settimeout-when-the-computer-goes-to-sleep
https://stackoverflow.com/questions/4079115/can-any-desktop-browsers-detect-when-the-computer-resumes-from-sleep

// FREEBIE
2017-03-01 14:36:40 -08:00
lilia
886557a2aa Drop chrome.runtime.onMessage events
We can use Backbone.Events instead.

// FREEBIE
2017-02-28 11:49:56 -08:00
lilia
bba25b22e2 Log session deletions 2017-02-28 11:29:26 -08:00
lilia
527e7878a8 Fix unresolved promise in removeSession
Previously if there was no session to remove, the promise returned from
removeSession would never resolve, potentially blocking sending for that
recipient until restart.

// FREEBIE
2017-02-28 11:29:26 -08:00
lilia
e4b9c51f88 Rework expiring messages management
// FREEBIE
2017-02-22 16:18:01 -08:00
lilia
08e8c00329 Restore setting lastMessage in handleDataMessage 2017-02-22 16:15:27 -08:00
lilia
0e31644c28 Remove spurious update to conversation on delivery receipts
Previously this would trigger the conversation to refresh it's last
message.

// FREEBIE
2017-02-22 15:41:12 -08:00
lilia
b7fac17ec8 Avoid querying groups on delivery receipts if possible 2017-02-22 15:41:12 -08:00
lilia
ace59147ab Reduce unnecessary updates on conversations at startup 2017-02-22 01:22:44 -08:00
lilia
280f7a74b1 Fix key change errors while retrying key change errors 2017-02-22 01:17:21 -08:00
lilia
e1662f8537 Drop unneeded binds
There are no references to `this` in these functions.

// FREEBIE
2017-02-22 01:17:21 -08:00
lilia
7cbaac5590 Provisioning socket events don't block AccountManager tasks
// FREEBIE
2017-02-22 01:17:21 -08:00
lilia
38a830c561 Fixup account manager task queue
Such that it still pumps tasks if one of them throws/rejects.

// FREEBIE
2017-02-22 01:17:20 -08:00
lilia
51131df23b Update libsignal-protocol-javascript 1.1.9
// FREEBIE
2017-02-22 01:17:20 -08:00
lilia
6509646bdb Set expireTimer to null to unset
// FREEBIE
2017-02-22 01:17:20 -08:00
lilia
0fac2e1d68 Log when we see a 0 registrationId
Most likely an indicator that the device we're dealing with is a 3rd
party client.

// FREEBIE
2017-02-20 19:03:08 -08:00
lilia
da9b6c5245 Add logging for install and update events
// FREEBIE
2017-02-17 12:50:26 -08:00