From f4952c559cd315002dbd07f24c21edd9fef1156a Mon Sep 17 00:00:00 2001 From: DenBond7 Date: Mon, 25 Nov 2024 16:36:15 +0200 Subject: [PATCH] Fixed updating messages on the thread details screen after sending a message.| #74 --- .../activity/fragment/ThreadDetailsFragment.kt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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 b30ee7aae..6203b1b04 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 @@ -935,16 +935,14 @@ class ThreadDetailsFragment : BaseFragment(), Prog workInfo.progress.getLong(MessagesSenderWorker.EXTRA_KEY_THREAD_ID_OF_SENT_MESSAGE, -1) val draftId = workInfo.progress.getString(MessagesSenderWorker.EXTRA_KEY_ID_OF_SENT_DRAFT) - when { - !draftId.isNullOrEmpty() -> { - deleteDraftFromLocalCache(draftId) - } + if (!draftId.isNullOrEmpty()) { + deleteDraftFromLocalCache(draftId) + } - threadIdOfSentMessage != -1L -> { - val currentThreadId = threadDetailsViewModel.threadMessageEntityFlow.value?.threadId - if (currentThreadId == threadIdOfSentMessage) { - threadDetailsViewModel.loadMessages(silentUpdate = true) - } + if (threadIdOfSentMessage != -1L) { + val currentThreadId = threadDetailsViewModel.threadMessageEntityFlow.value?.threadId + if (currentThreadId == threadIdOfSentMessage) { + threadDetailsViewModel.loadMessages(silentUpdate = true) } } }