adaptability: use constant instead of repeated string literals

This commit is contained in:
davotoula
2026-03-17 18:29:56 +01:00
parent 97758a5163
commit a6c153a154
@@ -82,6 +82,7 @@ enum class TransactionFilter {
} }
private const val NWC_TIMEOUT_MS = 30_000L private const val NWC_TIMEOUT_MS = 30_000L
private const val PAYMENT_FAILED = "Payment failed"
class WalletViewModel : ViewModel() { class WalletViewModel : ViewModel() {
private var account: Account? = null private var account: Account? = null
@@ -301,14 +302,14 @@ class WalletViewModel : ViewModel() {
is PayInvoiceErrorResponse -> { is PayInvoiceErrorResponse -> {
_sendState.value = _sendState.value =
SendState.Error( SendState.Error(
response.error?.message ?: "Payment failed", response.error?.message ?: PAYMENT_FAILED,
) )
} }
is NwcErrorResponse -> { is NwcErrorResponse -> {
_sendState.value = _sendState.value =
SendState.Error( SendState.Error(
response.error?.message ?: "Payment failed", response.error?.message ?: PAYMENT_FAILED,
) )
} }
@@ -318,7 +319,7 @@ class WalletViewModel : ViewModel() {
} }
} }
} catch (e: Exception) { } catch (e: Exception) {
_sendState.value = SendState.Error(e.message ?: "Payment failed") _sendState.value = SendState.Error(e.message ?: PAYMENT_FAILED)
} }
} }
} }