File tree Expand file tree Collapse file tree
main/java/to/bitkit/ui/screens/wallets
test/java/to/bitkit/ui/screens/wallets/receive Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## [ Unreleased]
99
10+ ### Fixed
11+ - Fix crash when returning app to foreground on Receive screen #875
12+ - Show loading state on Spending tab when node is not running #875
13+
1014### Added
1115- Lightning Connections empty state with onboarding screen #857
1216- Unified PIN management screen (enable/disable/change in one place) #857
Original file line number Diff line number Diff line change @@ -39,8 +39,9 @@ fun <T : TabItem> CustomTabRowWithSpacing(
3939 horizontalArrangement = Arrangement .SpaceEvenly ,
4040 modifier = Modifier .fillMaxWidth()
4141 ) {
42+ val safeIndex = currentTabIndex.coerceIn(0 , tabs.lastIndex)
4243 tabs.forEachIndexed { index, tab ->
43- val isSelected = tabs[currentTabIndex ] == tab
44+ val isSelected = tabs[safeIndex ] == tab
4445
4546 Column (
4647 modifier = Modifier .weight(1f )
Original file line number Diff line number Diff line change @@ -32,9 +32,9 @@ fun getInvoiceForTab(
3232 }
3333
3434 ReceiveTab .SPENDING -> {
35- // Lightning only: prefer CJIT > bolt11
35+ // Lightning only: prefer CJIT > bolt11, empty when node is not running
3636 cjitInvoice?.takeIf { it.isNotEmpty() && isNodeRunning }
37- ? : bolt11
37+ ? : bolt11. takeIf { isNodeRunning }.orEmpty()
3838 }
3939 }
4040}
Original file line number Diff line number Diff line change @@ -145,6 +145,12 @@ fun ReceiveQrScreen(
145145 mutableStateOf(initialTab ? : ReceiveTab .SAVINGS )
146146 }
147147
148+ LaunchedEffect (visibleTabs) {
149+ if (selectedTab !in visibleTabs) {
150+ selectedTab = visibleTabs.first()
151+ }
152+ }
153+
148154 LaunchedEffect (lazyListState, visibleTabs.size) {
149155 snapshotFlow { lazyListState.firstVisibleItemIndex }
150156 .distinctUntilChanged()
Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ class ReceiveInvoiceUtilsTest {
200200 }
201201
202202 @Test
203- fun `getInvoiceForTab SPENDING returns bolt11 when node not running even with CJIT` () {
203+ fun `getInvoiceForTab SPENDING returns empty when node not running even with CJIT` () {
204204 val bip21 = " bitcoin:$testAddress ?lightning=$testBolt11 "
205205
206206 val result = getInvoiceForTab(
@@ -212,7 +212,23 @@ class ReceiveInvoiceUtilsTest {
212212 onchainAddress = testAddress
213213 )
214214
215- assertEquals(testBolt11, result)
215+ assertEquals(" " , result)
216+ }
217+
218+ @Test
219+ fun `getInvoiceForTab SPENDING returns empty when node not running and no CJIT` () {
220+ val bip21 = " bitcoin:$testAddress ?lightning=$testBolt11 "
221+
222+ val result = getInvoiceForTab(
223+ tab = ReceiveTab .SPENDING ,
224+ bip21 = bip21,
225+ bolt11 = testBolt11,
226+ cjitInvoice = null ,
227+ isNodeRunning = false ,
228+ onchainAddress = testAddress
229+ )
230+
231+ assertEquals(" " , result)
216232 }
217233
218234 @Test
You can’t perform that action at this time.
0 commit comments