Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
7e44462
feat: update spending balance modal
ovitrif Nov 17, 2026
754638d
Merge remote-tracking branch 'origin/fix/spark-follow-ups' into feat/…
ovitrif Nov 17, 2026
1f912de
fix: guard the spending balance update before payments
ovitrif Nov 17, 2026
2ada21c
fix: update spending balance journeys to the app's current steps
ovitrif Nov 18, 2026
94a8915
chore: translate spending balance update strings
ovitrif Nov 18, 2026
1a2ffa8
Merge remote-tracking branch 'origin/fix/spark-follow-ups' into feat/…
ovitrif Nov 18, 2026
aff7c0a
fix: price spark's routing fee before an update moves funds
ovitrif Nov 18, 2026
2de3e68
chore: wrap long lines in the update fee check
ovitrif Nov 18, 2026
af59005
fix: let tests dismiss the update modal in every state
ovitrif Nov 18, 2026
b5328f8
fix: show the update fee before any spending balance move
ovitrif Nov 18, 2026
ec91454
fix: price an update payment with spark's own quote
ovitrif Nov 18, 2026
76b903e
fix: show the update fee before the swipe
ovitrif Nov 18, 2026
148892d
fix: wait for the update quote before the swipe
ovitrif Nov 18, 2026
4d5b3aa
fix: clear the update quoting flag after a switch
ovitrif Nov 18, 2026
a6e8899
fix: keep the swipe off while a newer update quote loads
ovitrif Nov 18, 2026
5e1aa01
fix: confirm a subscription payment that needs the update
ovitrif Nov 19, 2026
2f8ed89
fix: guard the spending balance update's edge cases
ovitrif Nov 19, 2026
a9cd445
chore: merge spark follow-ups into the spending balance update
ovitrif Nov 19, 2026
d2f1057
chore: merge spark follow-ups into the spending balance update
ovitrif Nov 19, 2026
b4d1cbb
fix: keep channels that still hold a balance after a move
ovitrif Nov 19, 2026
fec6da7
fix: close only channels the move itself emptied
ovitrif Nov 19, 2026
518dc87
chore: merge spark follow-ups into the spending balance update
ovitrif Nov 19, 2026
be6e3f7
fix: use the legacy reserve for channels without anchors
ovitrif Nov 19, 2026
e9942d1
fix: recheck a moved channel before closing it
ovitrif Nov 19, 2026
d552fc3
fix: leave a channel open while the move may still hold it
ovitrif Nov 19, 2026
4f83d51
fix: close a moved channel only on a reading that holds
ovitrif Nov 19, 2026
aa59846
fix: match LDK's send limit before closing a moved channel
ovitrif Nov 19, 2026
4c8a8d7
chore: merge spark follow-ups into the spending balance update
ovitrif Nov 19, 2026
ccbafd4
chore: merge spark follow-ups into the spending balance update
ovitrif Nov 19, 2026
6709962
fix: close emptied channels past on-chain sends and skip quickpay's c…
ovitrif Nov 20, 2026
c28c489
Merge fix/spark-follow-ups into feat/spark-update-spending-balance-v64
ovitrif Nov 20, 2026
689b8e4
chore: merge spark follow-ups
ovitrif Nov 20, 2026
ee15410
chore: merge spark follow-ups
ovitrif Nov 20, 2026
a34d5bb
chore: merge spark follow-ups
ovitrif Nov 20, 2026
914b63d
chore: merge spark follow-ups
ovitrif Nov 20, 2026
0ea27cd
chore: merge spark follow-ups
ovitrif Nov 21, 2026
a2686fb
chore: merge spark follow-ups
ovitrif Nov 21, 2026
0564c25
chore: merge spark follow-ups
ovitrif Nov 21, 2026
8b011b4
chore: merge spark follow-ups
ovitrif Nov 21, 2026
0fffd51
chore: merge spark follow-ups
ovitrif Nov 21, 2026
ca4b78c
chore: merge spark follow-ups
ovitrif Nov 21, 2026
1946606
chore: merge spark follow-ups
ovitrif Nov 21, 2026
e0ae5a8
chore: merge spark follow-ups
ovitrif Nov 21, 2026
c366518
chore: merge spark follow-ups
ovitrif Nov 21, 2026
aa6d2d9
chore: merge spark follow-ups
ovitrif Nov 21, 2026
7d3e9c4
chore: merge spark follow-ups
ovitrif Nov 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/lint.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<ignore path="src/main/res/drawable/qr_placeholder.xml" />
</issue>
<issue id="VectorPath">
<ignore path="src/main/res/drawable/arrow.xml" />
<ignore path="src/main/res/drawable/ic_synonym_logo.xml" />
<ignore path="src/main/res/drawable/ic_timer_alt_yellow.xml" />
</issue>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class ReceiveAutoTabSelectionTest {
fun keepsTabPickedByTapWhenAutoBecomesAvailable() {
setContent()

composeTestRule.onNodeWithTag("Tab-spending").performClick()
composeTestRule.onNodeWithTag("Tab-savings").performClick()
composeTestRule.waitForIdle()

Expand All @@ -58,7 +57,6 @@ class ReceiveAutoTabSelectionTest {
walletState = WALLET_STATE,
lightningState = lightningState,
onClickEditInvoice = { editedTabs += it },
onClickReceiveCjit = {},
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class ReceiveHardwareFlowTest {
walletState = WALLET_STATE,
lightningState = LightningState(),
onClickEditInvoice = {},
onClickReceiveCjit = {},
onClickHardwareEditInvoice = {
editState.beginHardwareEdit()
isEditing = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ class ReceiveNavigationTest {
private var sheetDismissed = false

@Test
fun deepLinkedTransferUnavailableReturnsToQr() {
setGraph(ReceiveRoute.TransferUnavailable)
fun deepLinkedEditInvoiceReturnsToQr() {
setGraph(ReceiveRoute.EditInvoice)

assertOn(ReceiveRoute.TransferUnavailable::class)
assertOn(ReceiveRoute.EditInvoice::class)
pressBack()
assertOn(ReceiveRoute.QR::class)
assertFalse(sheetDismissed)
Expand Down Expand Up @@ -97,7 +97,7 @@ class ReceiveNavigationTest {
LaunchedEffect(startRoute) { controller.navigateToReceiveStart(startRoute) }
NavHost(navController = controller, startDestination = startRoute.rootRoute()) {
composable<ReceiveRoute.QR> { Text("QR") }
composable<ReceiveRoute.TransferUnavailable> { Text("Transfer Unavailable") }
composable<ReceiveRoute.EditInvoice> { Text("Edit Invoice") }
composable<ReceiveRoute.PaymentRequestDetails> { Text("Details") }
composable<ReceiveRoute.PaymentRequestRecipient> { Text("Recipient") }
composable<ReceiveRoute.PaymentRequestSent> { Text("Sent") }
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/java/to/bitkit/ext/PaymentFailureReasonExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import breez_sdk_spark.SdkException
import org.lightningdevkit.ldknode.PaymentFailureReason
import to.bitkit.R
import to.bitkit.models.SendFailureDetails
import to.bitkit.repositories.MoveToSparkError
import to.bitkit.services.SparkError
import to.bitkit.utils.LdkError

Expand Down Expand Up @@ -55,8 +56,10 @@ fun Throwable.toSendFailureMessage(context: Context): String {
return context.getString(R.string.wallet__payment_restored_invoice)
}

// Spark and its SDK speak in English developer messages; they go to the log, the user gets the existing copy.
if (this is LdkError || this is SparkError || this is SdkException || rawMessage.isBlank() ||
// Spark, its SDK and the spending balance update speak in English developer messages; they go to the log, the
// user gets the existing copy.
if (this is LdkError || this is SparkError || this is SdkException || this is MoveToSparkError ||
rawMessage.isBlank() ||
rawMessage.looksInternalPaymentError()
) {
return fallbackMessage
Expand Down
42 changes: 0 additions & 42 deletions app/src/main/java/to/bitkit/models/ReceiveLiquidityDecision.kt
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
package to.bitkit.models

enum class ReceiveLiquiditySource {
SAVINGS,
AUTO,
SPENDING,
}

sealed interface ReceiveAdditionalLiquidityAction {
data object None : ReceiveAdditionalLiquidityAction

/** More inbound capacity needs a new channel, and Blocktank no longer sells them. */
data object TransferUnavailable : ReceiveAdditionalLiquidityAction
}

data class ReceiveAdditionalLiquidityParams(
val source: ReceiveLiquiditySource,
val invoiceAmountSats: ULong,
val inboundCapacitySats: ULong?,
)

object ReceiveLiquidityDecision {
fun canCreateLightningInvoice(
hasReadyChannels: Boolean,
Expand All @@ -33,27 +14,4 @@ object ReceiveLiquidityDecision {

return invoiceAmountSats <= inboundCapacitySats
}

fun additionalLiquidityAction(params: ReceiveAdditionalLiquidityParams): ReceiveAdditionalLiquidityAction {
return when {
params.source != ReceiveLiquiditySource.SPENDING -> ReceiveAdditionalLiquidityAction.None
!needsInboundLiquidity(params.invoiceAmountSats, params.inboundCapacitySats) ->
ReceiveAdditionalLiquidityAction.None
(params.inboundCapacitySats ?: 0uL) == 0uL -> ReceiveAdditionalLiquidityAction.None
else -> ReceiveAdditionalLiquidityAction.TransferUnavailable
}
}

fun needsInboundLiquidity(
invoiceAmountSats: ULong,
inboundCapacitySats: ULong?,
): Boolean {
val inbound = inboundCapacitySats ?: 0uL

if (invoiceAmountSats == 0uL) {
return inbound == 0uL
}

return invoiceAmountSats > inbound
}
}
Loading