mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: add unread message count
This commit is contained in:
parent
e4f5d9b89c
commit
d7013e1386
7 changed files with 89 additions and 4 deletions
|
|
@ -45,6 +45,25 @@ interface PacketDao {
|
|||
)
|
||||
suspend fun getMessageCount(contact: String): Int
|
||||
|
||||
@Query(
|
||||
"""
|
||||
SELECT COUNT(*) FROM packet
|
||||
WHERE (myNodeNum = 0 OR myNodeNum = (SELECT myNodeNum FROM MyNodeInfo))
|
||||
AND port_num = 1 AND contact_key = :contact AND read = 0
|
||||
"""
|
||||
)
|
||||
suspend fun getUnreadCount(contact: String): Int
|
||||
|
||||
@Query(
|
||||
"""
|
||||
UPDATE packet
|
||||
SET read = 1
|
||||
WHERE (myNodeNum = 0 OR myNodeNum = (SELECT myNodeNum FROM MyNodeInfo))
|
||||
AND port_num = 1 AND contact_key = :contact AND read = 0 AND received_time <= :timestamp
|
||||
"""
|
||||
)
|
||||
suspend fun clearUnreadCount(contact: String, timestamp: Long)
|
||||
|
||||
@Insert
|
||||
fun insert(packet: Packet)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue