Avoids showing error message if devs have removed their lnadress on the Zap the Devs card.

pull/910/head
Vitor Pamplona 2024-06-11 11:22:09 -04:00
rodzic a6b2671b1c
commit b775c1bf74
5 zmienionych plików z 23 dodań i 10 usunięć

Wyświetl plik

@ -55,6 +55,7 @@ class ZapPaymentHandler(val account: Account) {
pollOption: Int?,
message: String,
context: Context,
showErrorIfNoLnAddress: Boolean,
onError: (String, String) -> Unit,
onProgress: (percent: Float) -> Unit,
onPayViaIntent: (ImmutableList<Payable>) -> Unit,
@ -112,7 +113,7 @@ class ZapPaymentHandler(val account: Account) {
onProgress(0.05f)
}
assembleAllInvoices(splitZapRequestPairs.toList(), amountMilliSats, message, onError, onProgress = {
assembleAllInvoices(splitZapRequestPairs.toList(), amountMilliSats, message, showErrorIfNoLnAddress, onError, onProgress = {
onProgress(it * 0.7f + 0.05f) // keeps within range.
}, context) {
if (it.isEmpty()) {
@ -195,6 +196,7 @@ class ZapPaymentHandler(val account: Account) {
invoices: List<Pair<ZapSplitSetup, SignAllZapRequestsReturn>>,
totalAmountMilliSats: Long,
message: String,
showErrorIfNoLnAddress: Boolean,
onError: (String, String) -> Unit,
onProgress: (percent: Float) -> Unit,
context: Context,
@ -211,6 +213,7 @@ class ZapPaymentHandler(val account: Account) {
nostrZapRequest = splitZapRequestPair.second.zapRequestJson,
zapValue = calculateZapValue(totalAmountMilliSats, splitZapRequestPair.first.weight, totalWeight),
message = message,
showErrorIfNoLnAddress = showErrorIfNoLnAddress,
onError = onError,
onProgressStep = { percentStepForThisPayment ->
progressAllPayments += percentStepForThisPayment / invoices.size
@ -278,6 +281,7 @@ class ZapPaymentHandler(val account: Account) {
nostrZapRequest: String,
zapValue: Long,
message: String,
showErrorIfNoLnAddress: Boolean = true,
onError: (String, String) -> Unit,
onProgressStep: (percent: Float) -> Unit,
context: Context,
@ -314,15 +318,17 @@ class ZapPaymentHandler(val account: Account) {
},
)
} else {
onError(
context.getString(
R.string.missing_lud16,
),
context.getString(
R.string.user_x_does_not_have_a_lightning_address_setup_to_receive_sats,
user?.toBestDisplayName() ?: splitSetup.lnAddressOrPubKeyHex,
),
)
if (showErrorIfNoLnAddress) {
onError(
context.getString(
R.string.missing_lud16,
),
context.getString(
R.string.user_x_does_not_have_a_lightning_address_setup_to_receive_sats,
user?.toBestDisplayName() ?: splitSetup.lnAddressOrPubKeyHex,
),
)
}
}
}

Wyświetl plik

@ -550,6 +550,7 @@ fun FilteredZapAmountChoicePopup(
pollOption,
zapMessage,
context,
true,
onError,
onProgress,
onPayViaIntent,
@ -576,6 +577,7 @@ fun FilteredZapAmountChoicePopup(
pollOption,
zapMessage,
context,
true,
onError,
onProgress,
onPayViaIntent,

Wyświetl plik

@ -1456,6 +1456,7 @@ fun ZapAmountChoicePopup(
null,
zapMessage,
context,
true,
onError,
onProgress,
onPayViaIntent,
@ -1482,6 +1483,7 @@ fun ZapAmountChoicePopup(
null,
zapMessage,
context,
true,
onError,
onProgress,
onPayViaIntent,

Wyświetl plik

@ -499,6 +499,7 @@ fun customZapClick(
null,
"",
context,
showErrorIfNoLnAddress = false,
onError = onError,
onProgress = { onZappingProgress(it) },
zapType = accountViewModel.account.defaultZapType,

Wyświetl plik

@ -503,6 +503,7 @@ class AccountViewModel(val account: Account, val settings: SettingsState) : View
pollOption: Int?,
message: String,
context: Context,
showErrorIfNoLnAddress: Boolean = true,
onError: (String, String) -> Unit,
onProgress: (percent: Float) -> Unit,
onPayViaIntent: (ImmutableList<ZapPaymentHandler.Payable>) -> Unit,
@ -516,6 +517,7 @@ class AccountViewModel(val account: Account, val settings: SettingsState) : View
pollOption,
message,
context,
showErrorIfNoLnAddress,
onError,
onProgress = {
onProgress(it)