properly mark read messages in the local db
This commit is contained in:
parent
2f6ca40953
commit
ba57fe2a22
|
@ -524,6 +524,7 @@ fun Context.markMessageRead(id: Long, isMMS: Boolean) {
|
|||
val selection = "${Sms._ID} = ?"
|
||||
val selectionArgs = arrayOf(id.toString())
|
||||
contentResolver.update(uri, contentValues, selection, selectionArgs)
|
||||
messagesDB.markRead(id)
|
||||
}
|
||||
|
||||
fun Context.markThreadMessagesRead(threadId: Long) {
|
||||
|
@ -536,6 +537,7 @@ fun Context.markThreadMessagesRead(threadId: Long) {
|
|||
val selectionArgs = arrayOf(threadId.toString())
|
||||
contentResolver.update(uri, contentValues, selection, selectionArgs)
|
||||
}
|
||||
messagesDB.markThreadRead(threadId)
|
||||
}
|
||||
|
||||
fun Context.markThreadMessagesUnread(threadId: Long) {
|
||||
|
|
|
@ -19,4 +19,10 @@ interface MessagesDao {
|
|||
|
||||
@Query("SELECT * FROM messages WHERE thread_id = :threadId")
|
||||
fun getThreadMessages(threadId: Long): List<Message>
|
||||
|
||||
@Query("UPDATE messages SET read = 1 WHERE id = :id")
|
||||
fun markRead(id: Long)
|
||||
|
||||
@Query("UPDATE messages SET read = 1 WHERE thread_id = :threadId")
|
||||
fun markThreadRead(threadId: Long)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue