Commit graph

761 commits

Author SHA1 Message Date
lilia
17a3025af2 Mark end session messages sent 2015-07-16 12:14:09 -07:00
lilia
c94c4bc7e0 Remove redundant identity key updates
We were re-saving the key when it did not conflict with the exisiting
value.
2015-07-16 12:14:06 -07:00
lilia
2e272b6894 Turn off idb query logging
++speed
2015-07-16 12:13:45 -07:00
lilia
9dfff879b6 Remove usage of extension.trigger
This trigger function uses chrome's runtime message passing api, which
traverses between different windows in our runtime, but we only trigger
the updateInbox event from the backgroud page, so we don't need to use
that api, which requires some extra cpu/memory overhead.

// FREEBIE
2015-07-16 12:13:45 -07:00
lilia
2ad422afc8 Convert to array buffer 2015-07-16 12:13:43 -07:00
lilia
1f8040998f Fix up array buffer comparison
Well that didn't work. Luckily this comparison is primarily enforced at
the libaxolotl level.

With this and the corresponding change to libaxolotl, remote identity
keys are always going to be stored as array buffers going forward. This
will cause incompatibility with existing keys stored as strings, so
updating to this point requires you to purge your identity key and
session store.
2015-07-16 12:13:11 -07:00
lilia
853b578551 Change default value for active_at
We're overriding the default with null often enough that we should
just change the default.

Consequently, no more phantom blank conversations with oneself should
appear after receiving a group update. They were being added to the
inbox because they were incorrectly initialized with an active_at value.

Fixes #281
2015-07-14 16:44:08 -07:00
lilia
809c9bdb57 Save outgoing group updates 2015-07-14 16:41:25 -07:00
lilia
971079980e Close stale windows on background refresh
All the old event listeners and in-memory objects have perished with the
old background page. Also reopen the inbox if it was already open.

Fixes #289

// FREEBIE
2015-07-14 13:39:37 -07:00
lilia
815b79dc64 Cleanup 'Too many devices' dialog
Closes #263
2015-07-14 13:39:37 -07:00
lilia
a3ae3cab79 Use Promise.reject for simplicity
The following are equivalent, except that the first is longer and
invokes an extra function call.

```
return new Promise(function(resolve, reject) {
  reject(new Error("Unknown Group"));
});

return Promise.reject(new Error("Unknown Group"));
```
2015-07-14 13:39:36 -07:00
lilia
20586e2dcc Namespace events
Naming conflict was firing the error handler twice.

// FREEBIE
2015-07-13 13:03:43 -07:00
lilia
6e74ac9e28 Dispatch all network errors, not just auth errors
Also streamline the onError handler.
2015-07-13 13:03:43 -07:00
lilia
b40a8696b7 DRY up Promise creation in api.js
Since calls to ajax() are always wrapped in promises, we can internalize
that pattern in the ajax function itself.

// FREEBIE
2015-07-13 13:03:42 -07:00
lilia
3711e0a6cd Convert throwHumanError to custom error type
Now with 200% more helpful stack traces.

// FREEBIE
2015-07-13 13:03:41 -07:00
lilia
b44c12807c Mark messages sent after resolving outgoing key conflicts 2015-07-09 11:31:43 -07:00
lilia
82de8148d2 Reload harder
Refreshing the background page does re-open the socket, but the inbox
and other windows don't reattach correctly. Reload the whole runtime to
force close all windows, reload the background, and re open the inbox.
2015-07-08 17:53:47 -07:00
lilia
56341769bd Mark group creation messages as sent 2015-07-08 16:47:29 -07:00
lilia
3e4c571749 Fix initial input focus in compose view
This selector was being run too early, before the target was rendered.
2015-07-08 15:56:08 -07:00
adambar
476eb54db1 Maintain bottom-most scroll position when resizing conversation area.
Closes #278
2015-07-08 13:46:48 -07:00
lilia
1a82a12a30 Use input instead of keyup/change events
In lieu of a click event, the change event was being fired when clicking
out of the search input. The input event seems to be what we actually want.

Fixes #273
2015-07-08 13:06:45 -07:00
lilia
cfc3b8e6a5 Fix phantom outgoing messages
This bug was caused by a race between indexeddb requests and sending
messages. Order of events to repro was roughly:

1. send async idb request for current message list
2. add new message(s)
3. idb request returns with now incomplete message list
4. message collection gets reset to list from 3, removing messages
added in 2, but not removing their phantom views/dom elements. (bug)
5. send another idb request for current message list
6. idb request returns bearing all messages including those from 2.
7. messages from 2 are added and rendered a second time.

The fix was simply to not remove messages in 4, which means we reuse the
original message model object rather than recreating it in 7.

Fixes #243

// FREEBIE
2015-07-08 11:57:16 -07:00
lilia
fa4022a4e3 Invert pending/sent model 2015-07-07 23:03:56 -07:00
lilia
a66195a98f Fix messages stuck in pending state
The unset function, and the series of events/callbacks triggered by its
use, are not as similar to the set/save functions as previously
anticipated, leading to flux in the state of the 'pending' attribute.

Fixes #283

// FREEBIE
2015-07-07 16:15:23 -07:00
lilia
3cbe4f1f46 remove unused argument 2015-07-07 16:03:12 -07:00
lilia
8745424d3a Fix outgoing identity key conflict handling
// FREEBIE
2015-07-06 15:11:35 -07:00
lilia
9f021a9d7f Update notification code to new avatar format 2015-07-06 12:58:24 -07:00
lilia
66ae3689c1 Fix decrypt error handling
This rejection-handler was resolving its promise rather than allowing
the rejection to bubble up.
2015-07-06 12:46:32 -07:00
lilia
f8ae5556d9 Fix standalone registration 2015-07-06 12:45:09 -07:00
lilia
6a98fc8278 Reload contacts when resetting a recipients input
Fixes #272

// FREEBIE
2015-07-06 12:13:49 -07:00
lilia
f5f4c128f9 Fix tests, let templating handle html escaping
Note: as a Chrome app, we're also protected from xss by the content
security policy.

// FREEBIE
2015-07-04 23:08:25 -07:00
adambar
fcc873ffca Trim the message before sending - disable sending whitespace characters only 2015-07-03 21:53:45 +02:00
adambar
c20c59add0 Include Ctrl+Enter as one the shortcuts that insert line break instead of submitting the message 2015-07-03 13:49:01 +02:00
adambar
86f7b7adf5 Allow line breaks in messages. Closes issue #291
Line breaks can now be insterted into message box using Shift+Enter or Alt+Enter. Messages with new lines are properly displayed in the conversation view (but only there, to keep inbox clean). The template was modified to allow HTML, but the message itself is sanitized before new line handling is run.
2015-07-02 23:02:27 +02:00
adambar
52857f09ea Fix for conversation & inbox windows closing callbacks never called.
As discussed in similar issue there: https://github.com/GoogleChrome/chromedeveditor/issues/1023 - it is not possible to add onClosed event listener on an 'abstract' current window property, it needs to be set on the particular window instance instead.

Before that change, the clean up function was never actually called, because the listener was never properly attached. That was probably the reason of existence for "panel isn't actually open ... and so we try again." code that was executed if the previous window wasn't cleaned up properly (so actually every time). This code is no longer needed, I guess, as the windows are now cleaned up properly.
2015-07-01 22:28:06 +02:00
lilia
5242108e15 Fix group update avatar handling
The avatar handler was being added to the list of promises too late,
so we were storing the raw avatar protobuf (Long id, bytes key) rather
than the downloaded/decrypted attachment data.

Fixes #280
2015-06-26 12:23:57 -07:00
lilia
5e6145aa46 Mark conversation read on window focus event
Fixes #282

// FREEBIE
2015-06-26 11:53:00 -07:00
lilia
29360fea5c Fixes #275 default group image 2015-06-26 11:30:54 -07:00
lilia
feb5e5b068 Display gray # instead of colored + for no-name contacts
For consistency with android.
2015-06-25 13:47:46 -07:00
lilia
4c40861728 Fix reinstalls
Delay saving of new account info until we confirm with the server.
Explicitly delete old account info beforehand.

// FREEBIE
2015-06-25 13:24:32 -07:00
lilia
db31835f68 Handle group sync for existing groups
// FREEBIE
2015-06-25 13:24:32 -07:00
lilia
5925c2fe84 Support for group sync
Protocol and handling is all analogous to contact sync: Multiple
GroupDetails structs are packed into a single attachment blob and parsed
on our end. We don't display the synced groups in the conversation list
until a new message is sent to one of them.

// FREEBIE
2015-06-25 13:24:32 -07:00
lilia
3dd8056487 Add error dialog for too many devices 2015-06-25 13:24:31 -07:00
lilia
f126e3b21b Work on auth error handling / reinstall 2015-06-25 13:24:31 -07:00
lilia
ef8a977f38 Sort contacts by name ignoring case 2015-06-25 13:24:31 -07:00
lilia
2f935dfd5e Add contact sync request protocol 2015-06-25 13:24:31 -07:00
lilia
f32ff58953 Add support for device name 2015-06-25 13:24:30 -07:00
lilia
7d568b5092 Fixup auto-expand
* Fix a css bug preventing bottom bar from sticking to the bottom.
* Resize discussion container as a function of the overall window
  height. The previous difference-based method gives the wrong result
  when the window height changes but the bottom-bar height stays the
  same.

// FREEBIE
2015-06-24 12:10:53 -07:00
adambar
b80706089c Fix for potential memory leaks 2015-06-23 22:46:27 +02:00
adambar
9c563cf080 Fix for message box auto-sizing behavior on resize; menu z-index fix 2015-06-23 22:46:27 +02:00