From 21b39bbd291f195108cd95d1ab77d46b29a15616 Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Fri, 16 Jan 2026 05:12:04 -0300 Subject: [PATCH] Refactor event notification handling to include logging - Update `consume` to log when no tagged users are found in an event. - Update `consume` to log when the tagged account is not logged in. - Improve code readability by replacing the let block with explicit null checks and logging. --- .../service/EventNotificationConsumer.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/greenart7c3/nostrsigner/service/EventNotificationConsumer.kt b/app/src/main/java/com/greenart7c3/nostrsigner/service/EventNotificationConsumer.kt index eaf8aa9d..2295d1c3 100644 --- a/app/src/main/java/com/greenart7c3/nostrsigner/service/EventNotificationConsumer.kt +++ b/app/src/main/java/com/greenart7c3/nostrsigner/service/EventNotificationConsumer.kt @@ -106,10 +106,17 @@ class EventNotificationConsumer(private val applicationContext: Context) { NotificationUtils.getOrCreateBunkerChannel(applicationContext) NotificationUtils.getOrCreateErrorsChannel(applicationContext) - val taggedKey = event.taggedUsers().firstOrNull() ?: return - LocalPreferences.loadFromEncryptedStorageSync(applicationContext, taggedKey.toNPub())?.let { acc -> - notify(event, acc, relay) + val taggedKey = event.taggedUsers().firstOrNull() + if (taggedKey == null) { + saveLog("No tagged users found in event") + return } + val acc = LocalPreferences.loadFromEncryptedStorageSync(applicationContext, taggedKey.toNPub()) + if (acc == null) { + saveLog("Tagged account not logged in") + return + } + notify(event, acc, relay) } private fun notify(