add handling for local message deleting

This commit is contained in:
tibbi 2020-12-21 22:00:36 +01:00
parent ba57fe2a22
commit 9aba85b967
2 changed files with 8 additions and 0 deletions

View File

@ -502,6 +502,7 @@ fun Context.deleteConversation(threadId: Long) {
contentResolver.delete(uri, selection, selectionArgs)
conversationsDB.deleteThreadId(threadId)
messagesDB.deleteThreadMessages(threadId)
}
fun Context.deleteMessage(id: Long, isMMS: Boolean) {
@ -510,6 +511,7 @@ fun Context.deleteMessage(id: Long, isMMS: Boolean) {
val selectionArgs = arrayOf(id.toString())
try {
contentResolver.delete(uri, selection, selectionArgs)
messagesDB.delete(id)
} catch (e: Exception) {
showErrorToast(e)
}

View File

@ -25,4 +25,10 @@ interface MessagesDao {
@Query("UPDATE messages SET read = 1 WHERE thread_id = :threadId")
fun markThreadRead(threadId: Long)
@Query("DELETE FROM messages WHERE id = :id")
fun delete(id: Long)
@Query("DELETE FROM messages WHERE thread_id = :threadId")
fun deleteThreadMessages(threadId: Long)
}