From a7d386db81082e79df654f6331a2f0b0bc576998 Mon Sep 17 00:00:00 2001 From: James Rich <2199651+jamesarich@users.noreply.github.com> Date: Mon, 26 Jan 2026 08:31:37 -0600 Subject: [PATCH] =?UTF-8?q?fix(notifications):=20Suppress=20notifications?= =?UTF-8?q?=20for=20muted=20contacts=20an=E2=80=A6=20(#4323)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com> --- .../mesh/service/MeshDataHandler.kt | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/geeksville/mesh/service/MeshDataHandler.kt b/app/src/main/java/com/geeksville/mesh/service/MeshDataHandler.kt index d39a0f5f9..161e402cd 100644 --- a/app/src/main/java/com/geeksville/mesh/service/MeshDataHandler.kt +++ b/app/src/main/java/com/geeksville/mesh/service/MeshDataHandler.kt @@ -709,7 +709,7 @@ constructor( getSenderName(dataPacket), dataPacket.alert ?: getString(Res.string.critical_alert), ) - } else if (updateNotification) { + } else if (updateNotification && !isSilent) { scope.handledLaunch { updateNotification(contactKey, dataPacket, isSilent) } } } @@ -757,6 +757,7 @@ constructor( } } + @Suppress("LongMethod") private fun rememberReaction(packet: MeshPacket) = scope.handledLaunch { val emoji = packet.decoded.payload.toByteArray().decodeToString() val fromId = dataMapper.toNodeID(packet.from) @@ -804,24 +805,27 @@ constructor( val conversationMuted = packetRepository.get().getContactSettings(contactKey).isMuted val nodeMuted = nodeManager.nodeDBbyID[fromId]?.isMuted == true val isSilent = conversationMuted || nodeMuted - val channelName = - if (original.packet.data.to == DataPacket.ID_BROADCAST) { - radioConfigRepository.channelSetFlow - .first() - .settingsList - .getOrNull(original.packet.data.channel) - ?.name - } else { - null - } - serviceNotifications.updateReactionNotification( - contactKey, - getSenderName(dataMapper.toDataPacket(packet)!!), - emoji, - original.packet.data.to == DataPacket.ID_BROADCAST, - channelName, - isSilent, - ) + + if (!isSilent) { + val channelName = + if (original.packet.data.to == DataPacket.ID_BROADCAST) { + radioConfigRepository.channelSetFlow + .first() + .settingsList + .getOrNull(original.packet.data.channel) + ?.name + } else { + null + } + serviceNotifications.updateReactionNotification( + contactKey, + getSenderName(dataMapper.toDataPacket(packet)!!), + emoji, + original.packet.data.to == DataPacket.ID_BROADCAST, + channelName, + isSilent, + ) + } } }