Better nip44 error messages for notifications

This commit is contained in:
Vitor Pamplona
2024-06-29 16:20:49 -04:00
parent b1b915b405
commit 66317f5593
2 changed files with 6 additions and 5 deletions
@@ -55,11 +55,14 @@ class EventNotificationConsumer(
// PushNotification Wraps don't include a receiver.
// Test with all logged in accounts
var matchAccount = false
LocalPreferences.allSavedAccounts().forEach {
if (it.hasPrivKey || it.loggedInWithExternalSigner) {
if (!matchAccount && it.hasPrivKey || it.loggedInWithExternalSigner) {
LocalPreferences.loadCurrentAccountFromEncryptedStorage(it.npub)?.let { acc ->
Log.d("EventNotificationConsumer", "New Notification Testing if for ${it.npub}")
try {
consumeIfMatchesAccount(event, acc)
matchAccount = true
} catch (e: Exception) {
// Not for this account.
}
@@ -118,8 +118,7 @@ class Nip44(
else -> null
}
} catch (e: Exception) {
Log.e("CryptoUtils", "Could not identify the version for NIP44 payload $json")
e.printStackTrace()
Log.e("CryptoUtils", "NIP44: Unable to find version and decrypt $json", e)
null
}
@@ -140,8 +139,7 @@ class Nip44(
else -> null
}
} catch (e: Exception) {
Log.e("CryptoUtils", "Could not identify the version for NIP44 payload $payload")
e.printStackTrace()
Log.e("CryptoUtils", "NIP44: Unable to find version and decrypt $payload", e)
null
}
}