Qml: new receive flow. fixes #8258
This commit is contained in:
@@ -11,7 +11,7 @@ import "controls"
|
||||
ElDialog {
|
||||
id: dialog
|
||||
|
||||
title: qsTr('Edit payment request')
|
||||
title: qsTr('Receive payment')
|
||||
|
||||
property alias amount: amountBtc.text
|
||||
property alias description: message.text
|
||||
@@ -19,7 +19,6 @@ ElDialog {
|
||||
|
||||
parent: Overlay.overlay
|
||||
modal: true
|
||||
iconSource: Qt.resolvedUrl('../../icons/pen.png')
|
||||
|
||||
Overlay.modal: Rectangle {
|
||||
color: "#aa000000"
|
||||
@@ -130,7 +129,7 @@ ElDialog {
|
||||
|
||||
FlatButton {
|
||||
Layout.fillWidth: true
|
||||
text: qsTr('Apply')
|
||||
text: qsTr('Create request')
|
||||
icon.source: '../../icons/confirmed.png'
|
||||
onClicked: accept()
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ ElDialog {
|
||||
property bool _render_qr: false // delay qr rendering until dialog is shown
|
||||
|
||||
property bool _ispaid: false
|
||||
property bool _ignore_gaplimit: false
|
||||
property bool _reuse_address: false
|
||||
|
||||
parent: Overlay.overlay
|
||||
modal: true
|
||||
@@ -283,14 +281,6 @@ ElDialog {
|
||||
enabled = true
|
||||
}
|
||||
}
|
||||
FlatButton {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredWidth: 1
|
||||
|
||||
icon.source: '../../icons/pen.png'
|
||||
text: qsTr('Edit')
|
||||
onClicked: receiveDetailsDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,41 +324,6 @@ ElDialog {
|
||||
FocusScope { id: parkFocus }
|
||||
}
|
||||
|
||||
function createRequest() {
|
||||
var qamt = Config.unitsToSats(receiveDetailsDialog.amount)
|
||||
Daemon.currentWallet.createRequest(qamt, receiveDetailsDialog.description, receiveDetailsDialog.expiry, _ignore_gaplimit, _reuse_address)
|
||||
}
|
||||
|
||||
function createDefaultRequest() {
|
||||
console.log('Creating default request')
|
||||
Daemon.currentWallet.createDefaultRequest(_ignore_gaplimit, _reuse_address)
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Daemon.currentWallet
|
||||
function onRequestCreateSuccess(key) {
|
||||
request.key = key
|
||||
}
|
||||
function onRequestCreateError(code, error) {
|
||||
if (code == 'gaplimit') {
|
||||
var dialog = app.messageDialog.createObject(app, {text: error, yesno: true})
|
||||
dialog.yesClicked.connect(function() {
|
||||
_ignore_gaplimit = true
|
||||
createDefaultRequest()
|
||||
})
|
||||
} else if (code == 'non-deterministic') {
|
||||
var dialog = app.messageDialog.createObject(app, {text: error, yesno: true})
|
||||
dialog.yesClicked.connect(function() {
|
||||
_reuse_address = true
|
||||
createDefaultRequest()
|
||||
})
|
||||
} else {
|
||||
console.log(error)
|
||||
var dialog = app.messageDialog.createObject(app, {text: error})
|
||||
}
|
||||
dialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
RequestDetails {
|
||||
id: request
|
||||
@@ -396,22 +351,6 @@ ElDialog {
|
||||
}
|
||||
}
|
||||
|
||||
ReceiveDetailsDialog {
|
||||
id: receiveDetailsDialog
|
||||
|
||||
width: parent.width * 0.9
|
||||
anchors.centerIn: parent
|
||||
|
||||
onAccepted: {
|
||||
console.log('accepted')
|
||||
Daemon.currentWallet.delete_request(request.key)
|
||||
createRequest()
|
||||
}
|
||||
onRejected: {
|
||||
console.log('rejected')
|
||||
}
|
||||
}
|
||||
|
||||
Toaster {
|
||||
id: toaster
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ Item {
|
||||
property var _sendDialog
|
||||
property string _intentUri
|
||||
|
||||
property bool _ignore_gaplimit: false
|
||||
property bool _reuse_address: false
|
||||
|
||||
function openInvoice(key) {
|
||||
var dialog = invoiceDialog.createObject(app, { invoice: invoiceParser, invoice_key: key })
|
||||
dialog.open()
|
||||
@@ -168,7 +171,7 @@ Item {
|
||||
icon.source: '../../icons/tab_receive.png'
|
||||
text: qsTr('Receive')
|
||||
onClicked: {
|
||||
var dialog = receiveDialog.createObject(mainView)
|
||||
var dialog = receiveDetails.createObject(mainView)
|
||||
dialog.open()
|
||||
}
|
||||
}
|
||||
@@ -238,6 +241,31 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Daemon.currentWallet
|
||||
function onRequestCreateSuccess(key) {
|
||||
openRequest(key)
|
||||
}
|
||||
function onRequestCreateError(code, error) {
|
||||
if (code == 'gaplimit') {
|
||||
var dialog = app.messageDialog.createObject(app, {text: error, yesno: true})
|
||||
dialog.yesClicked.connect(function() {
|
||||
_ignore_gaplimit = true
|
||||
createDefaultRequest()
|
||||
})
|
||||
} else if (code == 'non-deterministic') {
|
||||
var dialog = app.messageDialog.createObject(app, {text: error, yesno: true})
|
||||
dialog.yesClicked.connect(function() {
|
||||
_reuse_address = true
|
||||
createDefaultRequest()
|
||||
})
|
||||
} else {
|
||||
console.log(error)
|
||||
var dialog = app.messageDialog.createObject(app, {text: error})
|
||||
}
|
||||
dialog.open()
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: Daemon.currentWallet
|
||||
function onOtpRequested() {
|
||||
@@ -326,6 +354,27 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
function createRequest(receiveDetailsDialog) {
|
||||
var qamt = Config.unitsToSats(receiveDetailsDialog.amount)
|
||||
Daemon.currentWallet.createRequest(qamt, receiveDetailsDialog.description, receiveDetailsDialog.expiry, _ignore_gaplimit, _reuse_address)
|
||||
}
|
||||
|
||||
Component {
|
||||
id: receiveDetails
|
||||
ReceiveDetailsDialog {
|
||||
id: receiveDetailsDialog
|
||||
width: parent.width * 0.9
|
||||
anchors.centerIn: parent
|
||||
onAccepted: {
|
||||
console.log('accepted')
|
||||
createRequest(receiveDetailsDialog)
|
||||
}
|
||||
onRejected: {
|
||||
console.log('rejected')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: receiveDialog
|
||||
ReceiveDialog {
|
||||
|
||||
Reference in New Issue
Block a user