You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey Valerian. I’ve tried to send a MessagesUpdated event when the last read message changes after calling markAsRead(). This way the “New messages” indicator will disappear immediately if a new message comes in. However…
When selecting a room, the “New messages” indicator will also disappear (almost) immediately
If the indicator is above the visible area, you won’t be able to see it, since it disappears too quickly
I also don’t think that the indicator should disappear when you’ve selected a room and receive a new message, since that event is outside of your control. You might be scrolling back to catch up with the conversation and suddenly the marker goes away.
I would suggest to insert the “New messages” indicator when a room is selected. Then only remove it if…
The user sends a message from the selected room (possibly - imagine a "I'm back, now reading back old messages" message)
The user selects another room and comes back - unless there were new messages received in the meantime
As such I would suggest the following:
The coredoes not send a MessagesUpdated event when the lastRead message changes
The frontend continues to call markAsRead() after selecting a room, after receiving a message while the room is selected and (new) after sending a message if the room is selected (Update: Not needed anymore, since sent messages should always be displayed as read)
The frontend will remove the “New messages” indicator by setting the isLastRead of the last read message to false and setting it to true for the last message in the room when the user navigates away. If a MessagesAppended event is fired while a room is not selected the "New messages" indicator should be shown again above the first appended message when the user navigates back to the room - this could be done by checking if the last message in the room has the isLastRead flag set.
Edit: As discussed, messages from the current user should always be marked as read. This means that when inserting the unread indicator after the last read message, you need to check for any subsequent messages from the same user. If such messages exist, the unread indicator should be placed after these consecutive messages.
The text was updated successfully, but these errors were encountered:
Hey Valerian. I’ve tried to send a
MessagesUpdated
event when the last read message changes after callingmarkAsRead()
. This way the “New messages” indicator will disappear immediately if a new message comes in. However…I also don’t think that the indicator should disappear when you’ve selected a room and receive a new message, since that event is outside of your control. You might be scrolling back to catch up with the conversation and suddenly the marker goes away.
I would suggest to insert the “New messages” indicator when a room is selected. Then only remove it if…
As such I would suggest the following:
MessagesUpdated
event when thelastRead
message changesmarkAsRead()
after selecting a room, after receiving a message while the room is selectedand (new) after sending a message if the room is selected(Update: Not needed anymore, since sent messages should always be displayed as read)isLastRead
of the last read message tofalse
and setting it totrue
for the last message in the room when the user navigates away. If aMessagesAppended
event is fired while a room is not selected the "New messages" indicator should be shown again above the first appended message when the user navigates back to the room - this could be done by checking if the last message in the room has theisLastRead
flag set.Edit: As discussed, messages from the current user should always be marked as read. This means that when inserting the unread indicator after the last read message, you need to check for any subsequent messages from the same user. If such messages exist, the unread indicator should be placed after these consecutive messages.
The text was updated successfully, but these errors were encountered: