mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Add unread count badge to bottom nav (#3440)
This commit is contained in:
parent
91470667fb
commit
cd1a54f506
8 changed files with 67 additions and 54 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue