Applozic : How to show the user first unread message rather than latest unread message?

414 views Asked by At

This is a question w.r.t a chat app developed using applozic sdk. Currently in the chat detail page, the latest conversation is loaded. But I want to show the unread message that arrived first rather than the latest message arrived. How can it be achieved ?

2

There are 2 answers

0
Shivam Pokhriyal On

What you can do is, when you are opening the chat details, you must be having something called, unread count which would indicate the number of messages that haven't been read yet, correct. So you can use this value to scroll your list to that particular message rather than scrolling to bottom.

0
DragonFire On

You can use this in onChildAdded, by getting the unSeenMessageCount as an int

if (unSeenMessageCount == 0) {

    rvChat.scrollToPosition(chatsAdapter.getItemCount() - 1);

} else {

    rvChat.scrollToPosition(chatsAdapter.getItemCount() - unSeenMessageCount);
}