Fix unread message status in received messages

This commit is contained in:
Mikołaj Pich 2019-11-14 23:25:36 +01:00
parent 059420bb0a
commit 1f486e99c2
No known key found for this signature in database
GPG key ID: F62B26E36D4C4BAA

View file

@ -13,15 +13,15 @@ fun List<ApiMessage>.mapMessages(): List<Message> {
id = it.messageId,
sender = it.senderName,
unreadBy = it.unread?.toInt(),
unread = it.readDateTime == null,
unread = it.folder == "Odebrane" && it.readDateTime == null,
senderId = it.senderId,
removed = it.status == "Usunieta",
recipient = it.recipients?.joinToString(", ") { recipient -> recipient.name.normalizeRecipient() },
readBy = it.read?.toInt(),
messageId = it.messageId,
folderId = when {
it.folder == "Odebrane" -> 1
it.folder == "Wyslane" -> 2
folderId = when (it.folder) {
"Odebrane" -> 1
"Wyslane" -> 2
else -> 1
},
content = it.content,