Move thread handling to unarchiveConversation method

This commit is contained in:
Ensar Sarajčić 2023-07-19 15:30:43 +02:00
parent b9f956f7e8
commit e86e089dc5
1 changed files with 8 additions and 6 deletions

View File

@ -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<Conversation>
conversationsToUnarchive.forEach {
activity.updateConversationArchivedStatus(it.threadId, false)
}
ensureBackgroundThread {
val conversationsToUnarchive = currentList.filter { selectedKeys.contains(it.hashCode()) } as ArrayList<Conversation>
conversationsToUnarchive.forEach {
activity.updateConversationArchivedStatus(it.threadId, false)
}
removeConversationsFromList(conversationsToUnarchive)
removeConversationsFromList(conversationsToUnarchive)
}
}
private fun removeConversationsFromList(removedConversations: List<Conversation>) {