Commit Graph

33 Commits

Author SHA1 Message Date
Fedor Indutny 4ef0bf96cc
Uint8Array migration 2021-09-23 17:49:05 -07:00
Josh Perez e86a6119cd
Moves stringToArrayBuffer into util folder 2021-09-20 12:27:15 -04:00
Evan Hahn 8bfaf598af Add license headers across the project 2020-11-04 13:03:13 -06:00
Chris Svenningsen 8a2c17f65f Apply new ESLint rules to legacy code 2020-09-09 17:34:57 -07:00
Scott Nonnenberg 1d2c3ae23c Download attachments in separate queue from message processing 2019-02-12 16:34:21 -08:00
Scott Nonnenberg 813924685e Link Previews 2019-01-29 13:53:14 -08:00
Scott Nonnenberg 5933a34a18 Use window.log in browser context, turn on console eslint rule 2018-07-21 14:52:43 -07:00
Scott Nonnenberg 3c69886320 Finish new Message component, integrate into application
Also:
- New schema version 8 with video/image thumbnails, screenshots, sizes
- Upgrade messages not at current schema version when loading messages
  to show in conversation
- New MessageDetail react component
- New ConversationHeader react component
2018-07-17 15:58:07 -07:00
Scott Nonnenberg aa13a2c6f7 Parse phone numbers into e164 as part of schema upgrade 2018-05-10 11:54:58 -07:00
Daniel Gasienica 16bc1d34c6 Message schema 6: Change classification of media and documents
For an easier implementation, we change our original definition of
`initializeAttachmentMetadata`. This means we have to re-run it marked as
version 6 and mark schema version 5 as deprecated as its definition has changed.
2018-05-08 16:41:07 -04:00
Scott Nonnenberg 420f81ebcd Move contact migrate code from message.js to contact.js 2018-05-08 09:48:47 -07:00
Scott Nonnenberg 3ea3e4e256 Contact sharing: protos and data pipeline
As of this commit: 82b76ccf37
2018-05-07 19:09:55 -07:00
Daniel Gasienica 1dd87ad197 Format all source code using Prettier 2018-04-30 16:53:34 -04:00
Daniel Gasienica f36f206a01 Use `IndexablePresence` for `hasFileAttachments` and `hasVisualMediaAttachments`
Reduces index size, makes it easier to debug using IndexedDB inspector, and
hopefully improves lookup performance.
2018-04-25 15:25:12 -04:00
Daniel Gasienica 8b9516de72 Update test for attachment metadata 2018-04-25 15:24:52 -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 867bece952 Add `Message.initializeAttachmentMetadata` 2018-04-25 15:24:50 -04:00
Scott Nonnenberg bf81c3db63
Document Message v4, remove data-free thumbnails 2018-04-23 16:43:25 -07:00
Scott Nonnenberg a7d44d3344
Backup and end-to-end test! 2018-04-20 15:24:04 -07:00
Scott Nonnenberg 9ad55c803f
Fix handling attachment thumbnails using thumbnail key 2018-04-13 18:10:51 -07:00
Scott Nonnenberg fce9bb7342
Move to central MIME functions, remove some console.log
And generally address PR feedback.
2018-04-13 18:10:51 -07:00
Scott Nonnenberg 054d3887a1
Quotes: The full pipeline into the database
1. MessageReceiver always pulls down thumbnails included in quotes
2. Message.upgradeSchema has a new schema that puts all thumbnails on
   disk just like happens with full attachments.
3. handleDataMessage pipes quote from dataMessage into the final message
   destined for the database
2018-04-13 18:05:45 -07:00
Daniel Gasienica 24f4ad53bc Use single quotes for identifiers 2018-04-11 15:54:32 -04:00
Daniel Gasienica 4c4443390a Rename `createImporter` to `createAttachmentDataWriter` 2018-04-04 19:11:46 -04:00
Daniel Gasienica bf67254cc5 Add `Message.createImporter` 2018-04-04 18:41:50 -04:00
Daniel Gasienica efd673083d Rename `writeAttachmentData` to `writeNewAttachmentData` 2018-04-04 18:41:50 -04:00
Daniel Gasienica 867f73b80a Use double quotes for identifiers in error messages 2018-03-26 16:38:34 -04:00
Daniel Gasienica 06e7bca276 Use new `stringToArrayBuffer` function 2018-03-26 16:38:34 -04:00
Daniel Gasienica 2cd3d5ac16 Add `Message` schema version 3 2018-03-26 16:38:34 -04:00
Daniel Gasienica 8dfaa5619f Prefix private functions with underscore 2018-03-19 19:27:59 -04:00
Daniel Gasienica ed336d31d7 Move schema versioning from `Attachment` to `Message` 2018-03-19 19:27:59 -04:00
Daniel Gasienica b9e9f5e19a 🎨 `withInheritedSchemaVersion` to `inheritSchemaVersion` 2018-03-19 19:27:59 -04:00
Daniel Gasienica c27746b79e Add `Message.withInheritedSchemaVersion` 2018-03-19 19:27:59 -04:00