1
0

qml: add auth_message to AuthMixin, which is displayed above the Pin entry textfield, or

shown in a messageDialog for confirmation.
This commit is contained in:
Sander van Grieken
2023-04-17 16:32:20 +02:00
parent 62af3265cb
commit 5b6a16e097
4 changed files with 55 additions and 36 deletions

View File

@@ -371,13 +371,6 @@ ApplicationWindow
swaphelper: SwapHelper {
id: _swaphelper
wallet: Daemon.currentWallet
onConfirm: {
var dialog = app.messageDialog.createObject(app, {text: message, yesno: true})
dialog.accepted.connect(function() {
_swaphelper.executeSwap(true)
})
dialog.open()
}
onAuthRequired: {
app.handleAuthRequired(_swaphelper, method)
}
@@ -558,9 +551,13 @@ ApplicationWindow
} else if (method == 'pin') {
if (Config.pinCode == '') {
// no PIN configured
qtobject.authProceed()
handleAuthConfirmationOnly(qtobject)
} else {
var dialog = app.pinDialog.createObject(app, {mode: 'check', pincode: Config.pinCode})
var dialog = app.pinDialog.createObject(app, {
mode: 'check',
pincode: Config.pinCode,
authMessage: qtobject.authMessage
})
dialog.accepted.connect(function() {
qtobject.authProceed()
dialog.close()
@@ -576,6 +573,21 @@ ApplicationWindow
}
}
function handleAuthConfirmationOnly(qtobject) {
if (!qtobject.authMessage) {
qtobject.authProceed()
return
}
var dialog = app.messageDialog.createObject(app, {text: qtobject.authMessage, yesno: true})
dialog.accepted.connect(function() {
qtobject.authProceed()
})
dialog.rejected.connect(function() {
qtobject.authCancel()
})
dialog.open()
}
function startSwap() {
var swapdialog = swapDialog.createObject(app)
swapdialog.open()