Skip to content

Commit

Permalink
fix(dapps): Detach the pairInstructions popup from the pairing popup
Browse files Browse the repository at this point in the history
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

(cherry picked from commit 007f75a)
  • Loading branch information
alexjba committed Dec 12, 2024
1 parent c0aeae5 commit 4583597
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
16 changes: 16 additions & 0 deletions ui/app/AppLayouts/Wallet/popups/dapps/DAppsWorkflow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

Expand Down
8 changes: 6 additions & 2 deletions ui/app/AppLayouts/Wallet/services/dapps/DAppsService.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ SQUtils.QObject {

/// Validates the pairing URI
function validatePairingUri(uri) {
timeoutTimer.start()
d.validatePairingUri(uri)
}

Expand Down Expand Up @@ -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)
}
Expand Down
8 changes: 2 additions & 6 deletions ui/imports/shared/popups/walletconnect/PairWCModal.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ StatusDialog {

signal pair(string uri)
signal pairUriChanged(string uri)
signal pairInstructionsRequested()

closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside

Expand Down Expand Up @@ -72,12 +73,7 @@ StatusDialog {
normalColor: linkColor

onClicked: {
Global.openPopup(uriCopyInstructionsPopup)
}

Component {
id: uriCopyInstructionsPopup
DAppsUriCopyInstructionsPopup{}
root.pairInstructionsRequested()
}
}
}
Expand Down

0 comments on commit 4583597

Please sign in to comment.