Commit graph

219 commits

Author SHA1 Message Date
lilia
6e2a85ccf1 wip new message phone number validation 2014-10-22 12:05:33 -07:00
lilia
e831c649bd Require a mandatory websocket reset once a minute
Compensate for the lack of keepalives in the WebSocket API.

Fixes #67
2014-10-21 19:57:53 -07:00
lilia
a3bf40e852 Shorten websocket time out. Fixes #67 2014-10-21 14:26:14 -07:00
lilia
3a00e49791 Open the most recent conversation on load 2014-10-20 17:49:41 -07:00
lilia
1023ea1732 Refactor textsecure.protos -> textsecure.protobuf
DRY up protobuf declarations and move to a slightly briefer naming
convention.

Also dropped some ArrayBuffer -> string conversions as
ProtoBuf.js handles ArrayBuffers just fine, and in fact, more
efficiently than strings.

Finally, dropped the btoa() wrappers, because that incurs an extra
string -> string conversion before the protobuf's internal string ->
array buffer conversion. In lieu of btoa, we can simply pass in the
optional string encoding argument to the protobuf's decode method,
which in these cases should be 'binary'.

Related: #17
2014-10-20 15:11:16 -07:00
lilia
03cc667e48 Standardize some whitespace
The preferred style is 4 spaces.
2014-10-20 15:09:36 -07:00
Arnaud Benard
e568e2c528 Fixes #61 - Order by timestamps with tests 2014-10-20 02:07:46 -07:00
lilia
cc5327dbc9 Fix group loop
All the group messages were being sent to the last recipient in the
list, due to the persistence of `var number` in later loops and async
calls. An easy mistake to make, when you use for instead of each.
2014-10-18 15:00:43 -07:00
lilia
ac5c359053 Fix strange loop in sendMessageProto
Don't declare a new `var i`  within the scope of an existing `var i`.

Fixes #63
2014-10-17 16:57:33 -07:00
lilia
cd55c0a1f1 Put groupid back in id field also 2014-10-17 14:32:37 -07:00
lilia
0bd5f3e3c2 If for some reason a group has no name, provide a default 2014-10-17 13:25:39 -07:00
lilia
0036e4ef74 Store group ids as strings 2014-10-17 13:11:08 -07:00
lilia
8288e298fc Group ids should be converted to ArrayBuffers for transport 2014-10-17 12:52:46 -07:00
lilia
143254cec8 Group ids are stored in groupId 2014-10-16 17:50:36 -07:00
lilia
bbe57ef0bf Stringify incoming group ids
Otherwise when we try to make their local storage keys they look like:
"egroupByteBuffer(offset=4,markedOffset=-1,length=28,capacity=112)"
2014-10-16 17:39:45 -07:00
lilia
4f21bbd21f Use textsecure.messaging to create groups
Not textsecure.storage. Sigh. Also accomodate the fact that
the group id is not returned directly, but rather at the end
of a promise chain.
2014-10-16 14:15:13 -07:00
lilia
fa4c385598 Make initial timestamp on a thread match the 1st message 2014-10-16 14:13:03 -07:00
lilia
f14cd2eed1 Don't validate presence of thread id
It's undefined until the first save();
2014-10-16 14:11:51 -07:00
lilia
7e9c0e2394 Group ids should be strings (or stringables)
ArrayBuffer was a bad choice.
2014-10-16 13:38:33 -07:00
lilia
6db3eeb52e Convert incoming timestamps into numbers
Fixes #59

protip: don't use << for anything over 2^32. The operands of all bitwise
operators are converted to signed 32-bit integers
2014-10-16 12:32:02 -07:00
lilia
d7edfd4efb Remove reference to undefined function 2014-10-15 18:10:27 -07:00
lilia
43f4f6cf99 Open a group's view after it's created 2014-10-14 21:35:40 -07:00
lilia
320d1f18ae Fix exception when protbuf-encoding groupIds
An exception is thrown when protobuf tries to encode a number as the
group id, which is declared to have type 'bytes'.

Fix by make it an ArrayBuffer instead, and increase the length to 16,
which is what the Android client uses:

c632b32ff8/src/org/thoughtcrime/securesms/database/GroupDatabase.java (L222)
2014-10-14 19:33:33 -07:00
lilia
5b0573293f Fix references to GroupContext Type ENUM values 2014-10-14 19:07:00 -07:00
lilia
01f9fc1f17 More frontend groups fixes 2014-10-14 19:06:35 -07:00
lilia
e89e691957 Fix bug in groupId generation
Previously, if calling createNewGroup with an undefined groupId,
no groupId was generated.

This occurred because no entry for "group" + undefined exists in
localStorage, which caused this code to think undefined was a
valid group id.

Fixed by adding `|| groupId == undefined` to the while clause.
Also decoupled the groupId collision check for clarity.
2014-10-14 15:47:51 -07:00
lilia
dc41ebf701 Small frontend fixes for the new group view 2014-10-14 15:47:51 -07:00
lilia
2bd77693e1 Refactor options page and style using bootstrap 2014-10-14 13:59:43 -07:00
lilia
81e4af5827 Move phonenumbery utils to libphonenumber object
Slowly whittling away at helpers.js...
2014-10-13 22:49:39 -07:00
lilia
9fc14cfa30 Remove erroneous comment re: MDN copyright
In fact, the code samples we have copied from MDN are declared to be
public domain (see link below):

  "Code samples added on or after August 20, 2010 are in the public
  domain."

https://developer.mozilla.org/en-US/docs/MDN/About#Copyrights_and_licenses

AFAICT we're using code from this page, last updated 10/4/14:
https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
2014-10-10 17:25:40 -07:00
lilia
75e78caec8 Function-wrap options.js 2014-10-10 16:58:44 -07:00
lilia
683c373943 Relaxes verification code validation
When codes are sent they are formatted as xxx-xxx. Previously when I
would paste these from GVoice they failed validation thanks to the dash
and whatever whitespace I happened to grab.
2014-10-10 16:32:22 -07:00
lilia
27708cd8d7 Switch to staging. -ca is now production 2014-10-10 16:32:15 -07:00
lilia
0f4b53c176 Update records list in BBLocalStorage on fetch
Previously, would only update the known messages.
2014-10-09 20:08:28 -07:00
lilia
2288f8adc1 Fix new group ui not showing 2014-10-09 19:02:52 -07:00
lilia
266600e5ab There's no need to wrap this function inside a function afaict 2014-10-09 18:54:23 -07:00
lilia
ae98b8680f Fix whitespace in popup.js
Our official standard is 4 space indentation.
2014-10-09 18:43:58 -07:00
lilia
ef066ea9d2 Make conversations open when they are created 2014-09-04 00:21:18 -07:00
lilia
230d24a69e Views already have a #remove() 2014-09-04 00:21:02 -07:00
lilia
db86abdf70 Add list view tests
Also,
 * moved fetch out of the list view
 * removed unused #last() function
 * put test setup lines in their own tiny file.
 * added data-cover to view script tags for code coveage reports.
2014-09-04 00:18:15 -07:00
lilia
ad7456b367 Refactor away this poorly named and overloaded file 2014-08-31 18:18:13 -07:00
lilia
b9640a54bd Move new convo stuff to its own file 2014-08-31 18:02:39 -07:00
lilia
9af18ce6ae Encapsulate page layout js
The layout class is the only class that should have knowledge of
page-level constant markup, such as #gutter and #contacts, and
should be pretty much the only place we find elements by id (with
the exception of template elements).

This change removes references to #gutter from views. Rather than
hardcoding assumptions about page layout, view elements should
ask the layout to insert themselves into the main content area by
calling Whisper.Layout.setContent.
2014-08-31 17:46:01 -07:00
lilia
5ddcc516e4 remove extra insertion, it's already happening 2014-08-25 19:01:18 -07:00
lilia
2f0b0f7a1b Get overflow scrolls working
Had to resort to a resize event handler.
A bit slow at times, but it works.
2014-08-25 19:01:13 -07:00
lilia
546cdf82cb Fix some markup issues
* Remove spurious search div
* Fix nested uls
* Use class name selected, not closed (the inverse)
* Restor nacl div
2014-08-25 18:59:22 -07:00
lilia
c2beda8e40 Get single recipient message composition working again 2014-08-25 18:55:51 -07:00
lilia
c034ac8267 Refactor components for the main content section
Each conversation views now manages its own separate elements
rather than all binding to a shared #conversation element, and
similarly for message composition ui.

Also includes the beginnings of group creation UI (not working yet),
featuring bootstrap-tagsinput field for entering group recipients
2014-08-25 18:54:55 -07:00
lilia
8d83a8fb27 This element is constant, so let's bootstrap it 2014-08-25 18:48:12 -07:00
lilia
5f74a60364 Format thread timestamps 2014-08-25 18:48:12 -07:00