feat: jump to oldest unread message upon opening a thread, display divider between read/unread (#3693)

This commit is contained in:
Mac DeCourcy 2025-11-14 11:03:46 -08:00 committed by GitHub
parent 427fb33e7e
commit 2a081f3c1f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 1322 additions and 209 deletions

View file

@ -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() }