2018-04-06 21:51:52 +00:00
|
|
|
Placeholder component:
|
2018-04-05 16:19:00 +00:00
|
|
|
|
2018-04-03 22:56:12 +00:00
|
|
|
```jsx
|
2018-04-05 19:41:48 +00:00
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-04-03 22:56:12 +00:00
|
|
|
<Message />
|
2018-04-05 19:41:48 +00:00
|
|
|
</util.ConversationContext>
|
2018-04-03 22:56:12 +00:00
|
|
|
```
|
2018-04-05 16:19:00 +00:00
|
|
|
|
2018-04-06 21:51:52 +00:00
|
|
|
## MessageView (Backbone)
|
2018-04-05 16:19:00 +00:00
|
|
|
|
2018-04-06 21:51:52 +00:00
|
|
|
### Plain messages
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
body: 'How are you doing this fine day?',
|
|
|
|
sent_at: Date.now() - 18000,
|
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-06 21:51:52 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-06 21:51:52 +00:00
|
|
|
```
|
|
|
|
|
2018-04-14 01:01:02 +00:00
|
|
|
### In a group conversation
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
body: 'How are you doing this fine day?',
|
2018-04-17 01:17:38 +00:00
|
|
|
sent_at: Date.now() - 200000,
|
2018-04-14 01:01:02 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-14 01:01:02 +00:00
|
|
|
const View = Whisper.MessageView;
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.ConversationContext theme={util.theme} type="group">
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-14 01:01:02 +00:00
|
|
|
```
|
|
|
|
|
2018-04-17 01:17:38 +00:00
|
|
|
### With an error
|
|
|
|
|
|
|
|
#### General error
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const error = new Error('Something went wrong!');
|
|
|
|
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
body: "This message won't get through...",
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
errors: [error],
|
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
body: null,
|
|
|
|
})
|
|
|
|
);
|
2018-04-17 01:17:38 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-17 01:17:38 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Network error (outgoing only)
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const error = new Error('Something went wrong!');
|
|
|
|
error.name = 'MessageError';
|
|
|
|
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
errors: [error],
|
|
|
|
body: "This message won't get through...",
|
|
|
|
});
|
|
|
|
const View = Whisper.MessageView;
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.ConversationContext theme={util.theme} type="group">
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-17 01:17:38 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Network error, partial send in group (outgoing only)
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const error = new Error('Something went wrong!');
|
|
|
|
error.name = 'MessageError';
|
|
|
|
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
errors: [error],
|
|
|
|
conversationId: util.groupNumber,
|
|
|
|
body: "This message won't get through...",
|
|
|
|
});
|
|
|
|
const View = Whisper.MessageView;
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.ConversationContext theme={util.theme} type="group">
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-17 01:17:38 +00:00
|
|
|
```
|
|
|
|
|
2018-04-24 02:16:00 +00:00
|
|
|
#### No message contents
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-24 02:16:00 +00:00
|
|
|
|
|
|
|
const View = Whisper.MessageView;
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-24 02:16:00 +00:00
|
|
|
```
|
|
|
|
|
2018-04-17 01:17:38 +00:00
|
|
|
### Disappearing
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
expireTimer: 120,
|
|
|
|
expirationStartTimestamp: Date.now() - 1000,
|
|
|
|
body: 'This message will self-destruct in two minutes',
|
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-17 01:17:38 +00:00
|
|
|
|
|
|
|
const View = Whisper.MessageView;
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-17 01:17:38 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Notfications
|
|
|
|
|
|
|
|
#### Timer change
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const fromOther = new Whisper.Message({
|
|
|
|
type: 'incoming',
|
|
|
|
flags: textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
|
|
|
|
source: '+12025550003',
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
expireTimer: 120,
|
|
|
|
expirationStartTimestamp: Date.now() - 1000,
|
|
|
|
expirationTimerUpdate: {
|
|
|
|
source: '+12025550003',
|
2018-05-01 22:37:21 +00:00
|
|
|
},
|
2018-04-17 01:17:38 +00:00
|
|
|
});
|
|
|
|
const fromUpdate = new Whisper.Message({
|
|
|
|
type: 'incoming',
|
|
|
|
flags: textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
|
|
|
|
source: util.ourNumber,
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
expireTimer: 120,
|
|
|
|
expirationStartTimestamp: Date.now() - 1000,
|
|
|
|
expirationTimerUpdate: {
|
|
|
|
fromSync: true,
|
|
|
|
source: util.ourNumber,
|
2018-05-01 22:37:21 +00:00
|
|
|
},
|
2018-04-17 01:17:38 +00:00
|
|
|
});
|
|
|
|
const fromMe = new Whisper.Message({
|
|
|
|
type: 'incoming',
|
|
|
|
flags: textsecure.protobuf.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
|
|
|
|
source: util.ourNumber,
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
expireTimer: 120,
|
|
|
|
expirationStartTimestamp: Date.now() - 1000,
|
|
|
|
expirationTimerUpdate: {
|
|
|
|
source: util.ourNumber,
|
2018-05-01 22:37:21 +00:00
|
|
|
},
|
2018-04-17 01:17:38 +00:00
|
|
|
});
|
|
|
|
const View = Whisper.ExpirationTimerUpdateView;
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: fromOther }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: fromUpdate }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: fromMe }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-17 01:17:38 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Safety number change
|
|
|
|
|
|
|
|
```js
|
|
|
|
const incoming = new Whisper.Message({
|
|
|
|
type: 'keychange',
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
key_changed: '+12025550003',
|
|
|
|
});
|
|
|
|
const View = Whisper.KeyChangeView;
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-17 01:17:38 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Marking as verified
|
|
|
|
|
|
|
|
```js
|
|
|
|
const fromPrimary = new Whisper.Message({
|
|
|
|
type: 'verified-change',
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
verifiedChanged: '+12025550003',
|
|
|
|
verified: true,
|
|
|
|
});
|
|
|
|
const local = new Whisper.Message({
|
|
|
|
type: 'verified-change',
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
verifiedChanged: '+12025550003',
|
|
|
|
local: true,
|
|
|
|
verified: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
const View = Whisper.VerifiedChangeView;
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: fromPrimary }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: local }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-17 01:17:38 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Marking as not verified
|
|
|
|
|
|
|
|
```js
|
|
|
|
const fromPrimary = new Whisper.Message({
|
|
|
|
type: 'verified-change',
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
verifiedChanged: '+12025550003',
|
|
|
|
});
|
|
|
|
const local = new Whisper.Message({
|
|
|
|
type: 'verified-change',
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
verifiedChanged: '+12025550003',
|
|
|
|
local: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
const View = Whisper.VerifiedChangeView;
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: fromPrimary }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: local }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-17 01:17:38 +00:00
|
|
|
```
|
|
|
|
|
2018-04-24 02:16:00 +00:00
|
|
|
#### Group update
|
|
|
|
|
|
|
|
```js
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
group_update: {
|
2018-05-01 22:37:21 +00:00
|
|
|
joined: ['+12025550007', '+12025550008', '+12025550009'],
|
2018-04-24 02:16:00 +00:00
|
|
|
},
|
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-24 02:16:00 +00:00
|
|
|
|
|
|
|
const View = Whisper.MessageView;
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-24 02:16:00 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### End session
|
|
|
|
|
|
|
|
```js
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 200000,
|
|
|
|
flags: textsecure.protobuf.DataMessage.Flags.END_SESSION,
|
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-24 02:16:00 +00:00
|
|
|
|
|
|
|
const View = Whisper.MessageView;
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-24 02:16:00 +00:00
|
|
|
```
|
|
|
|
|
2018-04-06 21:51:52 +00:00
|
|
|
### With an attachment
|
|
|
|
|
2018-04-07 00:50:29 +00:00
|
|
|
#### Image with caption
|
2018-04-05 16:19:00 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
body: 'I am pretty confused about Pi.',
|
|
|
|
sent_at: Date.now() - 18000000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
data: util.gif,
|
|
|
|
fileName: 'pi.gif',
|
|
|
|
contentType: 'image/gif',
|
|
|
|
},
|
|
|
|
],
|
2018-04-05 16:19:00 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-05 16:19:00 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-05 16:19:00 +00:00
|
|
|
```
|
|
|
|
|
2018-04-07 00:50:29 +00:00
|
|
|
#### Image
|
2018-04-06 21:51:52 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 18000000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
data: util.gif,
|
|
|
|
fileName: 'pi.gif',
|
|
|
|
contentType: 'image/gif',
|
|
|
|
},
|
|
|
|
],
|
2018-04-06 21:51:52 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-06 21:51:52 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-06 21:51:52 +00:00
|
|
|
```
|
|
|
|
|
2018-04-16 23:23:05 +00:00
|
|
|
#### Image with portrait aspect ratio
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 18000000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
data: util.portraitYellow,
|
|
|
|
fileName: 'portraitYellow.png',
|
|
|
|
contentType: 'image/png',
|
|
|
|
},
|
|
|
|
],
|
2018-04-16 23:23:05 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-16 23:23:05 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-16 23:23:05 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Image with portrait aspect ratio and caption
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
body: 'This is an odd yellow bar. Cool, huh?',
|
|
|
|
sent_at: Date.now() - 18000000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
data: util.portraitYellow,
|
|
|
|
fileName: 'portraitYellow.png',
|
|
|
|
contentType: 'image/png',
|
|
|
|
},
|
|
|
|
],
|
2018-04-16 23:23:05 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-16 23:23:05 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-16 23:23:05 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Image with landscape aspect ratio
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 18000000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
data: util.landscapePurple,
|
|
|
|
fileName: 'landscapePurple.jpg',
|
|
|
|
contentType: 'image/jpeg',
|
|
|
|
},
|
|
|
|
],
|
2018-04-16 23:23:05 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-16 23:23:05 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-16 23:23:05 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Image with landscape aspect ratio and caption
|
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
body: "An interesting horizontal bar. It's art.",
|
|
|
|
sent_at: Date.now() - 18000000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
data: util.landscapePurple,
|
|
|
|
fileName: 'landscapePurple.jpg',
|
|
|
|
contentType: 'image/jpeg',
|
|
|
|
},
|
|
|
|
],
|
2018-04-16 23:23:05 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-16 23:23:05 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-16 23:23:05 +00:00
|
|
|
```
|
|
|
|
|
2018-04-07 00:50:29 +00:00
|
|
|
#### Video with caption
|
2018-04-06 21:51:52 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
body: "Beautiful, isn't it?",
|
|
|
|
sent_at: Date.now() - 10000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
data: util.mp4,
|
|
|
|
fileName: 'freezing_bubble.mp4',
|
|
|
|
contentType: 'video/mp4',
|
|
|
|
},
|
|
|
|
],
|
2018-04-06 21:51:52 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-06 21:51:52 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-06 21:51:52 +00:00
|
|
|
```
|
|
|
|
|
2018-04-07 00:50:29 +00:00
|
|
|
#### Video
|
2018-04-05 16:19:00 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 10000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
data: util.mp4,
|
|
|
|
fileName: 'freezing_bubble.mp4',
|
|
|
|
contentType: 'video/mp4',
|
|
|
|
},
|
|
|
|
],
|
2018-04-05 16:19:00 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-05 16:19:00 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-05 16:19:00 +00:00
|
|
|
```
|
|
|
|
|
2018-04-07 00:50:29 +00:00
|
|
|
#### Audio with caption
|
2018-04-05 16:19:00 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
body: 'This is a nice song',
|
|
|
|
sent_at: Date.now() - 15000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
data: util.mp3,
|
|
|
|
fileName: 'agnus_dei.mp3',
|
|
|
|
contentType: 'audio/mp3',
|
|
|
|
},
|
|
|
|
],
|
2018-04-05 16:19:00 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-05 16:19:00 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-05 16:19:00 +00:00
|
|
|
```
|
|
|
|
|
2018-04-07 00:50:29 +00:00
|
|
|
#### Audio
|
2018-04-06 21:51:52 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 15000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
data: util.mp3,
|
|
|
|
fileName: 'agnus_dei.mp3',
|
|
|
|
contentType: 'audio/mp3',
|
|
|
|
},
|
|
|
|
],
|
2018-04-06 21:51:52 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-06 21:51:52 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-06 21:51:52 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
#### Voice message
|
2018-04-05 16:19:00 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 15000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
2018-05-07 16:52:27 +00:00
|
|
|
flags: SignalService.AttachmentPointer.Flags.VOICE_MESSAGE,
|
2018-05-01 22:37:21 +00:00
|
|
|
data: util.mp3,
|
|
|
|
fileName: 'agnus_dei.mp3',
|
|
|
|
contentType: 'audio/mp3',
|
|
|
|
},
|
|
|
|
],
|
2018-04-05 16:19:00 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-05 16:19:00 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-05 16:19:00 +00:00
|
|
|
```
|
|
|
|
|
2018-04-07 00:50:29 +00:00
|
|
|
#### Other file type with caption
|
2018-04-05 16:19:00 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
body: 'My manifesto is now complete!',
|
|
|
|
sent_at: Date.now() - 15000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
data: util.txt,
|
|
|
|
fileName: 'lorum_ipsum.txt',
|
|
|
|
contentType: 'text/plain',
|
|
|
|
},
|
|
|
|
],
|
2018-04-05 16:19:00 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-05 16:19:00 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-05 16:19:00 +00:00
|
|
|
```
|
2018-04-06 21:51:52 +00:00
|
|
|
|
2018-04-07 00:50:29 +00:00
|
|
|
#### Other file type
|
2018-04-06 21:51:52 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 15000,
|
2018-05-01 22:37:21 +00:00
|
|
|
attachments: [
|
|
|
|
{
|
|
|
|
data: util.txt,
|
|
|
|
fileName: 'lorum_ipsum.txt',
|
|
|
|
contentType: 'text/plain',
|
|
|
|
},
|
|
|
|
],
|
2018-04-06 21:51:52 +00:00
|
|
|
});
|
2018-05-01 22:37:21 +00:00
|
|
|
const incoming = new Whisper.Message(
|
|
|
|
Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
})
|
|
|
|
);
|
2018-04-06 21:51:52 +00:00
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
2018-05-01 22:37:21 +00:00
|
|
|
<util.BackboneWrapper View={View} options={{ model: incoming }} />
|
|
|
|
<util.BackboneWrapper View={View} options={{ model: outgoing }} />
|
|
|
|
</util.ConversationContext>;
|
2018-04-06 21:51:52 +00:00
|
|
|
```
|