Skip to content

Commit 4d8d2d1

Browse files
committed
refactor: remove repeated code
1 parent f21cd5f commit 4d8d2d1

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

app/src/main/java/to/bitkit/viewmodels/WalletViewModel.kt

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -278,35 +278,7 @@ class WalletViewModel @Inject constructor(
278278
}
279279
}
280280

281-
var newBip21 = "bitcoin:$_onchainAddress"
282-
283-
val hasChannels = lightningService.channels?.isNotEmpty() == true
284-
if (hasChannels) {
285-
286-
// TODO: check current bolt11 for expiry (fix payments not working with commented code & rm next line):
287-
_bolt11 = createInvoice(description = "Bitkit")
288-
289-
// if (_bolt11.isEmpty()) {
290-
// _bolt11 = createInvoice(description = "Bitkit")
291-
// } else {
292-
// // Check if existing invoice has expired and create a new one if so
293-
// decode(invoice = _bolt11).let { decoded ->
294-
// if (decoded is Scanner.Lightning && decoded.invoice.isExpired) {
295-
// _bolt11 = createInvoice(description = "Bitkit")
296-
// }
297-
// }
298-
// }
299-
} else {
300-
_bolt11 = ""
301-
}
302-
303-
if (_bolt11.isNotEmpty()) {
304-
newBip21 += "?lightning=$_bolt11"
305-
}
306-
307-
_bip21 = newBip21
308-
309-
syncState()
281+
updateBip21Invoice(description = "Bitkit")
310282
}
311283

312284
fun disconnectPeer(peer: LnPeer) {

0 commit comments

Comments
 (0)