mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
fix(auto): refresh group summary when a conversation is cancelled
After clearing a message notification we left the GROUP_KEY_MESSAGES summary in place, which on Android Auto leaves a lingering HUN / summary entry for the already-dismissed conversation. Cancel the summary when no child notifications remain, and refresh it otherwise. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
b5a631ebd7
commit
fb606db067
1 changed files with 14 additions and 1 deletions
|
|
@ -507,7 +507,20 @@ class MeshServiceNotificationsImpl(
|
|||
notificationManager.notify(clientNotification.toString().hashCode(), notification)
|
||||
}
|
||||
|
||||
override fun cancelMessageNotification(contactKey: String) = notificationManager.cancel(contactKey.hashCode())
|
||||
override fun cancelMessageNotification(contactKey: String) {
|
||||
notificationManager.cancel(contactKey.hashCode())
|
||||
// Refresh (or remove) the group summary so the notification shade / Auto HUN doesn't
|
||||
// continue surfacing a stale summary after the last child is dismissed.
|
||||
val remainingChildren =
|
||||
notificationManager.activeNotifications.count { sbn ->
|
||||
sbn.id != SUMMARY_ID && sbn.notification.group == GROUP_KEY_MESSAGES
|
||||
}
|
||||
if (remainingChildren == 0) {
|
||||
notificationManager.cancel(SUMMARY_ID)
|
||||
} else {
|
||||
showGroupSummary()
|
||||
}
|
||||
}
|
||||
|
||||
override fun cancelLowBatteryNotification(node: Node) = notificationManager.cancel(node.num)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue