Skip to content

Commit 3c561b2

Browse files
committed
Merge branch 'feat/new-receive-sheet' into feat/send-sheet-redesign
2 parents 73bad57 + 2baacf3 commit 3c561b2

File tree

6 files changed

+455
-78
lines changed

6 files changed

+455
-78
lines changed

app/src/main/java/to/bitkit/ui/screens/wallets/activity/components/CustomTabRowWithSpacing.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,21 @@ fun <T : TabItem> CustomTabRowWithSpacing(
6161
)
6262
}
6363

64-
// Animated indicator
6564
val animatedAlpha by animateFloatAsState(
6665
targetValue = if (isSelected) 1f else 0.2f,
67-
animationSpec = tween(durationMillis = 300, easing = FastOutSlowInEasing),
66+
animationSpec = tween(
67+
durationMillis = 250,
68+
easing = FastOutSlowInEasing
69+
),
6870
label = "indicatorAlpha"
6971
)
7072

7173
val animatedColor by animateColorAsState(
7274
targetValue = if (isSelected) selectedColor else Colors.White,
73-
animationSpec = tween(durationMillis = 300, easing = FastOutSlowInEasing),
75+
animationSpec = tween(
76+
durationMillis = 250,
77+
easing = FastOutSlowInEasing
78+
),
7479
label = "indicatorColor"
7580
)
7681

app/src/main/java/to/bitkit/ui/screens/wallets/receive/ReceiveInvoiceUtils.kt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ fun getInvoiceForTab(
2222
): String {
2323
return when (tab) {
2424
ReceiveTab.SAVINGS -> {
25-
onchainAddress
25+
// Return BIP21 without lightning parameter to preserve amount and other parameters
26+
removeLightningFromBip21(bip21, onchainAddress)
2627
}
2728

2829
ReceiveTab.AUTO -> {
@@ -37,6 +38,25 @@ fun getInvoiceForTab(
3738
}
3839
}
3940

41+
/**
42+
* Removes the lightning parameter from a BIP21 URI while preserving all other parameters.
43+
*
44+
* @param bip21 Full BIP21 URI (e.g., bitcoin:address?amount=0.001&lightning=lnbc...)
45+
* @param fallbackAddress Fallback address if BIP21 is empty or invalid
46+
* @return BIP21 URI without the lightning parameter (e.g., bitcoin:address?amount=0.001)
47+
*/
48+
fun removeLightningFromBip21(bip21: String, fallbackAddress: String): String {
49+
if (bip21.isBlank()) return fallbackAddress
50+
51+
// Remove lightning parameter using regex
52+
// Handles both "?lightning=..." and "&lightning=..." cases
53+
val withoutLightning = bip21
54+
.replace(Regex("[?&]lightning=[^&]*"), "")
55+
.replace(Regex("\\?$"), "") // Remove trailing ? if it's the last char
56+
57+
return withoutLightning.ifBlank { fallbackAddress }
58+
}
59+
4060
/**
4161
* Returns the appropriate QR code logo resource for the selected tab.
4262
*

0 commit comments

Comments
 (0)