Skip to content

Commit

Permalink
(android) Fix navigation threading issue in lnurl-pay
Browse files Browse the repository at this point in the history
  • Loading branch information
dpad85 committed Nov 26, 2024
1 parent 7439267 commit f02abc7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ fun SendView(
SendToOfferView(offer = data.offer, onBackClick = onBackClick, onPaymentSent = { navController.popToHome() })
}
is SendManager.ParseResult.Uri -> {
SendSpliceOutView(requestedAmount = data.uri.amount, address = data.uri.address, onBackClick = onBackClick, onSpliceOutSuccess = {navController.popToHome() })
SendSpliceOutView(requestedAmount = data.uri.amount, address = data.uri.address, onBackClick = onBackClick, onSpliceOutSuccess = { navController.popToHome() })
}
is SendManager.ParseResult.Lnurl.Pay -> {
LnurlPayView(payIntent = data.paymentIntent, onBackClick, onPaymentSent = { navController.popToHome() })
}
is SendManager.ParseResult.Lnurl.Withdraw -> {
LnurlWithdrawView(withdraw = data.lnurlWithdraw, onBackClick = onBackClick, onFeeManagementClick = { navController.navigate(Screen.LiquidityPolicy.route) }, onWithdrawDone = { navController.popToHome()})
LnurlWithdrawView(withdraw = data.lnurlWithdraw, onBackClick = onBackClick, onFeeManagementClick = { navController.navigate(Screen.LiquidityPolicy.route) }, onWithdrawDone = { navController.popToHome() })
}
is SendManager.ParseResult.Lnurl.Auth -> {
LnurlAuthView(auth = data.auth, onBackClick = { navController.popBackStack() }, onChangeAuthSchemeSettingClick = { navController.navigate("${Screen.PaymentSettings.route}?showAuthSchemeDialog=true") },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ class LnurlPayViewModel(private val sendManager: SendManager) : ViewModel() {
val invoice = result.value
state.value = LnurlPayViewState.PayingInvoice(invoice)
sendManager.lnurlPay_payInvoice(payIntent, amount, comment, invoice, fees)
onPaymentSent()
viewModelScope.launch(Dispatchers.Main) {
onPaymentSent()
}
}
}
}
Expand Down

0 comments on commit f02abc7

Please sign in to comment.