properly handle inserting and deleting threads from local db

This commit is contained in:
tibbi 2020-05-30 20:01:09 +02:00
parent 2b3df2719b
commit 35c205605d
4 changed files with 40 additions and 13 deletions

View file

@ -462,10 +462,12 @@ fun Context.insertNewSMS(address: String, subject: String, body: String, date: L
return newUri?.lastPathSegment?.toInt() ?: 0
}
fun Context.deleteConversation(id: Int) {
fun Context.deleteConversation(threadId: Int) {
conversationsDB.deleteThreadId(threadId.toLong())
var uri = Sms.CONTENT_URI
val selection = "${Sms.THREAD_ID} = ?"
val selectionArgs = arrayOf(id.toString())
val selectionArgs = arrayOf(threadId.toString())
contentResolver.delete(uri, selection, selectionArgs)
uri = Mms.CONTENT_URI