fix(dapps): Detach the pairInstructions popup from the pairing popup

closes #16887

The pairing popup can be destroyed while the pairInstructions popup is active. As a result the pair instructions popup will misbehave.
To fix this, the pair instructions component is moved outside of the pair popup scope
This commit is contained in:
Alex Jbanca 2024-12-05 19:19:33 +02:00 committed by Anthony Laibe
parent 2c4f6b5da3
commit 007f75ad4c
3 changed files with 24 additions and 8 deletions

View File

@ -173,6 +173,22 @@ SQUtils.QObject {
onClosed: pairWCLoader.active = false
onPair: (uri) => root.pairingRequested(uri)
onPairUriChanged: (uri) => root.pairingValidationRequested(uri)
onPairInstructionsRequested: pairInstructionsLoader.active = true
}
}
Loader {
id: pairInstructionsLoader
active: false
parent: root.visualParent
sourceComponent: Component {
DAppsUriCopyInstructionsPopup{
visible: true
destroyOnClose: false
onClosed: pairInstructionsLoader.active = false
}
}
}

View File

@ -72,6 +72,7 @@ SQUtils.QObject {
/// Validates the pairing URI
function validatePairingUri(uri) {
timeoutTimer.start()
d.validatePairingUri(uri)
}
@ -190,14 +191,17 @@ SQUtils.QObject {
root.pairingValidated(state)
}
function onPairingResponse(key, state) {
timeoutTimer.stop()
function onPairingResponse(state) {
if (state != Pairing.errors.uriOk) {
d.reportPairErrorState(state)
return
}
timeoutTimer.restart()
}
function onConnectDApp(dappChains, dappUrl, dappName, dappIcon, connectorId, key) {
timeoutTimer.stop()
const connectorIcon = Constants.dappImageByType[connectorId]
root.connectDApp(dappChains, dappUrl, dappName, dappIcon, connectorIcon, key)
}

View File

@ -36,6 +36,7 @@ StatusDialog {
signal pair(string uri)
signal pairUriChanged(string uri)
signal pairInstructionsRequested()
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
@ -72,12 +73,7 @@ StatusDialog {
normalColor: linkColor
onClicked: {
Global.openPopup(uriCopyInstructionsPopup)
}
Component {
id: uriCopyInstructionsPopup
DAppsUriCopyInstructionsPopup{}
root.pairInstructionsRequested()
}
}
}