start handling MESSAGE_STATUS_FAILED

This commit is contained in:
or-else
2018-10-06 12:44:24 +03:00
parent c52b661c87
commit da24e28a92
+14 -7
View File
@@ -3619,19 +3619,26 @@ class ChatMessage extends React.Component {
/* Received/read indicator */ /* Received/read indicator */
class ReceivedMarker extends React.PureComponent { class ReceivedMarker extends React.PureComponent {
render() { render() {
var timestamp = (this.props.received <= Tinode.MESSAGE_STATUS_SENDING) ? let timestamp;
"sending ..." : if (this.props.received <= Tinode.MESSAGE_STATUS_SENDING) {
shortDateFormat(this.props.timestamp); timestamp = "sending ...";
} else if (this.props.received == Tinode.MESSAGE_STATUS_FAILED) {
timestamp = "failed";
} else {
timestamp = shortDateFormat(this.props.timestamp);
}
var marker = null; let marker = null;
if (this.props.received <= Tinode.MESSAGE_STATUS_SENDING) { if (this.props.received <= Tinode.MESSAGE_STATUS_SENDING) {
marker = (<i className="material-icons small">access_time</i>); // watch face marker = (<i className="material-icons small">access_time</i>); // watch face
} else if (this.props.received == Tinode.MESSAGE_STATUS_FAILED) {
marker = (<i className="material-icons small red">error_outline</i>); // icon (!)
} else if (this.props.received == Tinode.MESSAGE_STATUS_SENT) { } else if (this.props.received == Tinode.MESSAGE_STATUS_SENT) {
marker = (<i className="material-icons small">done</i>); // checkmark marker = (<i className="material-icons small">done</i>); // checkmark
} else if (this.props.received == Tinode.MESSAGE_STATUS_RECEIVED) { } else if (this.props.received == Tinode.MESSAGE_STATUS_RECEIVED) {
marker = (<i className="material-icons small">done_all</i>); // double checkmark marker = (<i className="material-icons small">done_all</i>); // double checkmark
} else if (this.props.received == Tinode.MESSAGE_STATUS_READ) { } else if (this.props.received == Tinode.MESSAGE_STATUS_READ) {
marker = (<i className="material-icons small blue">done_all</i>); // open eye marker = (<i className="material-icons small blue">done_all</i>); // blue double checkmark
} }
return ( return (
@@ -4004,7 +4011,7 @@ class MessagesView extends React.Component {
newState.scrollPosition = 0; newState.scrollPosition = 0;
} }
// Aknowledge all messages, including own messges. // Aknowledge all messages, including own messages.
let status = topic.msgStatus(msg); let status = topic.msgStatus(msg);
if (status >= Tinode.MESSAGE_STATUS_SENT) { if (status >= Tinode.MESSAGE_STATUS_SENT) {
this.props.readTimerHandler(() => { this.props.readTimerHandler(() => {
@@ -4979,7 +4986,7 @@ class TinodeWeb extends React.Component {
// Sending "received" notifications // Sending "received" notifications
tnData(data) { tnData(data) {
let topic = this.tinode.getTopic(data.topic); let topic = this.tinode.getTopic(data.topic);
if (topic.msgStatus(data) > Tinode.MESSAGE_STATUS_SENDING) { if (topic.msgStatus(data) >= Tinode.MESSAGE_STATUS_SENT) {
clearTimeout(this.receivedTimer); clearTimeout(this.receivedTimer);
this.receivedTimer = setTimeout(() => { this.receivedTimer = setTimeout(() => {
this.receivedTimer = undefined; this.receivedTimer = undefined;