mirror of
https://github.com/greenart7c3/Amber.git
synced 2026-10-05 19:08:23 +00:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user