From 6fad3daa2d822094c2ec36f7349c6e946617f317 Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Mon, 14 Sep 2026 13:48:26 -0300 Subject: [PATCH 1/2] fix: use blue accent on hw send confirm screen --- .../wallets/send/SendConfirmScreenTest.kt | 70 +++++++++++++++++++ .../screens/wallets/send/SendConfirmScreen.kt | 28 ++++++++ changelog.d/next/1259.fixed.md | 1 + 3 files changed, 99 insertions(+) create mode 100644 changelog.d/next/1259.fixed.md diff --git a/app/src/androidTest/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreenTest.kt b/app/src/androidTest/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreenTest.kt index 20e55fd28d..a03b01932b 100644 --- a/app/src/androidTest/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreenTest.kt +++ b/app/src/androidTest/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreenTest.kt @@ -1,20 +1,26 @@ package to.bitkit.ui.screens.wallets.send import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.graphics.toPixelMap import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.test.assertIsDisplayed +import androidx.compose.ui.test.captureToImage import androidx.compose.ui.test.junit4.v2.createComposeRule import androidx.compose.ui.test.onNodeWithTag import androidx.compose.ui.test.onNodeWithText +import androidx.compose.ui.test.onRoot import androidx.compose.ui.test.performScrollTo import org.junit.Rule import org.junit.Test import to.bitkit.models.FeeRate import to.bitkit.test.annotations.ComposeUi import to.bitkit.ui.theme.AppThemeSurface +import to.bitkit.ui.theme.Colors import to.bitkit.viewmodels.OnchainFeeUi import to.bitkit.viewmodels.SendMethod import to.bitkit.viewmodels.SendUiState +import kotlin.test.assertEquals +import kotlin.test.assertTrue @ComposeUi class SendConfirmScreenTest { @@ -50,4 +56,68 @@ class SendConfirmScreenTest { composeTestRule.onNodeWithTag("SendConfirmToggleDetails").assertIsDisplayed() composeTestRule.onNodeWithText("Swipe To Subscribe & Pay").performScrollTo().assertIsDisplayed() } + + @Test + fun onchainSendFromSavingsUsesBrandAccent() { + setConfirmContent(hardwareWalletId = null) + + val pixels = accentPixelCounts() + + assertTrue(pixels.brand > 0, "expected brand accent pixels, got ${pixels.brand}") + assertEquals(0, pixels.blue, "expected no blue accent pixels") + } + + @Test + fun onchainSendFromHardwareWalletUsesBlueAccent() { + setConfirmContent(hardwareWalletId = "hw-wallet-id") + + val pixels = accentPixelCounts() + + assertTrue(pixels.blue > 0, "expected blue accent pixels, got ${pixels.blue}") + assertEquals(0, pixels.brand, "expected no brand accent pixels") + } + + private fun setConfirmContent(hardwareWalletId: String?) { + val state = SendUiState( + amount = 10_000u, + payMethod = SendMethod.ONCHAIN, + isAmountInputValid = true, + hardwareWalletId = hardwareWalletId, + hardwareWalletName = hardwareWalletId?.let { "Trezor Safe 7" }, + onchainFeeUi = OnchainFeeUi(rate = FeeRate.NORMAL, sats = 422), + ) + composeTestRule.setContent { + AppThemeSurface { + CompositionLocalProvider(LocalInspectionMode provides true) { + SendConfirmContent( + uiState = state, + isNodeRunning = true, + isLoading = false, + showBiometrics = false, + ) + } + } + } + } + + private fun accentPixelCounts(): AccentPixelCounts { + val pixelMap = composeTestRule.onRoot().captureToImage().toPixelMap() + var brand = 0 + var blue = 0 + for (y in 0 until pixelMap.height) { + for (x in 0 until pixelMap.width) { + when (pixelMap[x, y]) { + Colors.Brand -> brand++ + Colors.Blue -> blue++ + else -> Unit + } + } + } + return AccentPixelCounts(brand = brand, blue = blue) + } } + +private data class AccentPixelCounts( + val brand: Int, + val blue: Int, +) diff --git a/app/src/main/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreen.kt b/app/src/main/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreen.kt index 42f259aa8e..8a367bc7a9 100644 --- a/app/src/main/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreen.kt +++ b/app/src/main/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreen.kt @@ -318,6 +318,7 @@ private fun ContentRunning( val isHardwareFeeLoading = uiState.hardwareWalletId != null && uiState.onchainFeeUi.isLoading val accentColor = when (uiState.payMethod) { + SendMethod.ONCHAIN if uiState.hardwareWalletId != null -> Colors.Blue SendMethod.ONCHAIN -> Colors.Brand SendMethod.LIGHTNING -> Colors.Purple } @@ -918,6 +919,33 @@ private fun PreviewOnChainDetails() { } } +@Suppress("MagicNumber") +@Preview(showSystemUi = true, group = "onchain details") +@Composable +private fun PreviewOnChainHardwareDetails() { + AppThemeSurface { + BottomSheetPreview { + SendConfirmContent( + uiState = sendUiState().copy( + hardwareWalletId = "wallet-id", + hardwareWalletName = "Trezor Safe 7", + canSwitchFundingSource = true, + speed = TransactionSpeed.Medium, + onchainFeeUi = OnchainFeeUi( + rate = FeeRate.NORMAL, + sats = 1_234, + ), + ), + isNodeRunning = true, + isLoading = false, + showBiometrics = false, + initialShowDetails = true, + modifier = Modifier.sheetHeight() + ) + } + } +} + @Suppress("MagicNumber") @Preview(showSystemUi = true, group = "lightning details") @Composable diff --git a/changelog.d/next/1259.fixed.md b/changelog.d/next/1259.fixed.md new file mode 100644 index 0000000000..d263f2dce4 --- /dev/null +++ b/changelog.d/next/1259.fixed.md @@ -0,0 +1 @@ +The swipe-to-confirm slider on the send confirmation screen now uses the blue hardware accent when the funding source is a hardware wallet. From be021a0bebc9771e8cb49f7cf710c9d71279d37d Mon Sep 17 00:00:00 2001 From: jvsena42 Date: Mon, 14 Sep 2026 13:55:56 -0300 Subject: [PATCH 2/2] chore: rename changelog fragment --- changelog.d/next/{1259.fixed.md => 1263.fixed.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename changelog.d/next/{1259.fixed.md => 1263.fixed.md} (100%) diff --git a/changelog.d/next/1259.fixed.md b/changelog.d/next/1263.fixed.md similarity index 100% rename from changelog.d/next/1259.fixed.md rename to changelog.d/next/1263.fixed.md