mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-28 01:24:03 +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,18 +2352,25 @@ class ChatController(args: Bundle) :
|
||||||
private fun updateReadStatusOfAllMessages(xChatLastCommonRead: Int?) {
|
private fun updateReadStatusOfAllMessages(xChatLastCommonRead: Int?) {
|
||||||
for (message in adapter!!.items) {
|
for (message in adapter!!.items) {
|
||||||
xChatLastCommonRead?.let {
|
xChatLastCommonRead?.let {
|
||||||
|
updateReadStatusOfMessage(message, it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateReadStatusOfMessage(
|
||||||
|
message: MessagesListAdapter<IMessage>.Wrapper<Any>,
|
||||||
|
xChatLastCommonRead: Int
|
||||||
|
) {
|
||||||
if (message.item is ChatMessage) {
|
if (message.item is ChatMessage) {
|
||||||
val chatMessage = message.item as ChatMessage
|
val chatMessage = message.item as ChatMessage
|
||||||
|
|
||||||
if (chatMessage.jsonMessageId <= it) {
|
if (chatMessage.jsonMessageId <= xChatLastCommonRead) {
|
||||||
chatMessage.readStatus = ReadStatus.READ
|
chatMessage.readStatus = ReadStatus.READ
|
||||||
} else {
|
} else {
|
||||||
chatMessage.readStatus = ReadStatus.SENT
|
chatMessage.readStatus = ReadStatus.SENT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun processMessagesFromTheFuture(chatMessageList: List<ChatMessage>) {
|
private fun processMessagesFromTheFuture(chatMessageList: List<ChatMessage>) {
|
||||||
var chatMessage: ChatMessage
|
var chatMessage: ChatMessage
|
||||||
|
|
Loading…
Reference in a new issue