mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-23 21:45:42 +03:00
Reduce nested block depth for updateReadStatusOfAllMessages
Signed-off-by: Tim Krüger <t@timkrueger.me>
This commit is contained in:
parent
57ddf9af60
commit
5bb63fd58d
1 changed files with 15 additions and 8 deletions
|
@ -2352,15 +2352,22 @@ class ChatController(args: Bundle) :
|
|||
private fun updateReadStatusOfAllMessages(xChatLastCommonRead: Int?) {
|
||||
for (message in adapter!!.items) {
|
||||
xChatLastCommonRead?.let {
|
||||
if (message.item is ChatMessage) {
|
||||
val chatMessage = message.item as ChatMessage
|
||||
updateReadStatusOfMessage(message, it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (chatMessage.jsonMessageId <= it) {
|
||||
chatMessage.readStatus = ReadStatus.READ
|
||||
} else {
|
||||
chatMessage.readStatus = ReadStatus.SENT
|
||||
}
|
||||
}
|
||||
private fun updateReadStatusOfMessage(
|
||||
message: MessagesListAdapter<IMessage>.Wrapper<Any>,
|
||||
xChatLastCommonRead: Int
|
||||
) {
|
||||
if (message.item is ChatMessage) {
|
||||
val chatMessage = message.item as ChatMessage
|
||||
|
||||
if (chatMessage.jsonMessageId <= xChatLastCommonRead) {
|
||||
chatMessage.readStatus = ReadStatus.READ
|
||||
} else {
|
||||
chatMessage.readStatus = ReadStatus.SENT
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue