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
|
|
@ -106,7 +106,7 @@ class ContactsViewModel @Inject constructor(
|
|||
longName = longName,
|
||||
lastMessageTime = getShortDateTime(data.time),
|
||||
lastMessageText = if (fromLocal) data.text else "$shortName: ${data.text}",
|
||||
unreadCount = 0,
|
||||
unreadCount = packetRepository.getUnreadCount(contactKey),
|
||||
messageCount = packetRepository.getMessageCount(contactKey),
|
||||
isMuted = settings[contactKey]?.isMuted == true,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -290,6 +290,10 @@ class UIViewModel @Inject constructor(
|
|||
packetRepository.deleteWaypoint(id)
|
||||
}
|
||||
|
||||
fun clearUnreadCount(contact: String, timestamp: Long) = viewModelScope.launch(Dispatchers.IO) {
|
||||
packetRepository.clearUnreadCount(contact, timestamp)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getPreferences(context: Context): SharedPreferences =
|
||||
context.getSharedPreferences("ui-prefs", Context.MODE_PRIVATE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue