Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
369a40d
chore: translate spark design strings
ovitrif Nov 17, 2026
bcaede8
feat: spark transfer to spending design
ovitrif Nov 17, 2026
2800348
Merge remote-tracking branch 'origin/feat/spark-transfer-to-spending-…
ovitrif Nov 17, 2026
2ff2d4e
Merge remote-tracking branch 'origin/feat/spark-design-v64' into chor…
ovitrif Nov 17, 2026
1dc5193
chore: translate spark transfer to spending strings
ovitrif Nov 17, 2026
9a45627
feat: spark connection and app status design
ovitrif Nov 17, 2026
c34aec3
docs: describe how to stop spark for the unavailable sheet journey
ovitrif Nov 17, 2026
67118fa
chore: add changelog fragment
ovitrif Nov 17, 2026
480586d
Merge remote-tracking branches 'origin/feat/spark-transfer-to-spendin…
ovitrif Nov 17, 2026
d62d658
chore: translate the force transfer derivation path label
ovitrif Nov 17, 2026
6a90e63
fix: keep the typed amount when returning to it
ovitrif Nov 17, 2026
63cd701
fix: show an unconfirmed spark deposit as pending
ovitrif Nov 17, 2026
3540dde
chore: add changelog fragment
ovitrif Nov 17, 2026
dbb8b28
fix: check the deleted digit in the transfer amount journey
ovitrif Nov 17, 2026
18d97c4
chore: merge spark connection and app status design with its translat…
ovitrif Nov 17, 2026
7b1fec8
Merge remote-tracking branch 'origin/feat/spark-transfer-to-spending-…
ovitrif Nov 17, 2026
54acd5a
fix: drop spark's unlimited receiving while offline
ovitrif Nov 17, 2026
f23a5c9
Merge remote-tracking branch 'origin/feat/spark-connection-status-v64…
ovitrif Nov 17, 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
36 changes: 19 additions & 17 deletions app/src/main/java/to/bitkit/repositories/HealthRepo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class HealthRepo @Inject constructor(
private val connectivityRepo: ConnectivityRepo,
private val lightningRepo: LightningRepo,
private val sparkRepo: SparkRepo,
private val sparkExitRepo: SparkExitRepo,
private val cacheStore: CacheStore,
private val clock: Clock,
) {
Expand All @@ -53,8 +54,9 @@ class HealthRepo @Inject constructor(
internetHealthState,
lightningRepo.lightningState,
sparkRepo.state,
) { internetHealth, lightningState, sparkState ->
computeHealthState(internetHealth, lightningState, sparkState)
sparkExitRepo.state.map { it.record?.isActive == true },
) { internetHealth, lightningState, sparkState, isSparkExiting ->
computeHealthState(internetHealth, lightningState, sparkState).copy(isSparkExiting = isSparkExiting)
}.collect { newHealthState ->
updateState {
it.copy(
Expand All @@ -64,6 +66,7 @@ class HealthRepo @Inject constructor(
channels = newHealthState.channels,
isLightningViaSpark = newHealthState.isLightningViaSpark,
spark = newHealthState.spark,
isSparkExiting = newHealthState.isSparkExiting,
)
}
}
Expand Down Expand Up @@ -169,21 +172,7 @@ class HealthRepo @Inject constructor(
_healthState.update { currentState ->
val updatedState = update(currentState)

// Compute app health status from all individual states
val states = listOf(
updatedState.internet,
updatedState.electrum,
updatedState.node,
updatedState.backups,
)

val appStatus = when {
HealthState.ERROR in states -> HealthState.ERROR
HealthState.PENDING in states -> HealthState.PENDING
else -> HealthState.READY
}

updatedState.copy(app = appStatus)
updatedState.copy(app = updatedState.computeApp())
}
}
}
Expand All @@ -198,7 +187,20 @@ data class AppHealthState(
/** Null where Spark is unsupported. */
val spark: HealthState? = null,
val backups: HealthState = HealthState.READY,
/** A force transfer to savings runs, which App Status shows on Spark's row. */
val isSparkExiting: Boolean = false,
val app: HealthState = HealthState.READY,
) {
fun isOnline() = internet == HealthState.READY

/** The menu's status: red when any part fails, else yellow while any is pending; Spark counts where supported. */
internal fun computeApp(): HealthState {
val sparkState = spark?.let { if (isSparkExiting) HealthState.PENDING else it }
val states = listOfNotNull(internet, electrum, node, backups, sparkState)
return when {
HealthState.ERROR in states -> HealthState.ERROR
HealthState.PENDING in states -> HealthState.PENDING
else -> HealthState.READY
}
}
}
5 changes: 0 additions & 5 deletions app/src/main/java/to/bitkit/ui/ContentView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1210,7 +1210,6 @@ private fun RootNavHost(
walletId = walletId,
viewModel = hiltViewModel<SparkFundingViewModel>(parentEntry),
onBackClick = { navController.popBackStack() },
onLearnMoreClick = { navController.navigateTo(Routes.TransferLearnMore) },
onSent = {
navController.navigateTo(Routes.SpendingHwSigned) {
popUpTo<Routes.SpendingHwSign> { inclusive = true }
Expand Down Expand Up @@ -1243,11 +1242,7 @@ private fun RootNavHost(
)
}
composableWithDefaultTransitions<Routes.TransferLearnMore> {
val parentEntry = remember(it) { navController.getBackStackEntry(Routes.SparkFundingNav) }
val sparkState by walletViewModel.sparkState.collectAsStateWithLifecycle()
TransferLearnMoreScreen(
viewModel = hiltViewModel<SparkFundingViewModel>(parentEntry),
spendingBalanceSats = sparkState.spendingSats.toLong(),
onBackClick = { navController.popBackStack() },
onContinueClick = { navController.popBackStack() },
)
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/to/bitkit/ui/components/FeeInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.size
import androidx.compose.material3.HorizontalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import to.bitkit.ui.theme.Colors

Expand All @@ -21,12 +22,13 @@ fun RowScope.FeeInfo(
modifier: Modifier = Modifier,
prefix: String? = null,
isLoading: Boolean = false,
topPadding: Dp = 16.dp,
) {
Column(
modifier = modifier
.fillMaxHeight()
.weight(1f)
.padding(top = 16.dp)
.padding(top = topPadding)
) {
Caption13Up(
text = label,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ import to.bitkit.ui.theme.Colors
/** Illustration width as a fraction of the sheet width — the 256-wide Visual in the 375-wide Figma frame. */
internal const val HW_ILLUSTRATION_SIZE_RATIO = 256f / 375f

/** Figma top ratio for the signed check visual within the content area below navigation. */
internal const val SIGNED_VISUAL_TOP_RATIO = (481f - 92f) / (812f - 92f - 34f)

/** Figma top ratio for the Trezor visual within the content area below navigation. */
internal const val SIGN_VISUAL_TOP_RATIO = (488f - 92f) / (812f - 92f - 34f)

/** Trezor illustration left bleed past the frame, as a fraction of the sheet width; keeps its screen text in view. */
private const val HW_DEVICE_TREZOR_BLEED_RATIO = 71f / 375f

Expand Down
45 changes: 38 additions & 7 deletions app/src/main/java/to/bitkit/ui/components/LightningChannel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,24 @@ fun LightningChannel(
status: ChannelStatusUi = ChannelStatusUi.PENDING,
showLabels: Boolean = false,
showReceiving: Boolean = true,
receivingUnlimited: Boolean = false,
) {
val isEmptySpendingBar = !showReceiving && localBalance == 0L
val isEmptySpendingBar = (!showReceiving || receivingUnlimited) && localBalance == 0L
val spendingColor = if (status == ChannelStatusUi.CLOSED || isEmptySpendingBar) Colors.Gray5 else Colors.Purple50
val spendingAvailableColor = if (status == ChannelStatusUi.CLOSED) Colors.Gray3 else Colors.Purple
val receivingColor = if (status == ChannelStatusUi.CLOSED) Colors.Gray5 else Colors.White64
val receivingColor = when {
receivingUnlimited -> Colors.White
status == ChannelStatusUi.CLOSED -> Colors.Gray5
else -> Colors.White64
}
val receivingAvailableColor = if (status == ChannelStatusUi.CLOSED) Colors.Gray3 else Colors.White

val spendingAvailableFraction = if (capacity > 0) localBalance.toFloat() / capacity else 0f
val receivingAvailableFraction = if (capacity > 0) remoteBalance.toFloat() / capacity else 0f
val receivingAvailableFraction = when {
receivingUnlimited -> 1f
capacity > 0 -> remoteBalance.toFloat() / capacity
else -> 0f
}

Column(
modifier = modifier
Expand Down Expand Up @@ -90,10 +99,17 @@ fun LightningChannel(
tint = receivingAvailableColor,
modifier = Modifier.size(14.dp)
)
MoneyCaptionB(
sats = remoteBalance,
color = receivingAvailableColor,
)
if (receivingUnlimited) {
CaptionB(
text = stringResource(R.string.lightning__spark_receiving_unlimited),
color = receivingAvailableColor,
)
} else {
MoneyCaptionB(
sats = remoteBalance,
color = receivingAvailableColor,
)
}
}
}
}
Expand Down Expand Up @@ -202,4 +218,19 @@ private fun PreviewChannelClosed() {
}
}

@Preview(showBackground = true)
@Composable
private fun PreviewReceivingUnlimited() {
AppThemeSurface {
LightningChannel(
capacity = 580_000,
localBalance = 580_000,
remoteBalance = 0,
status = ChannelStatusUi.OPEN,
receivingUnlimited = true,
modifier = Modifier.padding(16.dp)
)
}
}

// endregion
76 changes: 41 additions & 35 deletions app/src/main/java/to/bitkit/ui/screens/transfer/FundingScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ fun FundingScreen(
modifier = Modifier.padding(horizontal = 16.dp),
)
VerticalSpacer(24.dp)
// Spark keeps Spending fundable from savings or another wallet without a channel.
if (canFundWithSpark) {
FundingOption(
R.string.lightning__funding__button1,
Expand All @@ -88,51 +87,58 @@ fun FundingScreen(
"FundTransfer",
{ if (hasSavings) onTransfer() else showNoFundsAlert = true }.takeIf { canFundOnChain },
)
FundingOption(
R.string.lightning__funding__button_hw,
R.drawable.ic_device_tablet_speaker,
16.25.dp,
"FundHardware",
onHardware.takeIf { canFundOnChain },
)
FundingOption(
R.string.lightning__funding__button2,
R.drawable.ic_qr_purple,
13.75.dp,
"FundReceive",
onFund
onFund,
)
FundingOption(
R.string.lightning__funding_advanced__button2,
R.drawable.ic_pencil_full,
13.37.dp,
"FundManual",
onManual,
)
} else {
FundingOption(
R.string.lightning__funding_advanced__button2,
R.drawable.ic_pencil_full,
13.37.dp,
"FundManual",
onManual,
)
}
VerticalSpacer(8.dp)
RectangleButton(
label = stringResource(R.string.lightning__funding_advanced__button2),
icon = R.drawable.ic_pencil_full,
iconTint = Colors.Purple,
iconSize = 13.37.dp,
onClick = onManual,
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 16.dp)
.testTag("FundManual")
)
if (!canFundWithSpark) {
FundingOption(R.string.lightning__funding__button1, R.drawable.ic_transfer, 20.dp, "FundTransfer")
}
FundingOption(
R.string.lightning__funding__button_hw,
R.drawable.ic_device_tablet_speaker,
16.25.dp,
"FundHardware",
onHardware.takeIf { canFundWithSpark && canFundOnChain },
)
if (!canFundWithSpark) {
FundingOption(
R.string.lightning__funding__button_hw,
R.drawable.ic_device_tablet_speaker,
16.25.dp,
"FundHardware",
)
FundingOption(R.string.lightning__funding__button2, R.drawable.ic_qr_purple, 13.75.dp, "FundReceive")
}
VerticalSpacer(32.dp)
}
SecondaryButton(
text = stringResource(R.string.common__learn_more),
onClick = {
runCatching { context.startActivity(Intent(Intent.ACTION_VIEW, Env.BLOCKTANK_SUNSET_URL.toUri())) }
},
modifier = Modifier
.padding(horizontal = 16.dp)
.testTag("FundLearnMore")
)
VerticalSpacer(16.dp)
if (!canFundWithSpark) {
SecondaryButton(
text = stringResource(R.string.common__learn_more),
onClick = {
runCatching { context.startActivity(Intent(Intent.ACTION_VIEW, Env.BLOCKTANK_SUNSET_URL.toUri())) }
},
modifier = Modifier
.padding(horizontal = 16.dp)
.testTag("FundLearnMore")
)
VerticalSpacer(16.dp)
}
if (showNoFundsAlert) {
AppAlertDialog(
title = stringResource(R.string.lightning__no_funds__title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ internal fun Content(
.fillMaxWidth()
.testTag("SettingUpText")
)
VerticalSpacer(28.dp)
if (isSuccess) {
VerticalSpacer(44.dp)
Box(
contentAlignment = Alignment.Center,
contentAlignment = Alignment.TopCenter,
modifier = Modifier
.weight(1f)
.fillMaxWidth()
Expand All @@ -147,19 +147,20 @@ internal fun Content(
)
}
} else {
VerticalSpacer(32.dp)
Illustration(
hasCoins = frame.hasCoins,
modifier = Modifier
.weight(1f)
.fillMaxWidth()
)
VerticalSpacer(16.dp)
VerticalSpacer(14.dp)
ProgressSteps(
steps = steps(frame),
activeStepIndex = frame.stepIndex,
modifier = Modifier.align(alignment = Alignment.CenterHorizontally)
)
VerticalSpacer(16.dp)
VerticalSpacer(32.dp)
}
Buttons(
frame = frame,
Expand Down
Loading
Loading