Commit graph

3869 commits

Author SHA1 Message Date
Daniel Gasienica
45d89d1e44 Create UserMessage type
Describes user visible messages that can have attachments.
2018-04-25 15:24:51 -04:00
Daniel Gasienica
2dc3877fd4 Integrate visual media attachment gallery 2018-04-25 15:24:51 -04:00
Daniel Gasienica
27c4bf90e3 Add Signal.Backbone 2018-04-25 15:24:51 -04:00
Daniel Gasienica
825980fbd1 Add Collection.fetchVisualMediaAttachments 2018-04-25 15:24:51 -04:00
Daniel Gasienica
cad5e417f3 Add arrayBufferToObjectURL module 2018-04-25 15:24:51 -04:00
Daniel Gasienica
e5d90775d0 Add MapAsync type definition 2018-04-25 15:24:51 -04:00
Daniel Gasienica
648a7ab1bb Autoformat using Prettier 2018-04-25 15:24:51 -04:00
Daniel Gasienica
320a8d31c1 TSLint: Allow multiline JS in JSX for CSS-in-JS 2018-04-25 15:24:51 -04:00
Daniel Gasienica
cd2a02a626 Add TSLint Prettier overrides 2018-04-25 15:24:51 -04:00
Daniel Gasienica
082ef98a56 Add type definition for deferredToPromise 2018-04-25 15:24:51 -04:00
Daniel Gasienica
e07458d886 Add basic Backbone type definitions 2018-04-25 15:24:51 -04:00
Daniel Gasienica
9d84b2f420 Index messages with attachments using a boolean
When indexing message attachment metadata using numeric indexes such as:

```javascript
{
  conversationId: '+12223334455',
  received_at: 123,
  attachments: […],
  numAttachments: 2,
},
{
  conversationId: '+12223334455',
  received_at: 456,
  attachments: [],
  numAttachments: 0,
}
{
  conversationId: '+12223334455',
  received_at: 789,
  attachments: [],
  numAttachments: 1,
}
```

It creates an index as follows:

```
[conversationId, received_at, numAttachments]
['+12223334455', 123, 2]
['+12223334455', 456, 0]
['+12223334455', 789, 1]
```

This means a query such as…

```
lowerBound: ['+12223334455', 0,                1               ]
upperBound: ['+12223334455', Number.MAX_VALUE, Number.MAX_VALUE]
```

…will return all three original entries because they span the `received_at`
from `0` through `Number.MAX_VALUE`. One workaround is to index booleans using
`1 | undefined` where `1` is included in the index and `undefined` is not, but
that way we lose the ability to query for the `false` value. Instead, we flip
adjust the index to `[conversationId, hasAttachments, received_at]` and can
then query messages with attachments using

```
[conversationId, 1 /* hasAttachments */, 0                /* received_at */]
[conversationId, 1 /* hasAttachments */, Number.MAX_VALUE /* received_at */]
```
2018-04-25 15:24:51 -04:00
Daniel Gasienica
c46e1a1519 Move top-level functions to Signal.Util 2018-04-25 15:24:51 -04:00
Daniel Gasienica
5ec8b1c6e1 Add @types/jquery 2018-04-25 15:24:51 -04:00
Daniel Gasienica
a609c31a57 Style attachment section headers 2018-04-25 15:24:51 -04:00
Daniel Gasienica
ae4c74dd5b Skip metadata initialization for verified-change messages 2018-04-25 15:24:51 -04:00
Daniel Gasienica
b0fefdbb98 Implementing grouping messages by date 2018-04-25 15:24:51 -04:00
Daniel Gasienica
dea56c0008 Autoformat TSX files 2018-04-25 15:24:51 -04:00
Daniel Gasienica
424965f876 🎨 Autoformat code 2018-04-25 15:24:51 -04:00
Daniel Gasienica
2fae89f0e8 Add trailing commas to autoformatted code 2018-04-25 15:24:51 -04:00
Daniel Gasienica
347fc8287a Add yarn format to autoformat code
Uses Prettier under the hood. Requires opt-in via `@prettier` pragma:
https://prettier.io/docs/en/options.html#require-pragma
2018-04-25 15:24:51 -04:00
Daniel Gasienica
56a5006392 Remove duplicate @types/lodash dependency 2018-04-25 15:24:51 -04:00
Daniel Gasienica
8edbd06e43 TSLint: Enforce UNIX line breaks 2018-04-25 15:24:51 -04:00
Daniel Gasienica
a8bca9b8eb TSLint: Enforce indentation with 2 spaces
Not sure if this rule actually works.
2018-04-25 15:24:51 -04:00
Daniel Gasienica
04acdebe48 TSLint: Align various syntax elements 2018-04-25 15:24:51 -04:00
Daniel Gasienica
9858e0e680 Fix translation description 2018-04-25 15:24:51 -04:00
Daniel Gasienica
39d5f3c413 Enable strict type checking features 2018-04-25 15:24:51 -04:00
Daniel Gasienica
99921ed848 Enable strict null checks 2018-04-25 15:24:51 -04:00
Daniel Gasienica
3a8c3ccdab Add prettier 2018-04-25 15:24:51 -04:00
Daniel Gasienica
f367a9b059 Move private method below public ones 2018-04-25 15:24:51 -04:00
Daniel Gasienica
832b6309a2 Limit line length 2018-04-25 15:24:51 -04:00
Daniel Gasienica
cf1d621bce Allow line breaks in long import statements 2018-04-25 15:24:51 -04:00
Daniel Gasienica
3d70e46aea Calculate dates in UTC 2018-04-25 15:24:51 -04:00
Daniel Gasienica
d7b21ef5dc Render attachments grouped by date 2018-04-25 15:24:51 -04:00
Daniel Gasienica
e34347f290 Add groupMessagesByDate 2018-04-25 15:24:51 -04:00
Daniel Gasienica
9053b6acfc Remove unused style 2018-04-25 15:24:51 -04:00
Daniel Gasienica
ae419764bf Use arrow function over .bind 2018-04-25 15:24:51 -04:00
Daniel Gasienica
a86a596f34 Add translations for section headers in media gallery 2018-04-25 15:24:51 -04:00
Daniel Gasienica
66516fd36a Use short format for dates 2018-04-25 15:24:51 -04:00
Daniel Gasienica
923d5ff088 Add missingCaseError function 2018-04-25 15:24:51 -04:00
Daniel Gasienica
fc1c3aabf5 Add scaffolding for media gallery 2018-04-25 15:24:51 -04:00
Daniel Gasienica
a8be4f2d8d Expose Lodash in style guide 2018-04-25 15:24:51 -04:00
Daniel Gasienica
8ef04cb1fd Move @types/* dependencies to devDependencies 2018-04-25 15:24:51 -04:00
Daniel Gasienica
10bede85c9 Add filesize dependency 2018-04-25 15:24:50 -04:00
Daniel Gasienica
94ef3bab80 Move test file 2018-04-25 15:24:50 -04:00
Daniel Gasienica
272c49c5bf Use existing ReactWrapper 2018-04-25 15:24:50 -04:00
Daniel Gasienica
32a3ef518b Render media gallery placeholder panel 2018-04-25 15:24:50 -04:00
Daniel Gasienica
f9e4613395 Move TS test for message migration 2018-04-25 15:24:50 -04:00
Daniel Gasienica
5f220a7b2c Add migration for media gallery indices 2018-04-25 15:24:50 -04:00
Daniel Gasienica
273248d3fd Wire up ‘View All Media’ menu item 2018-04-25 15:24:50 -04:00