private fun updateLastSeenMessageState(currentMessage: Message) { if (isInThread) { lastSeenThreadMessage = currentMessage  threadMessagesState = threadMessagesState.copy(unreadCount = getUnreadMessageCount()) } else { lastSeenChannelMessage = currentMessage  messagesState = messagesState.copy(unreadCount = getUnreadMessageCount()) }  val (channelType, id) = channelId.cidToTypeAndId()  val latestMessage: MessageItemState? = currentMessagesState.messageItems.firstOrNull { messageItem -> messageItem is MessageItemState } as? MessageItemState  if (currentMessage.id == latestMessage?.message?.id) { chatClient.markRead(channelType, id).enqueue() } }
Updates the state of the last seen message. Updates corresponding state based on [isInThread].