From f296269d931b9fa23cd4c6fe69f453d060bcd577 Mon Sep 17 00:00:00 2001 From: DenBond7 Date: Thu, 14 Nov 2024 16:10:19 +0200 Subject: [PATCH] Fixed a few bugs on the thread details screen.| #74 --- .../email/jetpack/viewmodel/ThreadDetailsViewModel.kt | 4 +++- .../email/ui/activity/fragment/ThreadDetailsFragment.kt | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ThreadDetailsViewModel.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ThreadDetailsViewModel.kt index dee851541..193da4935 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ThreadDetailsViewModel.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/jetpack/viewmodel/ThreadDetailsViewModel.kt @@ -464,7 +464,9 @@ class ThreadDetailsViewModel( candidatesToBeInserted.add(entity) } else if (existingVersion.copy(id = null) != entity) { candidatesToBeUpdated.add(entity.copy(id = existingVersion.id)) - MsgsCacheManager.removeMessage(existingVersion.id.toString()) + if (existingVersion.flags != entity.flags) { + MsgsCacheManager.removeMessage(existingVersion.id.toString()) + } } } val candidatesToBeDeleted = diff --git a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/ThreadDetailsFragment.kt b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/ThreadDetailsFragment.kt index 392c42c54..9041a702e 100644 --- a/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/ThreadDetailsFragment.kt +++ b/FlowCrypt/src/main/java/com/flowcrypt/email/ui/activity/fragment/ThreadDetailsFragment.kt @@ -879,7 +879,7 @@ class ThreadDetailsFragment : BaseFragment(), Prog private fun tryToOpenTheFreshestMessage(data: List) { if (isActive && data.size > 1) { - val hasProcessedMessages = messagesInThreadListAdapter.currentList.any { + val hasProcessedMessages = data.any { it is MessagesInThreadListAdapter.Message && it.incomingMessageInfo != null } val existing = messagesInThreadListAdapter.currentList.getOrNull(1)