mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix(auto): preserve raw channel index for shortcut/unread contactKey
Notifications and message routing key channel conversations by the raw
protocol channel index (e.g. "2^all"), but publishShortcuts and the
car screen were re-indexing after filtering out unnamed channels, so
named channels after a gap would never match their notification's
shortcutId/locusId and their unread badge would stay at zero.
Preserve the original index via mapIndexedNotNull { index to settings }.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
86bb9583b0
commit
36f770fd0b
3 changed files with 23 additions and 10 deletions
|
|
@ -79,7 +79,9 @@ class ConversationShortcutManager(
|
|||
val channelsFlow =
|
||||
radioConfigRepository.channelSetFlow
|
||||
.map { cs ->
|
||||
cs.settings.filterIndexed { index, settings -> settings.name.isNotEmpty() || index == 0 }
|
||||
cs.settings.mapIndexedNotNull { index, settings ->
|
||||
if (index == 0 || settings.name.isNotEmpty()) index to settings else null
|
||||
}
|
||||
}
|
||||
.distinctUntilChanged()
|
||||
|
||||
|
|
@ -94,11 +96,11 @@ class ConversationShortcutManager(
|
|||
observeJob = null
|
||||
}
|
||||
|
||||
private fun publishShortcuts(favorites: List<Node>, channels: List<ChannelSettings>) {
|
||||
private fun publishShortcuts(favorites: List<Node>, channels: List<Pair<Int, ChannelSettings>>) {
|
||||
val myNodeNum = nodeRepository.myNodeInfo.value?.myNodeNum
|
||||
val shortcuts =
|
||||
favorites.filter { it.num != myNodeNum }.map { buildFavoriteShortcut(it) } +
|
||||
channels.mapIndexed { index, settings -> buildChannelShortcut(settings, index) }
|
||||
channels.map { (index, settings) -> buildChannelShortcut(settings, index) }
|
||||
|
||||
try {
|
||||
val limit = ShortcutManagerCompat.getMaxShortcutCountPerActivity(context)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue