Commit graph

1113 commits

Author SHA1 Message Date
lilia
a137415b7a Fix standalone registration
// FREEBIE
2015-12-10 10:36:14 -08:00
lilia
77caa63321 Normalize views' template fetching pattern
Typically, a view can specify its templateName and then use the default
render method on Whisper.View, except in some special cases like message
view or message detail where other operations are performed during
render.

// FREEBIE
2015-12-09 18:58:52 -08:00
lilia
61a57a753b Provide user feedback when number is invalid
While typing a number, the new contact element is faded out. When the
number becomes valid it is opaque. If the element is clicked while
invalid, it displays 'Invalid number' and waits for the input to change
again. A new conversation is only opened if the number is valid.

// FREEBIE
2015-12-09 18:58:52 -08:00
lilia
01593363eb Add migration to update search tokens
Previous commit changed the token schema slightly so now we need to run
a migration to update existing conversations.

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
720032bb8e Remove id from search tokens
Instead, just strip the leading + from search queries that look like
numbers.

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
a258f1a66b Refactor number parsing and validation
Refactor libphonenumber.validateNumber into libphonenumber.parseNumber,
which encapsulates the try-catch pattern used in number parsing and
returns an object of info about the input number rather tha throwing
since we expect to get some invalid number inputs the user is typing.

In the conversation model,
  * Separate phone number validation from search token updating.
  * Perform token update before save if the number was valid.
  * Stop storing unneeded number variants as conversation properties.

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
7dd0fb70b5 Remove unused code
Here lies the remains of the old compose flow, which must eventually be
restored for group creation flow, but will likely be rewritten entirely.

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
65c13adf5e Fix searching for numbers with parens or dashes
Strip some punctuation from search queries

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
3d98b54027 Create contact from number with common punctuation
The 'Create new contact' option should now appear for numbers including
parens and other common punctuation.

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
ae52c047bf Clean up open-event logic with new convos and search results
Search view triggers an open event when a valid phone number is entered
and the 'Create new contact' card is clicked.

Inbox view should listen and respond to this event. It should also
disregard select events on the new contact element since those are fired
before phone number validation.

Finally, the search view can stop listening to select events because the
inbox view is already doing so.

// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
af64784d64 Let search match on full e164 format numbers
// FREEBIE
2015-12-09 18:58:51 -08:00
lilia
0b7742ecd7 Create contact by number with no country code or +
Search box finds or creates a conversation given a phone number in
local (to the user's region) or international format.

Previously you had to enter e164 format to set up the conversation
correctly.

If the number is not valid, do not open the conversation.

TODO: user feedback on invalid numbers.

// FREEBIE
2015-12-09 18:58:50 -08:00
lilia
0b95606eff Display nicely formatted phone numbers
In conversation headers and as titles for contacts with no name. Updated
tests accordingly.

// FREEBIE
2015-12-09 18:58:50 -08:00
OdysseasKr
f2d2e08fa2 Fix code styling 2015-12-09 18:57:50 -08:00
OdysseasKr
652d0963fc Add drag and drop support for text
By adding the drag and drop support for media files, the default
event handlers were overwritten. Thus drag and drop did not support
text. Now, the drag and drop listeners revert to the default behaviour
when the user does not drag a file.

Resolves: #478
2015-12-09 18:57:50 -08:00
lilia
9031b4c10c Update libaxolotl
Fixes #477

// FREEBIE
2015-12-08 10:51:52 -08:00
lilia
ea980b4385 Don't surface invalid attachment urls to the user
Log them, but don't put display them in user-facing error ui.

// FREEBIE
2015-12-07 16:52:45 -08:00
lilia
7b1268e5f7 Log incoming invalid attachment urls also
Same as previous commit but for incoming.

// FREEBIE
2015-12-07 16:43:59 -08:00
lilia
fe7505c050 Log invalid attachment urls
// FREEBIE
2015-12-07 16:07:10 -08:00
OdysseasKr
cbbb8dfa24 Add drag and drop for attachments
Files can be dragged and dropped on the bottom in order to be added as
attachments.

Resolves: #260
2015-12-07 15:32:14 -08:00
lilia
ae3a834b4c Log global errors
Use the global error handler, window.onerror, to catch miscellaneous
exceptions and pipe them into the debug log.

Fixes #456

// FREEBIE
2015-12-07 13:54:51 -08:00
lilia
c1aada4f0f Don't request background page from background page
This file is loaded by the background page, which means it is already
bound to the background page's global context. This was not true at some
time in the distant past but is true now.

// FREEBIE
2015-12-07 12:36:30 -08:00
lilia
85285a1094 Inline a one-line function only used in one place
// FREEBIE
2015-12-05 19:33:11 -08:00
lilia
9c59dfda93 Remove duplicate case statement
This line was never being hit due to the duplicate one above (#L166).
Peeking at the server code shows that 403 is only given in response to
registration attempts, where it does in fact indicate an invalid code.

// FREEBIE
2015-12-05 11:07:31 -08:00
lilia
68f2505996 Display phone number in conversation header
Fixes #436

// FREEBIE
2015-12-04 12:15:12 -08:00
lilia
0620f08a7c Save single errors returned from send functions
// FREEBIE
2015-12-04 12:02:19 -08:00
lilia
2f469835d9 Handle group quit sync messages
Previously, we would incorrectly reject group updates originating from a
linked device instructing us to remove ourselves from the group.

// FREEBIE
2015-12-04 11:25:19 -08:00
lilia
edcb28aebb Don't save a MessageCounterError
Fixes #446

// FREEBIE
2015-12-04 11:20:12 -08:00
lilia
999e084727 Serialize notification updates
// FREEBIE
2015-12-01 13:53:59 -08:00
lilia
d0b1aa3829 Silently remove read messages from existing notifications
Previous commit removed notification models from the global collection
but did not actually update the existing notification.

This commit refactors the notification interface to allow us to update
it without re-surfacing the notifcation onscreen.

// FREEBIE
2015-12-01 13:53:59 -08:00
Georg Semmler
1a6cedac56 Fix #402
Remove messages which are read from the notification
2015-12-01 13:31:02 -08:00
lilia
b00d5289cf Save message timestamp for resending
Fix bug where resending due to failed network connection would fail
silently.

Broken in 7b6820 refactor which changed arguments to transmitMessage

// FREEBIE
2015-11-29 18:02:37 -08:00
lilia
db773dd8a7 Fix selected state transition on firstRun
// FREEBIE
2015-11-28 15:50:44 -08:00
lilia
8d214b73d9 Render conversation placeholder hint in place
// FREEBIE
2015-11-28 14:42:25 -08:00
lilia
891a5e54ad Add hint for users with no groups or contacts
If you have no contacts or groups, display a hint about phone numbers.

// FREEBIE
2015-11-27 22:26:56 -08:00
lilia
e9949152bb Always return a promise from sendSyncMessage
// FREEBIE
2015-11-27 22:26:56 -08:00
lilia
acae4afce3 Handle invalid responses better
Depending on the response code, returning an HTTPError here will let us
retry later, if appropriate.

// FREEBIE
2015-11-27 22:26:56 -08:00
lilia
7bf94c33d5 Show all contacts when inbox is empty 2015-11-27 22:26:55 -08:00
lilia
152f59cc95 Restyle first run hint
// FREEBIE
2015-11-27 22:26:55 -08:00
lilia
52b039a900 Remove unused function
This is now used only internally in libaxolotl, which provides its own
definition.

// FREEBIE
2015-11-27 14:40:20 -08:00
lilia
6445581594 Update libaxolotl
isEqual added to internal helper module

// FREEBIE
2015-11-27 14:40:19 -08:00
lilia
63cd3b2788 Use constant time mac comparison
In libtextsecure and in libaxolotl.

// FREEBIE
2015-11-27 14:40:17 -08:00
lilia
d4e0c11ebc Show a hint on startup if the inbox is empty
Fixes #403

// FREEBIE
2015-11-27 11:36:46 -08:00
lilia
61439a886f Validate json responses
Perform lightweight validation on json responses from the server. Ensure
that the attributes we depend on have the right type.

// FREEBIE
2015-11-25 12:16:36 -08:00
lilia
b0d4370c2c Remove unused variable
// FREEBIE
2015-11-25 11:42:16 -08:00
lilia
ea87062d92 Post debug logs as non public gists
// FREEBIE
2015-11-25 10:28:30 -08:00
lilia
07702c4ee5 Let the application layer send sync messages
Previously, libtextsecure would send a sync message automatically
when appropriate. This fails if any recipient has a key conflict
or if our network connection fails mid-send.

Instead, when appropriate, return a the DataMessage encoded as an array
buffer for later syncing. This lets the application choose when to send
it, which we now do after any successful send to a recipient, rather
than after all recipients are successfully sent to.

Eventually we should move the DataMessage protobuf construction and
group sending logic to the application layer entirely, in which case
we wouldn't need libtextsecure to construct the sync message either.

Fixes #408
2015-11-24 17:11:03 -08:00
lilia
5c37c3d6ce Change return type from sending messages
Pass the whole result from the outgoing message callback on to the
caller, and preserve the names of the members.

// FREEBIE
2015-11-24 17:05:25 -08:00
lilia
7b6820d2ac Refactor messageSender/OutgoingMessage
Move encrypt and transmit to OutgoingMessage
Restore per-number queueing to messageSender

// FREEBIE
2015-11-24 17:05:24 -08:00
lilia
adf8445b85 Populate registrationIds on deviceObjects
Saves us from doing so later.

// FREEBIE
2015-11-24 17:05:23 -08:00