Commit graph

161 commits

Author SHA1 Message Date
lilia
f2bdafc7e9 Validate/reformat phone numbers in contact syncs
Turns out there's no garauntee that Android will send us contact info
with phone numbers in e164 format. When that happens, we fail to update
the correct contact. Fix by performing validation on the incoming number
before attempting to merge changes to the name, avatar, or color.

Fixes #903
2017-01-25 20:40:24 -08:00
lilia
1f0a93bf70 Ensure new installs default to non-blocking
// FREEBIE
2016-10-05 19:10:20 +09:00
lilia
02ea4f2475 Use read receipt envelope to infer startExpirationTime
Avoids display of phantom messages that are only received and marked
read locally long after they have expired on another linked device.
2016-09-28 17:20:02 -07:00
lilia
96fd017890 Support for incoming expiring messages
When initialized, or when expiration-related attributes change, expiring
messages will set timers to self-destruct. On self-destruct they trigger
'expired' events so that frontend listeners can clean up any collections
and views referencing them.

At startup, load all messages pending expiration so they can start their
timers even if they haven't been loaded in the frontend yet.

Todo: Remove expired conversation snippets from the left pane.
2016-09-28 17:20:02 -07:00
lilia
7b3b01bdf6 Refactor registration event
Make AccountManager into an event target for better separation between
app and service-library handling of registration events.
2016-09-20 13:42:33 -07:00
lilia
6dcff46e26 Move chrome-specific calls to chromium.js
// FREEBIE
2016-09-20 13:37:50 -07:00
lilia
b1afb79a14 Set theme based on master device userAgent
// FREEBIE
2016-09-15 16:28:46 -07:00
lilia
9db13310b4 Add port 80
// FREEBIE
2016-09-08 15:00:05 -07:00
lilia
0487fa3cd1 Add server fallback port 8443
// FREEBIE
2016-09-08 14:31:19 -07:00
lilia
53f20640af Add support for syncing colors
// FREEBIE
2016-09-07 13:04:45 -07:00
lilia
e5b54d9b6a Bubble up InvalidStateErrors and log them
These may be indicative of a potentially fatal lack of disk space.

// FREEBIE
2016-08-11 12:22:32 -07:00
lilia
186c597e24 Use port 4433 on staging
Now with over 9000% more CA-signed cert!

// FREEBIE
2016-07-28 18:39:55 -07:00
lilia
8e1d884a10 Add button for re-importing contacts from phone
Add a section under settings for performing a contact sync from your
mobile device. This just re-runs the same import operation that occurs
at install/link time.

// FREEBIE
2016-06-16 16:43:07 -07:00
lilia
ffa702c934 Update libsignal-protocol v0.9.0
* Exposes crypto APIs.
* Move worker methods to libsigna.worker.
* Move ProvisioningCipher to libtextsecure.
2016-05-17 12:03:37 -07:00
lilia
cd2218ada7 Move hard-coded worker url out of libtextsecure
// FREEBIE
2016-05-15 17:04:13 -07:00
lilia
0cd7f84a05 Refactor read state tracking
Adds support for handling early arriving read receipts.

// FREEBIE
2016-04-14 11:57:52 -07:00
lilia
d1e9534542 Refactor delivery receipt tracking
Move code for matching receipts to messages (and vice versa) to its own
file.

// FREEBIE
2016-04-13 13:57:56 -07:00
lilia
a5ec2321fd Use helper function
// FREEBIE
2016-04-09 00:16:44 -07:00
lilia
2f90645142 Break up long line
// FREEBIE
2016-04-09 00:16:21 -07:00
lilia
0f4f00ff4e Fix read sync on duplicate messages
In the case of a double send (same message encrypted and sent twice due
to key conflict bug), we would mark the first instance read twice rather
than marking both instances read. Fix by searching for matching messages
that have not yet been marked read.

// FREEBIE
2016-04-04 16:14:15 -07:00
lilia
9aa429e18a Add frontend support for expiring releases
When a release expires, it gets a persistent banner notification to
upgrade, and an ephemeral toast warning when trying to send a message.

// FREEBIE
2016-04-03 21:11:50 -07:00
lilia
8fe00f79b2 Fix sorting on incoming key conflicts
// FREEBIE
2016-03-25 14:32:58 -07:00
lilia
d39a19d889 Fix crash on read receipt event if no listeners
// FREEBIE
2016-03-18 17:06:38 -07:00
lilia
760bfffb50 Show all contacts all the time
Contacts without conversation identity appear in alphabetical order at
the end of the inbox.

// FREEBIE
2016-03-18 11:21:11 -07:00
lilia
7fb4d3d8aa Load all inbox convos before rendering
This is a better alternative to the fix in 0434c4b, which causes
problems when creating a new conversation from entering a phone number.

// FREEBIE
2016-03-17 20:58:56 -07:00
lilia
c4a88dd651 Fix getUnread query
Booleans are not valid keys in indexeddb.
https://www.w3.org/TR/IndexedDB/#dfn-valid-key

// FREEBIE
2016-02-26 12:25:56 -08:00
lilia
1f897f32b7 Track and sync unread messages
// FREEBIE
2016-02-22 17:11:17 -08:00
lilia
781ada64ca Add libtextsecure support for syncing read messages
Plumbing for sending and receiving a new sync protobuf for marking
messages read on/from my other devices.

// FREEBIE
2016-02-22 17:11:17 -08:00
lilia
010297f4c5 Track groups I've left
// FREEBIE
2016-02-22 17:11:16 -08:00
lilia
496ac30d6f Process delivery receipts from yourself
Fixes #668

// FREEBIE
2016-02-16 17:51:42 -08:00
lilia
cd7bc78b1d Refactor delivery receipt processing
Replace the where, forEach, and found pattern with a find.

// FREEBIE
2016-02-16 17:51:42 -08:00
lilia
b8602a3b42 Make migrations more robust
Occasionally these will fail if they happen to be executed before the
necessary dependencies (storage, ConversationCollection) are declared.

// FREEBIE
2016-02-12 17:18:37 -08:00
lilia
87ddcef333 Make debug log persistent
Save log entries in indexedDB rather than just in memory. Reload them
whenever the background page is refreshed.

// FREEBIE
2016-02-03 13:30:55 -08:00
lilia
925c1bdb33 Add SyncRequest class
Similar in function to an xhr request, a textsecure.SyncRequest object
is initialized from a message sender and receiver pair and initiates a
request for sync from the master device. It later fires a success event
when both contacts and groups are done syncing, or a timeout event after
one minute.

// FREEBIE
2016-01-14 15:44:42 -08:00
lilia
5223e6ed30 Stop ask to re-link forever
Clear the registration flag when we detect that our credentials have
been invalidated, but retain the knowledge that we've been registered
before, so as to preserve post-first-install behaviors like skipping the
introductory install screens, and accessing the main ui.

Fix #541

// FREEBIE
2016-01-11 16:40:57 -08:00
lilia
d95f869d62 More logging
// FREEBIE
2015-12-17 16:42:54 -08:00
lilia
51fc10abb6 Don't wake up to check messages if not registered
This chrome alarm business is in place to help us wake up and check for
messages when running in the background. Without it, chrome will suspend
our app after a short period of inactivity. Upon waking, if the app
discovers it is not linked, it prompts you to link it. However, if
you've declined registration (i.e., because you already maxed out your
linked device limit, but chrome auto-added the app to another machine),
we should just wait until explicitly launched again.

Fixes #519

// FREEBIE
2015-12-17 16:36:14 -08:00
lilia
63135a2337 Fix race between sync messages and receipts
Previously, when processing a backlog of sync messages and their
delivery receipts, we would fail to mark some messages as delivered even
though we got a receipt. This was due to an async race condition between
saving a sync message and fetching it after the receipt arrives.

Fix by re-ordering idb requests such that we save the message first and
fetch it after.

Fixes #479

// FREEBIE
2015-12-10 10:36:15 -08:00
lilia
077cba284f Ignore delivery receipts from myself
// FREEBIE
2015-12-10 10:36:15 -08:00
lilia
edcb28aebb Don't save a MessageCounterError
Fixes #446

// FREEBIE
2015-12-04 11:20:12 -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
lilia
4cc6b1ff9a Validate attachment urls
// FREEBIE
2015-11-24 16:20:07 -08:00
ody
156c7c3b3d Add unread count in window title
The window title now shows the global number of unread messages as
"Signal (1)". This way the user can see the number of unread messages
in the task bar and when alt-tabbing.

Resolves: #384
2015-11-19 10:40:07 -08:00
ody
8c59862e3d Fix global unread message counting
Fixed the global counting of unread messages. This makes the "unreadCount"
variable in storage to stay in sync with the sum of unread messages in each
conversation. To achieve this, the controller_view updates the global
variable whenever messages are received or read.
2015-11-19 10:40:02 -08:00
lilia
a569e34b33 Refactor new message notification and frontend updates
Create a cleaner seperation between generating notifications
and updating frontend conversation views. The former is now
handled by `conversation.notify` while the latter is achieved
by triggering an event on the conversation model, which will
only be acted on if there are any views listening for it.

Additionally, instead of re-fetching the entire message history,
which is overkill, just add or update the new/modified message.
This will help speed up the newmessage event handler and also
help avoid unnecessary re-rendering when resolving key conflicts.

// FREEBIE
2015-11-07 14:11:13 -08:00
lilia
a32780d174 Mark delivered messages as sent
In rare cases, a race between delivery receipts and outgoing message
requests can cause the sent flag to be reversed. Fix by marking messages
sent at the same time they are marked delivered.

// FREEBIE
2015-10-20 18:57:24 -07:00
lilia
d3812869d2 Don't throw errors from background
// FREEBIE
2015-10-02 12:14:10 -07:00
lilia
e626355e0c Let background page instantiate AccountManagers
Remove the need to expose the server url config as a global.

// FREEBIE
2015-10-01 18:33:49 -07:00
lilia
9e9d767a30 Add MessageSender
textsecure.MessageSender takes server url and credentials and returns
a message sending interface configured for that server.

Used a wrapper function to insert a TextSecureServer instance into
sendmessage.js code at runtime. This will result in function duplication
between different MessageSender objects, pending further refactoring to
use prototypal inheritence.

// FREEBIE
2015-10-01 18:33:48 -07:00
lilia
98aa5156b0 Refactor TextSecureServer for storage
Following the pattern from previous commit, let the server class accept
a url and login credentials from the caller. Then integrate into
MessageReceiver and AccountManager.

// FREEBIE
2015-10-01 18:33:48 -07:00