From e86e089dc5c816b5d00c56ef7115b64f534fa4db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Wed, 19 Jul 2023 15:30:43 +0200 Subject: [PATCH] Move thread handling to unarchiveConversation method --- .../adapters/ArchivedConversationsAdapter.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ArchivedConversationsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ArchivedConversationsAdapter.kt index 1ca22c72..1fcccf05 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ArchivedConversationsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ArchivedConversationsAdapter.kt @@ -26,7 +26,7 @@ class ArchivedConversationsAdapter( when (id) { R.id.cab_delete -> askConfirmDelete() - R.id.cab_unarchive -> ensureBackgroundThread { unarchiveConversation() } + R.id.cab_unarchive -> unarchiveConversation() R.id.cab_select_all -> selectAll() } } @@ -64,12 +64,14 @@ class ArchivedConversationsAdapter( return } - val conversationsToUnarchive = currentList.filter { selectedKeys.contains(it.hashCode()) } as ArrayList - conversationsToUnarchive.forEach { - activity.updateConversationArchivedStatus(it.threadId, false) - } + ensureBackgroundThread { + val conversationsToUnarchive = currentList.filter { selectedKeys.contains(it.hashCode()) } as ArrayList + conversationsToUnarchive.forEach { + activity.updateConversationArchivedStatus(it.threadId, false) + } - removeConversationsFromList(conversationsToUnarchive) + removeConversationsFromList(conversationsToUnarchive) + } } private fun removeConversationsFromList(removedConversations: List) {