Fixed updating last message after deleting (#167)

This commit is contained in:
Agnieszka C 2021-09-04 22:14:22 +02:00
parent 72833f6f16
commit 44c540b961
2 changed files with 16 additions and 0 deletions

View file

@ -764,3 +764,15 @@ fun Context.getLockScreenVisibilityText(type: Int) = getString(
else -> R.string.nothing
}
)
fun Context.updateLastConversationMessage(threadId: Long) {
val uri = Threads.CONTENT_URI
val selection = "${Threads._ID} = ?"
val selectionArgs = arrayOf(threadId.toString())
try {
contentResolver.delete(uri, selection, selectionArgs)
val newConversation = getConversations(threadId)[0]
conversationsDB.insertOrUpdate(newConversation)
} catch (e: Exception) {
}
}