From a6c153a1545d0a74d660bd30e95f1f8a2459db03 Mon Sep 17 00:00:00 2001 From: davotoula Date: Tue, 17 Mar 2026 18:29:56 +0100 Subject: [PATCH] adaptability: use constant instead of repeated string literals --- .../amethyst/ui/screen/loggedIn/wallet/WalletViewModel.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/WalletViewModel.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/WalletViewModel.kt index 770ae0cbd..b7cc666aa 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/WalletViewModel.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/wallet/WalletViewModel.kt @@ -82,6 +82,7 @@ enum class TransactionFilter { } private const val NWC_TIMEOUT_MS = 30_000L +private const val PAYMENT_FAILED = "Payment failed" class WalletViewModel : ViewModel() { private var account: Account? = null @@ -301,14 +302,14 @@ class WalletViewModel : ViewModel() { is PayInvoiceErrorResponse -> { _sendState.value = SendState.Error( - response.error?.message ?: "Payment failed", + response.error?.message ?: PAYMENT_FAILED, ) } is NwcErrorResponse -> { _sendState.value = SendState.Error( - response.error?.message ?: "Payment failed", + response.error?.message ?: PAYMENT_FAILED, ) } @@ -318,7 +319,7 @@ class WalletViewModel : ViewModel() { } } } catch (e: Exception) { - _sendState.value = SendState.Error(e.message ?: "Payment failed") + _sendState.value = SendState.Error(e.message ?: PAYMENT_FAILED) } } }