mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: jump to oldest unread message upon opening a thread, display divider between read/unread (#3693)
This commit is contained in:
parent
427fb33e7e
commit
2a081f3c1f
12 changed files with 1322 additions and 209 deletions
|
|
@ -57,6 +57,22 @@ constructor(
|
|||
suspend fun clearUnreadCount(contact: String, timestamp: Long) =
|
||||
withContext(dispatchers.io) { dbManager.currentDb.value.packetDao().clearUnreadCount(contact, timestamp) }
|
||||
|
||||
suspend fun updateLastReadMessage(contact: String, messageUuid: Long, lastReadTimestamp: Long) =
|
||||
withContext(dispatchers.io) {
|
||||
val dao = dbManager.currentDb.value.packetDao()
|
||||
val current = dao.getContactSettings(contact)
|
||||
val existingTimestamp = current?.lastReadMessageTimestamp ?: Long.MIN_VALUE
|
||||
if (lastReadTimestamp <= existingTimestamp) {
|
||||
return@withContext
|
||||
}
|
||||
val updated =
|
||||
(current ?: ContactSettings(contact_key = contact)).copy(
|
||||
lastReadMessageUuid = messageUuid,
|
||||
lastReadMessageTimestamp = lastReadTimestamp,
|
||||
)
|
||||
dao.upsertContactSettings(listOf(updated))
|
||||
}
|
||||
|
||||
suspend fun getQueuedPackets(): List<DataPacket>? =
|
||||
withContext(dispatchers.io) { dbManager.currentDb.value.packetDao().getQueuedPackets() }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue