Fixed message reading
This commit is contained in:
parent
76a9e2c043
commit
63990f6d57
@ -45,16 +45,19 @@ public class Chat implements Serializable {
|
|||||||
public void appendMessage(Message message) { model.add(message); }
|
public void appendMessage(Message message) { model.add(message); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the status of all chat messages to {@code READ} starting from the bottom
|
* Sets the status of all chat messages received from the recipient to
|
||||||
* and stopping once a read message is found.
|
* {@code READ} starting from the bottom and stopping once a read message is
|
||||||
|
* found.
|
||||||
*
|
*
|
||||||
* @since Envoy v0.3-alpha
|
* @since Envoy v0.3-alpha
|
||||||
*/
|
*/
|
||||||
public void read() {
|
public void read() {
|
||||||
for (int i = model.size() - 1; i >= 0; --i)
|
for (int i = model.size() - 1; i >= 0; --i)
|
||||||
|
if (model.get(i).getSenderId() == recipient.getId()) {
|
||||||
if (model.get(i).getStatus() == MessageStatus.READ) break;
|
if (model.get(i).getStatus() == MessageStatus.READ) break;
|
||||||
else model.get(i).setStatus(MessageStatus.READ);
|
else model.get(i).setStatus(MessageStatus.READ);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return all messages in the current chat
|
* @return all messages in the current chat
|
||||||
|
Reference in New Issue
Block a user