diff --git a/app/containers/message/index.js b/app/containers/message/index.js
index 941ec7591..3a07104e9 100644
--- a/app/containers/message/index.js
+++ b/app/containers/message/index.js
@@ -33,7 +33,8 @@ const styles = StyleSheet.create({
@connect(state => ({
message: state.messages.message,
- editing: state.messages.editing
+ editing: state.messages.editing,
+ server: state.server.server
}), dispatch => ({
actionsShow: actionMessage => dispatch(actionsShow(actionMessage))
}))
@@ -44,7 +45,8 @@ export default class Message extends React.Component {
Message_TimeFormat: PropTypes.string.isRequired,
message: PropTypes.object.isRequired,
editing: PropTypes.bool,
- actionsShow: PropTypes.func
+ actionsShow: PropTypes.func,
+ server: PropTypes.string
}
onLongPress() {
@@ -57,11 +59,24 @@ export default class Message extends React.Component {
}
attachments() {
- return this.props.item.attachments.length ? (
-
- ) : null;
+ if (this.props.item.attachments.length === 0) {
+ return null;
+ }
+
+ const file = this.props.item.attachments[0];
+ if (file.image_type) {
+ return (
+
+ );
+ } else if (file.audio_type) {
+ return {`${ this.props.server }${ JSON.parse(JSON.stringify(file.audio_url)) }`};
+ } else if (file.video_type) {
+ return {`${ this.props.server }${ JSON.parse(JSON.stringify(file.video_url)) }`};
+ }
+
+ return Other type;
}
renderMessageContent() {
diff --git a/app/lib/realm.js b/app/lib/realm.js
index 10340ce0d..bbff21638 100644
--- a/app/lib/realm.js
+++ b/app/lib/realm.js
@@ -99,14 +99,16 @@ const attachment = {
name: 'attachment',
properties: {
description: { type: 'string', optional: true },
-
image_size: { type: 'int', optional: true },
-
image_type: { type: 'string', optional: true },
-
image_url: { type: 'string', optional: true },
+ audio_size: { type: 'int', optional: true },
+ audio_type: { type: 'string', optional: true },
+ audio_url: { type: 'string', optional: true },
+ video_size: { type: 'int', optional: true },
+ video_type: { type: 'string', optional: true },
+ video_url: { type: 'string', optional: true },
title: { type: 'string', optional: true },
-
title_link: { type: 'string', optional: true },
title_link_download: { type: 'bool', optional: true },
type: { type: 'string', optional: true }