Commit graph

785 commits

Author SHA1 Message Date
lilia
3d1df790a5 Update the window title when a group title or contact name changes 2015-06-03 17:23:55 -07:00
lilia
d26c13b155 Add openInbox link to conversation menu. Fixes #246 2015-06-02 14:57:22 -07:00
lilia
9d688cb761 List views persist sroll offset by percentage
Fixes #188
2015-05-28 11:50:58 -07:00
lilia
590deef063 Decrease auto-scaling size
For better consistency with Android, autoscale images such that the
largest dimension is 1280. Related: #242
2015-05-27 16:53:04 -07:00
lilia
a66c879426 Update inbox after destroying a conversation
Fixes #247

// FREEBIE
2015-05-27 14:49:50 -07:00
lilia
3e73282a64 Fix key verification screen 2015-05-26 17:08:14 -07:00
lilia
e2eff893d4 Fix 'Delete messages'
Replaces window.confirm with generic promise-based confirmation dialog
functionality available to all views.

// FREEBIE
2015-05-26 16:56:05 -07:00
lilia
8a17953468 Display sent_at timestamps instead of received_at 2015-05-26 13:31:17 -07:00
lilia
3e39271220 Render messages light blue until finished sending // Fixes #219 2015-05-26 13:30:51 -07:00
lilia
405e67c758 Merge inbox and panel controllers
These collections should always be operating with the same model
instances, so let the inbox reset it self from the same in-memory
cache of conversation models used by the conversation windows.
2015-05-26 13:28:43 -07:00
lilia
53a9ab4834 Fix bugs with handling large image attachments
* Avoid infinite loop scaling too-big images
* Don't crash if no file is selected
* Fix file size toast

Fixes #242

// FREEBIE
2015-05-25 10:43:35 -07:00
lilia
585c82aee8 Fix the build 2015-05-24 16:29:11 -07:00
lilia
3eafefe18e Don't display notifications for open windows.
Just update and draw attention to them.

Fixes #238

// FREEBIE
2015-05-24 16:20:55 -07:00
lilia
d8f17f9631 Fixes #240
Delete files attached via chrome.fileSystem

// FREEBIE
2015-05-24 16:03:13 -07:00
lilia
9882190bde Wake up once a minute to check for messages
If all the application windows are closed (and not merely hidden), the
background page will go inactive and there's nothing we can do to stop
it. However, we can ask chrome to trigger an alarm once per minute,
which will spin up the background page and check for new messages.

This will effectively keep us alive as long as chrome has open windows
or is running in the background, subject to chrome settings'
Advanced -> System -> Continue running background apps
2015-05-22 17:26:56 -07:00
lilia
fa3e1ee94f Window ids should be strings
A warning is issued when a non-string window id was passed to
extension.windows.focus.
2015-05-22 17:23:18 -07:00
lilia
7bf1d41184 Render conversation titles 2015-05-22 16:54:59 -07:00
lilia
bc4d31cf72 Fix for inbox sometimes not reappearing
Apparently focusing an app window does not implicitly unhide it.

// FREEBIE
2015-05-22 12:36:14 -07:00
lilia
d0a529351c Fix sending messages with no attachments 2015-05-21 19:01:37 -07:00
lilia
a5e80e8a5a Really close conversation windows
Only the inbox should hide when closed.
2015-05-21 18:20:19 -07:00
lilia
5d3a2a4cc8 Fix file inputs
As a chrome app we are obligated to use the fileSystem api, and must do
so via the window in which we want to open the dialog.
2015-05-21 18:19:10 -07:00
lilia
39d11d8eb3 Apply custom chrome to conversation windows 2015-05-21 14:35:44 -07:00
lilia
95f8e3921c Keep inbox window open, but allow it to be hidden
As a chrome packaged app, we have to keep at least one window open in
order to maintain our websocket connection in the background page.

This change replaces the system window frame with custom buttons in the
inbox header, such that the 'close' button merely hides the window
rather than unloading it.

Fixes #237
FREEBIE
2015-05-21 13:08:43 -07:00
lilia
b83ce7a015 Delay conversation creation til post-decrypt 2015-05-20 17:22:03 -07:00
lilia
12eb553a3f Draw attention to windows on new messages 2015-05-20 17:22:03 -07:00
lilia
0b31823989 Wait for storage on launch 2015-05-20 14:24:44 -07:00
lilia
08878b3dc8 Update inbox after sending a message
Also change the event name to reflect how its being used, and stop
passing the message object around since it is not being used.

// FREEBIE
2015-05-20 13:04:16 -07:00
lilia
e9d7864f75 Set conversation type when creating from sync message
When a conversation is created as the result of a sync message, and it
is not a group, we need to set its type to private.

// FREEBIE
2015-05-20 12:58:48 -07:00
lilia
7e8b1319a5 Ignore sync contexts on messages not from ourselves
But process the rest of the message normally.
2015-05-20 12:42:13 -07:00
lilia
fdd2eb0d3e Make conversation windows taller 2015-05-20 11:49:53 -07:00
lilia
1b83932a29 Update open conversations on sync messages 2015-05-19 13:34:51 -07:00
lilia
090cc84452 Do not include destination on group sync messages 2015-05-18 14:40:27 -07:00
lilia
1ed0ef5bc3 Process group updates before sync delivery receipts
Because we need to know the group members to find early-arrival
receipts.
2015-05-18 14:23:09 -07:00
lilia
654373d743 Fix null conversationId on group sync messages 2015-05-18 14:08:19 -07:00
lilia
65a6068003 Fix for out-of-order message/receipt arrival
In a multi device world, it's possible to receive a receipt for a sync
message before the sync message actually arrives. In this case we need
to keep the receipt around and the process it when the message shows up.
2015-05-18 13:48:48 -07:00
lilia
c4fa2cb935 Fix sync message timestamps 2015-05-18 12:48:52 -07:00
lilia
d1bcafad65 Update libaxolotl 2015-05-15 16:30:22 -07:00
lilia
16e9f03d8f Check for registration when launched 2015-05-15 14:02:26 -07:00
lilia
f6a326577d Crash fixes for chromium
My current version of chromium inexplicably exposes a crippled version
of chrome.browserAction even though we are now a packaged app and should
not have that functionality exposed to us anymore. This results in some
errors to the tune of "property 'foo' of undefined".

It also doesn't support the innerBounds property for window creation,
only the older (deprecated) bounds property.
2015-05-15 12:54:31 -07:00
lilia
029c9754f0 Fix tests 2015-05-15 11:39:23 -07:00
lilia
5a7ab54ee6 Fix registration page
Also make it accessible by providing a mode argument to the install
function. Previously developers could just edit the url but we no longer
have the address bar as an app window, so now they must close the
default installer and run the following from the background page
console: `extension.install('standalone')`.

In the production build, this should result in an error since it is not
supported / the register page is not included there.
2015-05-15 11:39:23 -07:00
lilia
7afd0a02e8 Convert beforeunload listeners 2015-05-15 11:39:23 -07:00
lilia
002ff45312 Adapt window management to chrome app window api
Appify tabs, windows, browserAction

Port the extension.windows.focus function to new window api and
generalize its error handling in the case where the requested window
does not exist. An error will be passed to the callback.

Port extension.browserAction and rename it to the more generic
extension.onLaunched.

Use of the id option when opening a window ensures that attempting to
open a duplicate window merely focuses the existing window.

Finally, after registration, close the options window and open the
inbox.

Port extension.remove
2015-05-15 11:39:22 -07:00
lilia
ddbaf87741 Load notifications script from background page 2015-05-15 11:39:22 -07:00
lilia
f90f6328dd Don't resolve the background page til storage is ready 2015-05-15 11:39:22 -07:00
lilia
704c6ce779 Signaling key is now an array buffer 2015-05-15 11:39:22 -07:00
lilia
3f37cd21a9 Remove remaining traces of localStorage
Add window.storage to the background page, which loads all data from the
'items' store in indexeddb, caching them in memory for synchronous
access, then override textsecure storage to use that in memory store.
2015-05-15 11:39:19 -07:00
lilia
a3c5b0959f Port textsecure.storage.impl to indexeddb 2015-05-15 11:38:15 -07:00
lilia
d230df5622 Move local identitykey and registrationid to indexeddb 2015-05-15 11:38:14 -07:00
lilia
fe1d78b5fa Load protobufs asynchronously. Fixes #223 2015-05-15 11:38:14 -07:00
lilia
b8c5bc293c App windows cannot be refreshed 2015-05-15 11:38:10 -07:00
lilia
76e170686a Make getBackground async 2015-05-12 15:39:15 -07:00
lilia
7799bef86c Tweak key conflict error messages
Be generic, because sometimes it's not TextSecure, but Signal.
2015-05-07 17:43:30 -07:00
lilia
915612114b Remove general get/put/remove methods from AxolotlStore 2015-05-06 18:14:32 -07:00
lilia
d0e262d7cb AxolotlStore stores groups in indexeddb 2015-05-06 17:49:31 -07:00
lilia
359b4a15a2 Move group storage to axolotl store
Add async get/put/removeGroup to axolotl store and let libtextsecure
use it for group state storage.
2015-05-06 17:49:23 -07:00
lilia
748f32022a Fix up refreshGroup 2015-05-06 13:49:20 -07:00
lilia
f774047935 Make libtextsecure group storage asynchronous 2015-05-06 13:11:12 -07:00
lilia
c26c6fc317 Store sessions by encodedNumber
Storing multiple sessions in a single indexeddb record is prone to
clobbering data due to races between requests to update multiple device
sessions for the same number, since you have to read the current state
of the device->session map and update it. Splitting the records up makes
it so that those updates can be made in parallel. Selecting all the
sessions for a given number can still be done efficiently thanks to
indexeddb range queries.
2015-05-05 17:44:59 -07:00
lilia
37c496f4f0 Close the provisioning socket 2015-05-05 17:44:59 -07:00
lilia
43d6efcd9e Don't save device objects to disk
Generate them from session and identity data. Save/delete pending prekey
data in an in-memory store and attach it to outgoing device objects.
2015-05-05 17:44:59 -07:00
lilia
f18795a253 Add removeSession 2015-05-05 17:44:58 -07:00
lilia
f413f03a6b Add getDeviceIds to axolotlstore
And add tests for getDeviceIds and removeAllSessions
2015-05-05 17:44:58 -07:00
lilia
121671c99f Store identity keys in indexeddb
Let device storage request them from axolotl store rather than storing a
copy.
2015-05-05 17:44:58 -07:00
lilia
7eda48f755 Move Session Storage to indexedDB 2015-05-05 17:44:58 -07:00
lilia
20ebc3f890 Move identity key storage functions to axolotl store 2015-05-05 17:44:58 -07:00
lilia
f38b18ef63 Move Session storage to axolotlstore 2015-05-05 17:44:57 -07:00
lilia
9de1572ba6 Convert all storage.devices methods to be asynchronous 2015-05-05 17:44:57 -07:00
lilia
71715c95bc Async remove identity 2015-05-05 17:44:57 -07:00
lilia
26f1aa4db5 Async putSessionsForDevice 2015-05-05 17:44:57 -07:00
lilia
666f6baaca Async getSessionsForNumber 2015-05-05 17:44:56 -07:00
lilia
9e7d8c0a08 Rename textsecure.api and make it internal-only 2015-05-05 17:44:56 -07:00
lilia
45a61780af Fixup refreshPreKeys and call it whenever a prekey is deleted 2015-05-05 17:44:56 -07:00
lilia
7d0aeac8cb Use a worker to facilitate key generation 2015-05-05 17:44:55 -07:00
lilia
f465bdddbf Add textsecure.AccountManager
This class should be used for account registration and for refreshing
prekeys for your account.
2015-05-05 17:44:55 -07:00
lilia
a960acacc6 Add textsecure.refreshKeys
This helper checks the server for the number of remaining prekeys, then
generates more if there are fewer than 10 remaining.

// FREEBIE
2015-05-05 17:44:55 -07:00
lilia
96eafc7750 Integrate libaxolotl async storage changes
* Session records are now opaque strings, so treat them that way:
  - no more cross checking identity key and session records
  - Move hasOpenSession to axolotl wrapper
  - Remote registration ids must be fetched async'ly via protocol wrapper
* Implement async AxolotlStore using textsecure.storage
* Add some db stores and move prekeys and signed keys to indexeddb
* Add storage tests
* Rename identityKey storage key from libaxolotl25519KeyidentityKey to
  simply identityKey, since it's no longer hardcoded in libaxolotl
* Rework registration and key-generation, keeping logic in libtextsecure
  and rendering in options.js.
* Remove key_worker since workers are handled at the libaxolotl level
  now
2015-05-05 17:44:55 -07:00
lilia
8304aa903a Update libaxololt to a087b9e746e67995f16e077183cc0 2015-05-05 17:44:54 -07:00
lilia
2ff954d2f8 Fix api.js 2015-05-04 15:14:58 -07:00
lilia
cc6a44f35d Fix tests 2015-05-01 12:13:03 -07:00
lilia
da34b8e0f8 Rename textsecure.websocket and make it internal-only 2015-04-30 15:07:35 -07:00
lilia
89c24cd2fa Move throwHumanError to api.js
It is only used there.
2015-04-30 12:26:13 -07:00
lilia
36b1e87214 Add textsecure.MessageReceiver
Encapsulate the websocket resources and socket setup process in a
friendly OO class. The MessageReceiver constructor expects an instance
of EventTarget on which to fire message events asynchronously. The
provider of the EventTarget can then add/remove listeners as desired.
2015-04-29 16:50:20 -07:00
lilia
bf2bf4cfd9 Remove redirect to index from registration.done() 2015-04-29 13:39:41 -07:00
lilia
6f3de68834 Move browserAction call 2015-04-29 12:22:12 -07:00
lilia
37e09da1cc Remove unsued argument from getDeviceObject
Last usage of the `returnIdentityKey` argument was removed in 8b9a16852.
2015-04-20 17:20:58 -07:00
lilia
bdecf5cc44 Generate key_worker.js
Instead of calling importScripts, which is prone to relative path
issues, generate the worker script with everything it needs included.
2015-04-15 15:38:57 -07:00
lilia
7af42a27c5 Fix registerKeys using array indices for key ids
preKeys is an array whose indices may or may not be keyId-based. Since
we have an inline keyId property, use that instead.
2015-04-15 15:23:08 -07:00
lilia
00989962d8 Rename worker script file 2015-04-15 14:42:01 -07:00
lilia
de65f9e6bd Add missing resolve 2015-04-15 12:24:29 -07:00
Patrick Connolly
b5d724ffc3 Replaced frontend getString calls broken in d3c158f.
Closes #224
2015-04-15 11:56:36 -07:00
lilia
90c742d57c More error logging 2015-04-09 14:45:46 -07:00
lilia
25224da12e Fix unsafe eval warning on registration page 2015-04-05 16:42:08 -07:00
lilia
23feeecbcf Wrap libts, don't leak into global namespace 2015-04-05 16:42:08 -07:00
lilia
c51773ab0e More helpful error logging 2015-04-05 16:42:07 -07:00
lilia
319332bb6f Add missing semicolon
:[
2015-03-29 16:37:26 -07:00
lilia
5d4298697c Use view.$ shorthand for scoped jquery searches
Wish I'd noticed that one earlier. http://backbonejs.org/#View-dollar
2015-03-29 16:29:05 -07:00
lilia
13ce354ab8 Registration UX improvements
Add some nice modal dialogs instead of confirmation alerts.
2015-03-26 15:20:17 -07:00
lilia
6d9c7182c4 Let the key worker close itself when done 2015-03-26 15:18:57 -07:00
lilia
d3dbf2328f Set unread count badge when background page is refreshed
Refreshing the background page unsets the badge.
2015-03-26 10:50:25 -07:00
lilia
bfe23d86aa Run key generation in a worker
Ground work for a smoother registration flow. Overall UX still needs
some polish but at least now we can have a progress gif or animation or
whatever. Also adds the phonenumber-confirmation step as a simple alert
box, which will be replaced with a nice dialogue in a later commit.
2015-03-26 10:49:52 -07:00
lilia
196aa28873 Fix NaN badge
lolNaNcat
2015-03-25 13:09:15 -07:00
Matt Corallo
8b9a168524 Store session information separately 2015-03-25 11:56:28 -07:00
Matt Corallo
e33c6fddda Do not rely on deviceObject.sessions anywhere in sendmessage 2015-03-25 11:56:27 -07:00
Matt Corallo
6c0f3ff1f0 Move session-storage logic to storage/devices from axolotl_wrapper 2015-03-25 11:56:27 -07:00
Matt Corallo
169097a409 Remove stale comments in axolotl_wrapper 2015-03-25 11:56:26 -07:00
Matt Corallo
89fefe4323 Create a textsecure.storage.impl to be overriden if desired 2015-03-25 11:56:26 -07:00
Matt Corallo
56bffdcfd3 Prefix libaxolotl-stored objects with "libaxolotl" 2015-03-25 11:56:26 -07:00
Matt Corallo
00cb420d37 Merge (un)encrypted storage layers 2015-03-25 11:56:25 -07:00
Matt Corallo
454b4726bd Replace load/decode/index around our own number with helpers 2015-03-25 11:54:55 -07:00
lilia
3759fe46e9 Account for -1 HTTPError code 2015-03-25 11:46:14 -07:00
lilia
e52224e481 Remove libtextsecure's jquery dependency
Use only the finest, hand-crafted, artisanal XMLHttpRequests.
2015-03-25 10:32:14 -07:00
lilia
a2d88b4fad Don't trigger notifications for sync messages 2015-03-24 18:12:33 -07:00
lilia
923bb8bbc9 Fix crash in message detail view
Fix crash when there's no contact for a group member.
2015-03-24 11:36:42 -07:00
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
f067bb9954 Remove dead code 2015-03-23 18:41:17 -07:00
lilia
fdb0935d6a Fix resolveConflicts for groups 2015-03-23 18:36:38 -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
6509561795 Make badge count accurate
Previously it would reset when refreshing the inbox. Now it tracks
changes to conversation unreadCounts.

Fixes #200
2015-03-23 12:41:52 -07:00
lilia
24768712e0 Focus text input when opening a conversation 2015-03-23 12:19:33 -07:00
lilia
ebc8846fcb Fix bug in panels controller
Previously, we'd create a new model instance even when one already
existed in the inbox.
2015-03-23 12:19:33 -07:00
lilia
9474b16eba In rare cases, a group has no members 2015-03-23 12:19:32 -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
06f4d4456d Fix empty notification on key conflicts 2015-03-20 10:47:58 -07:00
lilia
c526dbda5f Set up production build task
`grunt copy`

Closes #191
2015-03-19 18:34:56 -07:00
lilia
718f1a5e3d Improve notification contents
Include sensible descriptions of non-content messages. For group
messages, display the sender's name and avatar rather than the group's.
2015-03-19 18:34:10 -07:00
lilia
43ec4099c9 Reset the name field on new group form 2015-03-19 13:55:13 -07:00
lilia
11b822eaf3 Allow unknown groups
Save groups even if we've never heard of them. Previously
we would fail to save due to a missing 'type' attribute.
2015-03-19 13:54:03 -07:00
lilia
84237cae6f Fix standalone registration page 2015-03-18 18:14:21 -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
857eee5003 Divorce identity wipe from tryAgain functions
We'd like to live in a world where we can retry all the pending
conflicts in a conversation as a batch, which means we don't want to
wipe the identity key before processing each message. Thus, remove that
step from these handlers and encapsulate in a method on the conversation
model.
2015-03-18 16:29:02 -07:00
lilia
c642854ddf Extract app-level logic from libtextsecure
Ensure that both tryAgain functions return promises, allowing the
application to take appropriate action in the result of success or
failure. This lets us remove all dependency from libtextsecure on
app-level constructs like message objects/ids and the `extenion.trigger`
function.

Corresponding frontend changes to follow in another commit.
2015-03-18 16:29:02 -07:00
lilia
e88d4d8170 Tweak replayable errors
1. Return the value returned by the registered function, to expose the
underlying promise to the caller.

2. Stop accepting extra arguments to the replay function. The caller
should be able to do what they want with the returned promise instead.

3. Add a timestamp argument to the outgoing case, needed to re-try
sending a message.
2015-03-18 16:29:01 -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
fa3699cdd3 Trigger desktop notifications
Notifications show the conversation name, avatar, and new message text.
Clicking the notification opens the conversation.
2015-03-18 16:29:01 -07:00
Matt Corallo
d3c158f4cf Move libaxolotl out-of-tree 2015-03-17 14:43:23 -07:00
Matt Corallo
e2e06b2d3c Remove axolotl.storage usage from libtextsecure 2015-03-17 13:59:25 -07:00
lilia
b790f82849 Remove libaxolotl dependency on textsecure/errors.js
Let libaxolotl throw a generic error instead of a replayable error, and
add an helper function in libtextsecure's axolotl_wrapper to catch and
convert from the generic error to the replayable one. This allows the
ReplayableError to remain a libtextsecure-level concept only.

Somewhat unrelatedly, but nearby, fix some whitespace and add missing
semicolon.
2015-03-17 13:59:24 -07:00
lilia
676ad04958 Add device storage method to wipe an identity 2015-03-17 13:59:24 -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