qml: don't show ln payment dialog, update info text instead
This commit is contained in:
@@ -47,10 +47,11 @@ ElDialog {
|
|||||||
columns: 2
|
columns: 2
|
||||||
|
|
||||||
InfoTextArea {
|
InfoTextArea {
|
||||||
|
id: helpText
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.bottomMargin: constants.paddingLarge
|
Layout.bottomMargin: constants.paddingLarge
|
||||||
visible: invoice.userinfo
|
visible: text
|
||||||
text: invoice.userinfo
|
text: invoice.userinfo
|
||||||
iconStyle: InfoTextArea.IconStyle.Warn
|
iconStyle: InfoTextArea.IconStyle.Warn
|
||||||
}
|
}
|
||||||
@@ -457,14 +458,34 @@ ElDialog {
|
|||||||
// save invoice if new or modified
|
// save invoice if new or modified
|
||||||
invoice.save_invoice()
|
invoice.save_invoice()
|
||||||
}
|
}
|
||||||
dialog.close()
|
|
||||||
doPay() // only signal here
|
doPay() // only signal here
|
||||||
|
helpText.text = qsTr('Payment in progress...')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Daemon.currentWallet
|
||||||
|
function onPaymentSucceeded(key) {
|
||||||
|
if (key != invoice.key) {
|
||||||
|
console.log('wrong invoice ' + key + ' != ' + invoice.key)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log('payment succeeded!')
|
||||||
|
helpText.text = qsTr('Paid!')
|
||||||
|
}
|
||||||
|
function onPaymentFailed(key, reason) {
|
||||||
|
if (key != invoice.key) {
|
||||||
|
console.log('wrong invoice ' + key + ' != ' + invoice.key)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log('payment failed: ' + reason)
|
||||||
|
helpText.text = qsTr('Payment failed: ' + reason)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (invoice_key != '') {
|
if (invoice_key != '') {
|
||||||
invoice.initFromKey(invoice_key)
|
invoice.initFromKey(invoice_key)
|
||||||
|
|||||||
@@ -312,13 +312,8 @@ Item {
|
|||||||
console.log('No invoice key, aborting')
|
console.log('No invoice key, aborting')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var dialog = lightningPaymentProgressDialog.createObject(mainView, {
|
|
||||||
invoice_key: invoice.key
|
|
||||||
})
|
|
||||||
dialog.open()
|
|
||||||
Daemon.currentWallet.pay_lightning_invoice(invoice.key)
|
Daemon.currentWallet.pay_lightning_invoice(invoice.key)
|
||||||
}
|
}
|
||||||
close()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosed: destroy()
|
onClosed: destroy()
|
||||||
|
|||||||
@@ -347,8 +347,10 @@ class QEInvoiceParser(QEInvoice):
|
|||||||
|
|
||||||
self.canSave = True
|
self.canSave = True
|
||||||
|
|
||||||
if amount.isEmpty: # unspecified amount
|
if self.amount.isEmpty:
|
||||||
self.userinfo = _('Enter the amount you want to send')
|
self.userinfo = _('Enter the amount you want to send')
|
||||||
|
|
||||||
|
if amount.isEmpty and self.status == PR_UNPAID: # unspecified amount
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.invoiceType == QEInvoice.Type.LightningInvoice:
|
if self.invoiceType == QEInvoice.Type.LightningInvoice:
|
||||||
|
|||||||
Reference in New Issue
Block a user