add handling for local message deleting
This commit is contained in:
parent
ba57fe2a22
commit
9aba85b967
|
@ -502,6 +502,7 @@ fun Context.deleteConversation(threadId: Long) {
|
||||||
contentResolver.delete(uri, selection, selectionArgs)
|
contentResolver.delete(uri, selection, selectionArgs)
|
||||||
|
|
||||||
conversationsDB.deleteThreadId(threadId)
|
conversationsDB.deleteThreadId(threadId)
|
||||||
|
messagesDB.deleteThreadMessages(threadId)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.deleteMessage(id: Long, isMMS: Boolean) {
|
fun Context.deleteMessage(id: Long, isMMS: Boolean) {
|
||||||
|
@ -510,6 +511,7 @@ fun Context.deleteMessage(id: Long, isMMS: Boolean) {
|
||||||
val selectionArgs = arrayOf(id.toString())
|
val selectionArgs = arrayOf(id.toString())
|
||||||
try {
|
try {
|
||||||
contentResolver.delete(uri, selection, selectionArgs)
|
contentResolver.delete(uri, selection, selectionArgs)
|
||||||
|
messagesDB.delete(id)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
showErrorToast(e)
|
showErrorToast(e)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,4 +25,10 @@ interface MessagesDao {
|
||||||
|
|
||||||
@Query("UPDATE messages SET read = 1 WHERE thread_id = :threadId")
|
@Query("UPDATE messages SET read = 1 WHERE thread_id = :threadId")
|
||||||
fun markThreadRead(threadId: Long)
|
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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue