Avoids showing error message if devs have removed their lnadress on the Zap the Devs card.
This commit is contained in:
@@ -55,6 +55,7 @@ class ZapPaymentHandler(val account: Account) {
|
|||||||
pollOption: Int?,
|
pollOption: Int?,
|
||||||
message: String,
|
message: String,
|
||||||
context: Context,
|
context: Context,
|
||||||
|
showErrorIfNoLnAddress: Boolean,
|
||||||
onError: (String, String) -> Unit,
|
onError: (String, String) -> Unit,
|
||||||
onProgress: (percent: Float) -> Unit,
|
onProgress: (percent: Float) -> Unit,
|
||||||
onPayViaIntent: (ImmutableList<Payable>) -> Unit,
|
onPayViaIntent: (ImmutableList<Payable>) -> Unit,
|
||||||
@@ -112,7 +113,7 @@ class ZapPaymentHandler(val account: Account) {
|
|||||||
onProgress(0.05f)
|
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.
|
onProgress(it * 0.7f + 0.05f) // keeps within range.
|
||||||
}, context) {
|
}, context) {
|
||||||
if (it.isEmpty()) {
|
if (it.isEmpty()) {
|
||||||
@@ -195,6 +196,7 @@ class ZapPaymentHandler(val account: Account) {
|
|||||||
invoices: List<Pair<ZapSplitSetup, SignAllZapRequestsReturn>>,
|
invoices: List<Pair<ZapSplitSetup, SignAllZapRequestsReturn>>,
|
||||||
totalAmountMilliSats: Long,
|
totalAmountMilliSats: Long,
|
||||||
message: String,
|
message: String,
|
||||||
|
showErrorIfNoLnAddress: Boolean,
|
||||||
onError: (String, String) -> Unit,
|
onError: (String, String) -> Unit,
|
||||||
onProgress: (percent: Float) -> Unit,
|
onProgress: (percent: Float) -> Unit,
|
||||||
context: Context,
|
context: Context,
|
||||||
@@ -211,6 +213,7 @@ class ZapPaymentHandler(val account: Account) {
|
|||||||
nostrZapRequest = splitZapRequestPair.second.zapRequestJson,
|
nostrZapRequest = splitZapRequestPair.second.zapRequestJson,
|
||||||
zapValue = calculateZapValue(totalAmountMilliSats, splitZapRequestPair.first.weight, totalWeight),
|
zapValue = calculateZapValue(totalAmountMilliSats, splitZapRequestPair.first.weight, totalWeight),
|
||||||
message = message,
|
message = message,
|
||||||
|
showErrorIfNoLnAddress = showErrorIfNoLnAddress,
|
||||||
onError = onError,
|
onError = onError,
|
||||||
onProgressStep = { percentStepForThisPayment ->
|
onProgressStep = { percentStepForThisPayment ->
|
||||||
progressAllPayments += percentStepForThisPayment / invoices.size
|
progressAllPayments += percentStepForThisPayment / invoices.size
|
||||||
@@ -278,6 +281,7 @@ class ZapPaymentHandler(val account: Account) {
|
|||||||
nostrZapRequest: String,
|
nostrZapRequest: String,
|
||||||
zapValue: Long,
|
zapValue: Long,
|
||||||
message: String,
|
message: String,
|
||||||
|
showErrorIfNoLnAddress: Boolean = true,
|
||||||
onError: (String, String) -> Unit,
|
onError: (String, String) -> Unit,
|
||||||
onProgressStep: (percent: Float) -> Unit,
|
onProgressStep: (percent: Float) -> Unit,
|
||||||
context: Context,
|
context: Context,
|
||||||
@@ -314,15 +318,17 @@ class ZapPaymentHandler(val account: Account) {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
onError(
|
if (showErrorIfNoLnAddress) {
|
||||||
context.getString(
|
onError(
|
||||||
R.string.missing_lud16,
|
context.getString(
|
||||||
),
|
R.string.missing_lud16,
|
||||||
context.getString(
|
),
|
||||||
R.string.user_x_does_not_have_a_lightning_address_setup_to_receive_sats,
|
context.getString(
|
||||||
user?.toBestDisplayName() ?: splitSetup.lnAddressOrPubKeyHex,
|
R.string.user_x_does_not_have_a_lightning_address_setup_to_receive_sats,
|
||||||
),
|
user?.toBestDisplayName() ?: splitSetup.lnAddressOrPubKeyHex,
|
||||||
)
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -550,6 +550,7 @@ fun FilteredZapAmountChoicePopup(
|
|||||||
pollOption,
|
pollOption,
|
||||||
zapMessage,
|
zapMessage,
|
||||||
context,
|
context,
|
||||||
|
true,
|
||||||
onError,
|
onError,
|
||||||
onProgress,
|
onProgress,
|
||||||
onPayViaIntent,
|
onPayViaIntent,
|
||||||
@@ -576,6 +577,7 @@ fun FilteredZapAmountChoicePopup(
|
|||||||
pollOption,
|
pollOption,
|
||||||
zapMessage,
|
zapMessage,
|
||||||
context,
|
context,
|
||||||
|
true,
|
||||||
onError,
|
onError,
|
||||||
onProgress,
|
onProgress,
|
||||||
onPayViaIntent,
|
onPayViaIntent,
|
||||||
|
|||||||
@@ -1456,6 +1456,7 @@ fun ZapAmountChoicePopup(
|
|||||||
null,
|
null,
|
||||||
zapMessage,
|
zapMessage,
|
||||||
context,
|
context,
|
||||||
|
true,
|
||||||
onError,
|
onError,
|
||||||
onProgress,
|
onProgress,
|
||||||
onPayViaIntent,
|
onPayViaIntent,
|
||||||
@@ -1482,6 +1483,7 @@ fun ZapAmountChoicePopup(
|
|||||||
null,
|
null,
|
||||||
zapMessage,
|
zapMessage,
|
||||||
context,
|
context,
|
||||||
|
true,
|
||||||
onError,
|
onError,
|
||||||
onProgress,
|
onProgress,
|
||||||
onPayViaIntent,
|
onPayViaIntent,
|
||||||
|
|||||||
@@ -499,6 +499,7 @@ fun customZapClick(
|
|||||||
null,
|
null,
|
||||||
"",
|
"",
|
||||||
context,
|
context,
|
||||||
|
showErrorIfNoLnAddress = false,
|
||||||
onError = onError,
|
onError = onError,
|
||||||
onProgress = { onZappingProgress(it) },
|
onProgress = { onZappingProgress(it) },
|
||||||
zapType = accountViewModel.account.defaultZapType,
|
zapType = accountViewModel.account.defaultZapType,
|
||||||
|
|||||||
@@ -503,6 +503,7 @@ class AccountViewModel(val account: Account, val settings: SettingsState) : View
|
|||||||
pollOption: Int?,
|
pollOption: Int?,
|
||||||
message: String,
|
message: String,
|
||||||
context: Context,
|
context: Context,
|
||||||
|
showErrorIfNoLnAddress: Boolean = true,
|
||||||
onError: (String, String) -> Unit,
|
onError: (String, String) -> Unit,
|
||||||
onProgress: (percent: Float) -> Unit,
|
onProgress: (percent: Float) -> Unit,
|
||||||
onPayViaIntent: (ImmutableList<ZapPaymentHandler.Payable>) -> Unit,
|
onPayViaIntent: (ImmutableList<ZapPaymentHandler.Payable>) -> Unit,
|
||||||
@@ -516,6 +517,7 @@ class AccountViewModel(val account: Account, val settings: SettingsState) : View
|
|||||||
pollOption,
|
pollOption,
|
||||||
message,
|
message,
|
||||||
context,
|
context,
|
||||||
|
showErrorIfNoLnAddress,
|
||||||
onError,
|
onError,
|
||||||
onProgress = {
|
onProgress = {
|
||||||
onProgress(it)
|
onProgress(it)
|
||||||
|
|||||||
Reference in New Issue
Block a user