File tree Expand file tree Collapse file tree
main/java/to/bitkit/ui/screens/wallets/receive
test/java/to/bitkit/ui/screens/wallets/receive Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,5 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
1010### Fixed
1111- Fix crash when returning app to foreground on Receive screen
12+ - Show loading state on Spending tab when node is not running
1213
1314[ Unreleased ] : https://github.com/synonymdev/bitkit-android/compare/v2.1.2...HEAD
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 @@ -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