From 66317f55936b1c4d260825a6291e971de95f27ef Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Sat, 29 Jun 2024 16:20:49 -0400 Subject: [PATCH] Better nip44 error messages for notifications --- .../service/notifications/EventNotificationConsumer.kt | 5 ++++- .../java/com/vitorpamplona/quartz/crypto/nip44/Nip44.kt | 6 ++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt index f75a5de2b..2be347507 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/EventNotificationConsumer.kt @@ -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. } diff --git a/quartz/src/main/java/com/vitorpamplona/quartz/crypto/nip44/Nip44.kt b/quartz/src/main/java/com/vitorpamplona/quartz/crypto/nip44/Nip44.kt index 793549be3..2ffa2024d 100644 --- a/quartz/src/main/java/com/vitorpamplona/quartz/crypto/nip44/Nip44.kt +++ b/quartz/src/main/java/com/vitorpamplona/quartz/crypto/nip44/Nip44.kt @@ -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 } }