allow deleting threads from the main screen

This commit is contained in:
tibbi 2020-04-05 13:25:24 +02:00
parent 560935b61e
commit 2a319f9550
3 changed files with 56 additions and 2 deletions

View file

@ -175,6 +175,13 @@ fun Context.insertNewSMS(address: String, subject: String, body: String, date: L
contentResolver.insert(uri, contentValues)
}
fun Context.deleteThread(id: Int) {
val uri = Telephony.Sms.CONTENT_URI
val selection = "${Telephony.Sms.THREAD_ID} = ?"
val selectionArgs = arrayOf(id.toString())
contentResolver.delete(uri, selection, selectionArgs)
}
fun Context.markSMSRead(id: Int) {
val uri = Telephony.Sms.CONTENT_URI
val contentValues = ContentValues().apply {