2018-04-03 22:56:12 +00:00
|
|
|
|
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,
|
|
|
|
});
|
|
|
|
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
2018-04-12 23:58:44 +00:00
|
|
|
source: '+12025550003',
|
2018-04-06 21:51:52 +00:00
|
|
|
type: 'incoming',
|
|
|
|
}));
|
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: incoming }}
|
|
|
|
/>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: outgoing }}
|
|
|
|
/>
|
|
|
|
</util.ConversationContext>
|
|
|
|
```
|
|
|
|
|
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?',
|
|
|
|
sent_at: Date.now() - 18000,
|
|
|
|
});
|
|
|
|
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
|
|
|
source: '+12025550003',
|
|
|
|
type: 'incoming',
|
|
|
|
}));
|
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<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-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,
|
|
|
|
attachments: [{
|
|
|
|
data: util.gif,
|
|
|
|
fileName: 'pi.gif',
|
|
|
|
contentType: 'image/gif',
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
2018-04-12 23:58:44 +00:00
|
|
|
source: '+12025550003',
|
2018-04-05 16:19:00 +00:00
|
|
|
type: 'incoming',
|
|
|
|
}));
|
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: incoming }}
|
|
|
|
/>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: outgoing }}
|
|
|
|
/>
|
|
|
|
</util.ConversationContext>
|
|
|
|
```
|
|
|
|
|
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,
|
|
|
|
attachments: [{
|
|
|
|
data: util.gif,
|
|
|
|
fileName: 'pi.gif',
|
|
|
|
contentType: 'image/gif',
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
2018-04-12 23:58:44 +00:00
|
|
|
source: '+12025550003',
|
2018-04-06 21:51:52 +00:00
|
|
|
type: 'incoming',
|
|
|
|
}));
|
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: incoming }}
|
|
|
|
/>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: outgoing }}
|
|
|
|
/>
|
|
|
|
</util.ConversationContext>
|
|
|
|
```
|
|
|
|
|
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,
|
|
|
|
attachments: [{
|
|
|
|
data: util.mp4,
|
|
|
|
fileName: 'freezing_bubble.mp4',
|
|
|
|
contentType: 'video/mp4',
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
2018-04-12 23:58:44 +00:00
|
|
|
source: '+12025550003',
|
2018-04-06 21:51:52 +00:00
|
|
|
type: 'incoming',
|
|
|
|
}));
|
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: incoming }}
|
|
|
|
/>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: outgoing }}
|
|
|
|
/>
|
|
|
|
</util.ConversationContext>
|
|
|
|
```
|
|
|
|
|
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,
|
|
|
|
attachments: [{
|
|
|
|
data: util.mp4,
|
|
|
|
fileName: 'freezing_bubble.mp4',
|
|
|
|
contentType: 'video/mp4',
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
2018-04-12 23:58:44 +00:00
|
|
|
source: '+12025550003',
|
2018-04-05 16:19:00 +00:00
|
|
|
type: 'incoming',
|
|
|
|
}));
|
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: incoming }}
|
|
|
|
/>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: outgoing }}
|
|
|
|
/>
|
|
|
|
</util.ConversationContext>
|
|
|
|
```
|
|
|
|
|
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,
|
|
|
|
attachments: [{
|
|
|
|
data: util.mp3,
|
|
|
|
fileName: 'agnus_dei.mp3',
|
|
|
|
contentType: 'audio/mp3',
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
2018-04-12 23:58:44 +00:00
|
|
|
source: '+12025550003',
|
2018-04-05 16:19:00 +00:00
|
|
|
type: 'incoming',
|
|
|
|
}));
|
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: incoming }}
|
|
|
|
/>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: outgoing }}
|
|
|
|
/>
|
|
|
|
</util.ConversationContext>
|
|
|
|
```
|
|
|
|
|
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,
|
|
|
|
attachments: [{
|
|
|
|
data: util.mp3,
|
|
|
|
fileName: 'agnus_dei.mp3',
|
|
|
|
contentType: 'audio/mp3',
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
2018-04-12 23:58:44 +00:00
|
|
|
source: '+12025550003',
|
2018-04-06 21:51:52 +00:00
|
|
|
type: 'incoming',
|
|
|
|
}));
|
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: incoming }}
|
|
|
|
/>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: outgoing }}
|
|
|
|
/>
|
|
|
|
</util.ConversationContext>
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Voice message
|
2018-04-05 16:19:00 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 15000,
|
|
|
|
attachments: [{
|
|
|
|
flags: textsecure.protobuf.AttachmentPointer.Flags.VOICE_MESSAGE,
|
|
|
|
data: util.mp3,
|
|
|
|
fileName: 'agnus_dei.mp3',
|
|
|
|
contentType: 'audio/mp3',
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
2018-04-12 23:58:44 +00:00
|
|
|
source: '+12025550003',
|
2018-04-05 16:19:00 +00:00
|
|
|
type: 'incoming',
|
|
|
|
}));
|
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: incoming }}
|
|
|
|
/>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: outgoing }}
|
|
|
|
/>
|
|
|
|
</util.ConversationContext>
|
|
|
|
```
|
|
|
|
|
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,
|
|
|
|
attachments: [{
|
|
|
|
data: util.txt,
|
|
|
|
fileName: 'lorum_ipsum.txt',
|
|
|
|
contentType: 'text/plain',
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
2018-04-12 23:58:44 +00:00
|
|
|
source: '+12025550003',
|
2018-04-05 16:19:00 +00:00
|
|
|
type: 'incoming',
|
|
|
|
}));
|
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<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
|
|
|
#### Other file type
|
2018-04-06 21:51:52 +00:00
|
|
|
|
|
|
|
```jsx
|
|
|
|
const outgoing = new Whisper.Message({
|
|
|
|
type: 'outgoing',
|
|
|
|
sent_at: Date.now() - 15000,
|
|
|
|
attachments: [{
|
|
|
|
data: util.txt,
|
|
|
|
fileName: 'lorum_ipsum.txt',
|
|
|
|
contentType: 'text/plain',
|
|
|
|
}],
|
|
|
|
});
|
|
|
|
const incoming = new Whisper.Message(Object.assign({}, outgoing.attributes, {
|
2018-04-12 23:58:44 +00:00
|
|
|
source: '+12025550003',
|
2018-04-06 21:51:52 +00:00
|
|
|
type: 'incoming',
|
|
|
|
}));
|
|
|
|
const View = Whisper.MessageView;
|
|
|
|
<util.ConversationContext theme={util.theme}>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: incoming }}
|
|
|
|
/>
|
|
|
|
<util.BackboneWrapper
|
|
|
|
View={View}
|
|
|
|
options={{ model: outgoing }}
|
|
|
|
/>
|
|
|
|
</util.ConversationContext>
|
|
|
|
```
|