qml: remove green check-mark on request paid, open lightning payment details (LN) or Tx details (on-chain) instead
This commit is contained in:
@@ -12,23 +12,25 @@ ElDialog {
|
|||||||
id: dialog
|
id: dialog
|
||||||
|
|
||||||
title: qsTr('Receive Payment')
|
title: qsTr('Receive Payment')
|
||||||
|
iconSource: Qt.resolvedUrl('../../icons/tab_receive.png')
|
||||||
|
|
||||||
property string key
|
property string key
|
||||||
|
property bool isLightning: request.isLightning
|
||||||
|
|
||||||
property string _bolt11: request.bolt11
|
property string _bolt11: request.bolt11
|
||||||
property string _bip21uri: request.bip21
|
property string _bip21uri: request.bip21
|
||||||
property string _address: request.address
|
property string _address: request.address
|
||||||
|
|
||||||
property bool _render_qr: false // delay qr rendering until dialog is shown
|
property bool _render_qr: false // delay qr rendering until dialog is shown
|
||||||
|
|
||||||
property bool _ispaid: false
|
signal requestPaid
|
||||||
|
|
||||||
iconSource: Qt.resolvedUrl('../../icons/tab_receive.png')
|
|
||||||
|
|
||||||
padding: 0
|
padding: 0
|
||||||
|
|
||||||
|
function getPaidTxid() {
|
||||||
|
return request.paidTxid
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
visible: !_ispaid
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
@@ -40,7 +42,7 @@ ElDialog {
|
|||||||
rightMargin: constants.paddingLarge
|
rightMargin: constants.paddingLarge
|
||||||
|
|
||||||
contentHeight: rootLayout.height
|
contentHeight: rootLayout.height
|
||||||
clip:true
|
clip: true
|
||||||
interactive: height < contentHeight
|
interactive: height < contentHeight
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
@@ -186,43 +188,12 @@ ElDialog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
visible: _ispaid
|
|
||||||
anchors.centerIn: parent
|
|
||||||
states: [
|
|
||||||
State {
|
|
||||||
name: 'paid'
|
|
||||||
when: _ispaid
|
|
||||||
}
|
|
||||||
]
|
|
||||||
transitions: [
|
|
||||||
Transition {
|
|
||||||
from: ''
|
|
||||||
to: 'paid'
|
|
||||||
NumberAnimation { target: paidIcon; properties: 'opacity'; from: 0; to: 1; duration: 200 }
|
|
||||||
NumberAnimation { target: paidIcon; properties: 'scale'; from: 0; to: 1; duration: 500; easing.type: Easing.OutBack; easing.overshoot: 10 }
|
|
||||||
}
|
|
||||||
]
|
|
||||||
Image {
|
|
||||||
id: paidIcon
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
Layout.preferredWidth: constants.iconSizeXXLarge
|
|
||||||
Layout.preferredHeight: constants.iconSizeXXLarge
|
|
||||||
source: '../../icons/confirmed.png'
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
text: qsTr('Paid!')
|
|
||||||
font.pixelSize: constants.fontSizeXXLarge
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RequestDetails {
|
RequestDetails {
|
||||||
id: request
|
id: request
|
||||||
wallet: Daemon.currentWallet
|
wallet: Daemon.currentWallet
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status == RequestDetails.Paid || status == RequestDetails.Unconfirmed) {
|
if (status == RequestDetails.Paid || status == RequestDetails.Unconfirmed) {
|
||||||
_ispaid = true
|
requestPaid()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -639,6 +639,15 @@ Item {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
|
onRequestPaid: {
|
||||||
|
close()
|
||||||
|
if (isLightning) {
|
||||||
|
app.stack.push(Qt.resolvedUrl('LightningPaymentDetails.qml'), {'key': key})
|
||||||
|
} else {
|
||||||
|
let paidTxid = getPaidTxid()
|
||||||
|
app.stack.push(Qt.resolvedUrl('TxDetails.qml'), {'txid': paidTxid})
|
||||||
|
}
|
||||||
|
}
|
||||||
onClosed: destroy()
|
onClosed: destroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class QERequestDetails(QObject, QtEventListener):
|
|||||||
|
|
||||||
_logger = get_logger(__name__)
|
_logger = get_logger(__name__)
|
||||||
|
|
||||||
detailsChanged = pyqtSignal() # generic request properties changed signal
|
detailsChanged = pyqtSignal() # generic request properties changed signal
|
||||||
statusChanged = pyqtSignal()
|
statusChanged = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
@@ -95,7 +95,7 @@ class QERequestDetails(QObject, QtEventListener):
|
|||||||
|
|
||||||
@pyqtProperty(bool, notify=detailsChanged)
|
@pyqtProperty(bool, notify=detailsChanged)
|
||||||
def isLightning(self):
|
def isLightning(self):
|
||||||
return self._req.is_lightning()
|
return self._req.is_lightning() if self._req else False
|
||||||
|
|
||||||
@pyqtProperty(str, notify=detailsChanged)
|
@pyqtProperty(str, notify=detailsChanged)
|
||||||
def address(self):
|
def address(self):
|
||||||
@@ -118,6 +118,16 @@ class QERequestDetails(QObject, QtEventListener):
|
|||||||
def expiration(self):
|
def expiration(self):
|
||||||
return self._req.get_expiration_date()
|
return self._req.get_expiration_date()
|
||||||
|
|
||||||
|
@pyqtProperty(str, notify=statusChanged)
|
||||||
|
def paidTxid(self):
|
||||||
|
"""only used when Request status is PR_PAID"""
|
||||||
|
if not self._req:
|
||||||
|
return ''
|
||||||
|
is_paid, conf_needed, txids = self._wallet.wallet._is_onchain_invoice_paid(self._req)
|
||||||
|
if len(txids) > 0:
|
||||||
|
return txids[0]
|
||||||
|
return ''
|
||||||
|
|
||||||
@pyqtProperty(str, notify=detailsChanged)
|
@pyqtProperty(str, notify=detailsChanged)
|
||||||
def bolt11(self):
|
def bolt11(self):
|
||||||
wallet = self._wallet.wallet
|
wallet = self._wallet.wallet
|
||||||
|
|||||||
Reference in New Issue
Block a user