fix(auto): clear unread count after inline reply

ReplyReceiver was only cancelling the notification after an inline
reply; PacketRepository.clearUnreadCount was never called, so the
message stayed 'unread' in the app (and in the Android Auto favorites
unread badges) even after the user replied from the HUN.

Mirror MarkAsReadReceiver by invoking clearUnreadCount with nowMillis
before cancelling the notification.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
James Rich 2026-04-17 08:53:11 -05:00
parent 07772917c3
commit d17e715a45

View file

@ -25,10 +25,12 @@ import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
import org.meshtastic.core.common.util.nowMillis
import org.meshtastic.core.di.CoroutineDispatchers
import org.meshtastic.core.model.DataPacket
import org.meshtastic.core.model.RadioController
import org.meshtastic.core.repository.MeshServiceNotifications
import org.meshtastic.core.repository.PacketRepository
/**
* A [BroadcastReceiver] that handles inline replies from notifications.
@ -44,6 +46,8 @@ class ReplyReceiver :
private val meshServiceNotifications: MeshServiceNotifications by inject()
private val packetRepository: PacketRepository by inject()
private val dispatchers: CoroutineDispatchers by inject()
private val scope by lazy { CoroutineScope(dispatchers.io + SupervisorJob()) }
@ -65,6 +69,7 @@ class ReplyReceiver :
scope.launch {
try {
sendMessage(message, contactKey)
packetRepository.clearUnreadCount(contactKey, nowMillis)
meshServiceNotifications.cancelMessageNotification(contactKey)
} finally {
pendingResult.finish()