Browse Source

qml: keep lnurlData even after bolt11 has been retrieved, add isLnurlPay property and save bolt11 before triggering pay

master
Sander van Grieken 3 years ago
parent
commit
2bdc303662
  1. 8
      electrum/gui/qml/components/InvoiceDialog.qml
  2. 6
      electrum/gui/qml/qeinvoice.py

8
electrum/gui/qml/components/InvoiceDialog.qml

@ -456,10 +456,14 @@ ElDialog {
} else if (invoice.amount.isMax) { } else if (invoice.amount.isMax) {
amountMax.checked = true amountMax.checked = true
} }
if (invoice.lnurlData) { if (invoice.isLnurlPay) {
// we arrive from a lnurl-pay confirm dialog where the user already indicated the intent to pay. // we arrive from a lnurl-pay confirm dialog where the user already indicated the intent to pay.
if (invoice.canPay) if (invoice.canPay) {
if (invoice_key == '') {
invoice.save_invoice()
}
doPay() doPay()
}
} }
} }
} }

6
electrum/gui/qml/qeinvoice.py

@ -203,10 +203,8 @@ class QEInvoiceParser(QEInvoice, QtEventListener):
@recipient.setter @recipient.setter
def recipient(self, recipient: str): def recipient(self, recipient: str):
#if self._recipient != recipient:
self.canPay = False self.canPay = False
self._recipient = recipient self._recipient = recipient
self._lnurlData = None
self.amountOverride = QEAmount() self.amountOverride = QEAmount()
if recipient: if recipient:
self.validateRecipient(recipient) self.validateRecipient(recipient)
@ -216,6 +214,10 @@ class QEInvoiceParser(QEInvoice, QtEventListener):
def lnurlData(self): def lnurlData(self):
return self._lnurlData return self._lnurlData
@pyqtProperty(bool, notify=lnurlRetrieved)
def isLnurlPay(self):
return not self._lnurlData is None
@pyqtProperty(str, notify=invoiceChanged) @pyqtProperty(str, notify=invoiceChanged)
def message(self): def message(self):
return self._effectiveInvoice.message if self._effectiveInvoice else '' return self._effectiveInvoice.message if self._effectiveInvoice else ''

Loading…
Cancel
Save