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.
This commit is contained in:
greenart7c3
2026-01-16 05:12:04 -03:00
parent 475c7552db
commit 21b39bbd29
@@ -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(