diff --git a/app/containers/message/QuoteMark.js b/app/containers/message/QuoteMark.js
new file mode 100644
index 000000000..2c010c6e2
--- /dev/null
+++ b/app/containers/message/QuoteMark.js
@@ -0,0 +1,20 @@
+import React from 'react';
+import { View, StyleSheet } from 'react-native';
+import PropTypes from 'prop-types';
+
+const styles = StyleSheet.create({
+ quoteSign: {
+ borderWidth: 2,
+ borderRadius: 4,
+ height: '100%',
+ marginRight: 5
+ }
+});
+
+const QuoteMark = ({ color }) => ;
+
+QuoteMark.propTypes = {
+ color: PropTypes.string
+};
+
+export default QuoteMark;
diff --git a/app/containers/message/Reply.js b/app/containers/message/Reply.js
new file mode 100644
index 000000000..ba85751b7
--- /dev/null
+++ b/app/containers/message/Reply.js
@@ -0,0 +1,107 @@
+import React from 'react';
+import { View, Text, TouchableOpacity, StyleSheet, Linking } from 'react-native';
+import PropTypes from 'prop-types';
+import moment from 'moment';
+
+import Markdown from './Markdown';
+import QuoteMark from './QuoteMark';
+import Avatar from '../Avatar';
+
+const styles = StyleSheet.create({
+ button: {
+ flex: 1,
+ flexDirection: 'row',
+ alignItems: 'center',
+ marginTop: 2,
+ alignSelf: 'flex-end'
+ },
+ quoteSign: {
+ borderWidth: 2,
+ borderRadius: 4,
+ borderColor: '#a0a0a0',
+ height: '100%',
+ marginRight: 5
+ },
+ attachmentContainer: {
+ flex: 1,
+ flexDirection: 'column'
+ },
+ authorContainer: {
+ flexDirection: 'row',
+ alignItems: 'center'
+ },
+ avatar: {
+ margin: 2
+ },
+ time: {
+ fontSize: 10,
+ fontWeight: 'normal',
+ color: '#888',
+ marginLeft: 5
+ }
+});
+
+const onPress = (attachment) => {
+ const url = attachment.title_link || attachment.author_link;
+ if (!url) {
+ return;
+ }
+ Linking.openURL(attachment.title_link || attachment.author_link);
+};
+const Reply = ({ attachment, timeFormat }) => {
+ if (!attachment) {
+ return null;
+ }
+
+ const renderAvatar = () => {
+ if (!attachment.author_icon && !attachment.author_name) {
+ return null;
+ }
+ return (
+
+ );
+ };
+
+ const renderAuthor = () => (
+ attachment.author_name ? {attachment.author_name} : null
+ );
+
+ const renderTime = () => {
+ const time = attachment.ts ? moment(attachment.ts).format(timeFormat) : null;
+ return time ? { time } : null;
+ };
+
+ const renderText = () => (
+ attachment.text ? : null
+ );
+
+ return (
+ onPress(attachment)}
+ style={styles.button}
+ >
+
+
+
+
+ {renderAvatar()} {renderAuthor()} {renderTime()}
+
+
+ {renderText()}
+ {attachment.attachments.map(attach => )}
+
+
+ );
+};
+
+Reply.propTypes = {
+ attachment: PropTypes.object.isRequired,
+ timeFormat: PropTypes.string.isRequired
+};
+
+export default Reply;
diff --git a/app/containers/message/Url.js b/app/containers/message/Url.js
index cb5d4864b..bd930a53d 100644
--- a/app/containers/message/Url.js
+++ b/app/containers/message/Url.js
@@ -2,10 +2,11 @@ import React from 'react';
import { View, Text, TouchableOpacity, Linking, StyleSheet, Image } from 'react-native';
import PropTypes from 'prop-types';
+import QuoteMark from './QuoteMark';
+
const styles = StyleSheet.create({
button: {
flex: 1,
- height: 80,
flexDirection: 'row',
alignItems: 'center',
marginVertical: 2
@@ -49,7 +50,7 @@ const Url = ({ url }) => {
}
return (
onPress(url.url)} style={styles.button}>
-
+
;
}
- return Other type;
+ return ;
}
renderMessageContent() {
if (this.isDeleted()) {
return Message removed;
+ } else if (this.isPinned()) {
+ return Message pinned;
}
-
- return (
-
- );
+ return ;
}
renderUrl() {
@@ -130,8 +134,8 @@ export default class Message extends React.Component {
Message_TimeFormat={this.props.Message_TimeFormat}
baseUrl={this.props.baseUrl}
/>
- {this.attachments()}
{this.renderMessageContent()}
+ {this.attachments()}
{this.renderUrl()}
diff --git a/app/lib/realm.js b/app/lib/realm.js
index 4cf7c12b2..0e6d12439 100644
--- a/app/lib/realm.js
+++ b/app/lib/realm.js
@@ -111,7 +111,14 @@ const attachment = {
title: { type: 'string', optional: true },
title_link: { type: 'string', optional: true },
title_link_download: { type: 'bool', optional: true },
- type: { type: 'string', optional: true }
+ type: { type: 'string', optional: true },
+ author_icon: { type: 'string', optional: true },
+ author_name: { type: 'string', optional: true },
+ author_link: { type: 'string', optional: true },
+ text: { type: 'string', optional: true },
+ color: { type: 'string', optional: true },
+ ts: { type: 'date', optional: true },
+ attachments: { type: 'list', objectType: 'attachment' }
}
};
diff --git a/app/lib/rocketchat.js b/app/lib/rocketchat.js
index 9e7bf9144..74c439b83 100644
--- a/app/lib/rocketchat.js
+++ b/app/lib/rocketchat.js
@@ -265,6 +265,8 @@ const RocketChat = {
if (message.urls) {
message.urls = RocketChat._parseUrls(message.urls);
}
+ // loadHistory returns message.starred as object
+ // stream-room-messages returns message.starred as an array
message.starred = message.starred && (Array.isArray(message.starred) ? message.starred.length > 0 : !!message.starred);
return message;
},