Added Chat#isUnread() for future use in message notifications

This commit is contained in:
Kai S. K. Engelbart 2020-02-03 22:06:56 +01:00
parent d43b45d36b
commit 7e0ae2e831
2 changed files with 13 additions and 0 deletions

View File

@ -59,6 +59,13 @@ public class Chat implements Serializable {
}
}
/**
* @return {@code true} if the newest message received in the chat doesn't have
* the status {@code READ}
* @since Envoy v0.3-alpha
*/
public boolean isUnread() { return !model.isEmpty() && model.get(model.size() - 1).getStatus() != MessageStatus.READ; }
/**
* @return all messages in the current chat
* @since Envoy v0.1-alpha

View File

@ -78,6 +78,12 @@ public final class ComponentListModel<E> implements Iterable<E>, Serializable {
*/
public int size() { return elements.size(); }
/**
* @return {@code true} if this model contains no elements
* @see java.util.List#isEmpty()
*/
public boolean isEmpty() { return elements.isEmpty(); }
/**
* @return an iterator over the elements of this list model
* @see java.util.List#iterator()