Commit graph

1240 commits

Author SHA1 Message Date
lilia
eb1cfe9b70 Move notification listeners to background
Otherwise they will be re-registered by the frontend page.

// FREEBIE
2015-09-25 11:10:14 -07:00
lilia
3bf9e36ead Move function declarations out of storage.onready 2015-09-24 10:39:56 -07:00
lilia
c8e51563a0 Refactor initial sync codepath to application layer
To reduce dependence on the message sending module, AccountManager
should send no sync requests itself.
2015-09-24 10:38:58 -07:00
lilia
6123c419d0 Remove refreshGroup
1. This is nonstandard behavior, not supported by any other clients. It
   may help sometimes but will also cause bugs (see 2)

2. iOS doesn't handle group updates with missing fields. all fields must
   be populated, and libtextsecure doesn't have any knowledge of the group
   name or avatar, so these updates will clobber group state on iOS.

// FREEBIE
2015-09-23 16:45:09 -07:00
lilia
94e1c2d123 Remove check for .humanError property
This property is no longer used by any of our errors.

// FREEBIE
2015-09-23 16:45:09 -07:00
lilia
6547538458 Use foreach instead of a loop
This syntax makes plain that the function is not used anywhere else,
and increases linearity/readability.

// FREEBIE
2015-09-23 16:45:08 -07:00
lilia
acaf7b8de2 Refactor relay consistency check
Check the device list for relay consitency and throw an exception before
attempting to encrypt to any of the mismatched devices.

// FREEBIE
2015-09-23 16:45:08 -07:00
lilia
bafc61600c Refactor sendMessageToDevices
Leverage map and Promise.all for more concise and linear code flow.
2015-09-23 16:45:07 -07:00
lilia
9ff95c7e61 DRY up group update sending
// FREEBIE
2015-09-23 16:45:07 -07:00
lilia
f00d118c93 More logging
// FREEBIE
2015-09-23 16:30:30 -07:00
lilia
f6b35ffbfc Log error stack traces
// FREEBIE
2015-09-23 16:30:30 -07:00
lilia
213dbdefd2 Reorder functions
// FREEBIE
2015-09-23 16:30:30 -07:00
lilia
62c90e3925 Don't save/log websocket error
It's a generic error Event and doesn't actually contain anything useful.

// FREEBIE
2015-09-23 16:30:30 -07:00
lilia
289b82d1dc Expose messageReceiver.close
// FREEBIE
2015-09-23 16:30:29 -07:00
lilia
1d370857fc Remove unused callback arguments
Unused since d0fd3e94 afaict.

// FREEBIE
2015-09-23 16:07:21 -07:00
lilia
2204ef863d Fix event name
We successfully retry after a websocket connection closes, but this typo
prevented us from retrying if the websocket simply never opened.

// FREEBIE
2015-09-23 16:07:20 -07:00
lilia
d1191c509c Log outgoing errors individually
// FREEBIE
2015-09-21 11:48:57 -07:00
lilia
ada3d999e0 Log outgoing errors
// FREEBIE
2015-09-21 11:02:33 -07:00
lilia
ce49d14d85 Fix leave group bug
This one's been around since forever, but only manifests when someone
leaves the group and comes back. In that case we fail to reinit their
numberRegistrationId object, which causes a npe when we try to send
send them group messages.

Affected parties must ask their fickle friends to leave/join again.

// FREEBIE
2015-09-21 11:00:12 -07:00
lilia
4a482243d0 Simplify event arguments
// FREEBIE
2015-09-21 10:32:35 -07:00
lilia
c8a76ab38e Fix websocket event handler name
// FREEBIE
2015-09-21 10:32:35 -07:00
lilia
21667d9181 Log when we start waiting for an online event
// FREEBIE
2015-09-21 10:32:35 -07:00
lilia
823f570955 Add more websocket debug logging
// FREEBIE
2015-09-21 10:32:34 -07:00
lilia
f70e844cef Include url in http response logging
Otherwise it's impossible to tell which is which, especially when
sending group messages.

// FREEBIE
2015-09-21 10:32:34 -07:00
lilia
d8803ee31f Mark leave group messages as sent
// FREEBIE
2015-09-21 10:32:33 -07:00
lilia
b1d3829651 Update minimal window dimensions
Some day we'll probably lower these minimums but first we'd need a more
responsive design.

Fixes #310

// FREEBIE
2015-09-18 13:13:31 -07:00
lilia
960754ef04 Restyle compose button
Move it to a tool bar at the top of the conversation list. This is also
where a search bar will live someday.

Fixes #357

// FREEBIE
2015-09-18 13:08:52 -07:00
lilia
2243c09fea MessageReceiver is an event target
Rather than asking for a global target, the message receiver implements
the EventTarget interface itself. It does not expose the dispatchEvent
method, however. This ensures that events can only be triggered from
within the internal MessageReceiver class, which means we no longer need
to namespace them.

// FREEBIE
2015-09-18 09:30:12 -07:00
lilia
a925027cd2 Refactor MessageReceiver for storage/server independence
Let the libtextsecure consumer pass in their own server url, username,
password, and signaling key, as with libtextsecure-java.

Also brings reconnect logic up into the MessageReceiver class, which
is the only place it should apply.
2015-09-17 16:52:32 -07:00
lilia
e59a5792d5 Don't hardcode the attachment host 2015-09-17 16:02:22 -07:00
lilia
184e37383c Don't auto-populate the relay field
According to server api docs, relay is optional when it is the same as
our own server.

// FREEBIE
2015-09-17 16:02:22 -07:00
lilia
7d9cf0c167 Pass the signaling key into decryptWebSocketMessage
De-couple this file from dependency on storage.
2015-09-17 16:02:22 -07:00
lilia
c167fc964d Revert "Remove global updateInbox method"
This reverts commit 1c70293bba.

This broke tests by blocking the database deletion during test
setup.
2015-09-17 15:42:13 -07:00
lilia
87ce3241c8 Remove script-tag for nonexistant test
// FREEBIE
2015-09-17 15:25:13 -07:00
lilia
310f40fcad Contact sync should update existing contacts
// FREEBIE
2015-09-17 14:26:25 -07:00
lilia
7f4ef6e9e7 Remove double-check of unread count
This same condition is already enforced in the markRead method.

// FREEBIE
2015-09-17 13:46:58 -07:00
lilia
1c70293bba Remove global updateInbox method
This operation now needs to be done exactly once, at startup, so we
don't need to expose a global method for it.

// FREEBIE
2015-09-17 13:44:44 -07:00
lilia
6364cda7cb Create requires an object
// FREEBIE
2015-09-17 11:42:59 -07:00
lilia
78d7296f84 Fix tests
// FREEBIE
2015-09-17 11:40:42 -07:00
lilia
b617240338 Stop calling updateInbox all the time
Now that the inbox collection keeps itself in sync, we don't have the
data duplication that was forcing us to reload constantly.

// FREEBIE
2015-09-17 10:57:17 -07:00
lilia
537f0ceef0 Log all http requests at start and end
// FREEBIE
2015-09-17 10:57:17 -07:00
lilia
0017f196ef Move ConversationController to its own file
Encapsulate the global conversation cache collection against accidental
access, avoiding the data-clobbering bug fixed in previous commit.

Also move some one-off program initialization code from panel controller
to background.js

// FREEBIE
2015-09-16 23:43:14 -07:00
lilia
8f28c3af68 Fix disappearing contact info
This errant reference to the global cache of conversations was causing
some contacts to get clobbered.

// FREEBIE
2015-09-16 22:47:42 -07:00
lilia
93a5d01127 Delete old code
We don't have any more 'default' css classes. Default avatar data is
simply provided by a model for rendering in a view.

// FREEBIE
2015-09-16 22:19:04 -07:00
lilia
2bc65c2ab4 Let messages fetch references to senders
The conversation's contactCollection only contains references to the
current membership, and will not provide contact info for people who
have left the group, causing their messages to render without numbers or
avatars.

// FREEBIE
2015-09-16 22:15:47 -07:00
lilia
fd29ac8d2c Promote groups to top of inbox when we update them
// FREEBIE
2015-09-16 18:01:39 -07:00
lilia
73983118dc Render emoji in conversation title // Fixes #359
// FREEBIE
2015-09-16 16:40:11 -07:00
lilia
6f94888659 Use online event listener to reconnect more smrtly
No need to retry if we know we're offline.

// FREEBIE
2015-09-16 15:16:39 -07:00
lilia
37998e261d Log more errors
// FREEBIE
2015-09-16 14:41:20 -07:00
lilia
36ec4300cf Fix broken group avatar preview
Fixes #355

// FREEBIE
2015-09-16 12:29:16 -07:00