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)