Add unread count badge to bottom nav (#3440)

This commit is contained in:
Phil Oliver 2025-10-12 08:22:46 -04:00 committed by GitHub
parent 91470667fb
commit cd1a54f506
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 67 additions and 54 deletions

View file

@ -52,6 +52,7 @@ import org.meshtastic.core.analytics.platform.PlatformAnalytics
import org.meshtastic.core.data.repository.FirmwareReleaseRepository
import org.meshtastic.core.data.repository.MeshLogRepository
import org.meshtastic.core.data.repository.NodeRepository
import org.meshtastic.core.data.repository.PacketRepository
import org.meshtastic.core.data.repository.QuickChatActionRepository
import org.meshtastic.core.data.repository.RadioConfigRepository
import org.meshtastic.core.database.entity.MyNodeEntity
@ -134,6 +135,7 @@ constructor(
private val uiPreferencesDataSource: UiPreferencesDataSource,
private val meshServiceNotifications: MeshServiceNotifications,
private val analytics: PlatformAnalytics,
packetRepository: PacketRepository,
) : ViewModel() {
val theme: StateFlow<Int> = uiPreferencesDataSource.theme
@ -209,6 +211,12 @@ constructor(
val channels: StateFlow<AppOnlyProtos.ChannelSet>
get() = _channels
val unreadMessageCount =
packetRepository
.getUnreadCountTotal()
.map { it.coerceAtLeast(0) }
.stateIn(viewModelScope, SharingStarted.WhileSubscribed(5_000L), 0)
val quickChatActions
get() =
quickChatActionRepository