feat: Implement read receipt handling and mark all outgoing messages as read
This commit is contained in:
@@ -221,6 +221,16 @@ interface MessageDao {
|
||||
*/
|
||||
@Query("SELECT EXISTS(SELECT 1 FROM messages WHERE account = :account AND message_id = :messageId)")
|
||||
suspend fun messageExists(account: String, messageId: String): Boolean
|
||||
|
||||
/**
|
||||
* Отметить все исходящие сообщения к собеседнику как прочитанные (delivered=3)
|
||||
* Используется когда приходит PacketRead от собеседника
|
||||
*/
|
||||
@Query("""
|
||||
UPDATE messages SET delivered = 3
|
||||
WHERE account = :account AND to_public_key = :opponent AND from_me = 1 AND delivered < 3
|
||||
""")
|
||||
suspend fun markAllAsRead(account: String, opponent: String)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user