2024-05-01 16:15:42 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQml.Models 2.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
2024-07-01 11:34:30 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2024-05-01 16:15:42 +00:00
|
|
|
import StatusQ.Popups.Dialog 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
2024-07-01 11:34:30 +00:00
|
|
|
import shared.controls 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
|
2024-07-05 09:32:31 +00:00
|
|
|
import AppLayouts.Wallet.services.dapps.types 1.0
|
|
|
|
|
2024-05-06 20:22:43 +00:00
|
|
|
import "PairWCModal"
|
2024-05-01 16:15:42 +00:00
|
|
|
|
|
|
|
StatusDialog {
|
|
|
|
id: root
|
|
|
|
|
2024-05-31 09:34:59 +00:00
|
|
|
objectName: "pairWCModal"
|
|
|
|
|
2024-05-01 16:15:42 +00:00
|
|
|
width: 480
|
|
|
|
implicitHeight: 633
|
|
|
|
|
2024-05-06 20:22:43 +00:00
|
|
|
property bool isPairing: false
|
|
|
|
|
2024-07-08 11:18:14 +00:00
|
|
|
function pairingValidated(validationState) {
|
2024-07-05 09:32:31 +00:00
|
|
|
uriInput.errorState = validationState
|
2024-07-08 11:18:14 +00:00
|
|
|
if (validationState === Pairing.errors.ok) {
|
2024-07-05 09:32:31 +00:00
|
|
|
d.doPair()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-06 20:22:43 +00:00
|
|
|
signal pair(string uri)
|
2024-07-05 09:32:31 +00:00
|
|
|
signal pairUriChanged(string uri)
|
2024-05-06 20:22:43 +00:00
|
|
|
|
2024-05-01 16:15:42 +00:00
|
|
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
|
|
|
|
|
|
|
|
title: qsTr("Connect a dApp via WalletConnect")
|
|
|
|
|
|
|
|
padding: 20
|
|
|
|
|
|
|
|
contentItem: ColumnLayout {
|
|
|
|
StatusBaseText {
|
|
|
|
text: "WalletConnect URI"
|
|
|
|
}
|
|
|
|
|
|
|
|
WCUriInput {
|
|
|
|
id: uriInput
|
2024-05-06 20:22:43 +00:00
|
|
|
|
2024-07-08 11:18:14 +00:00
|
|
|
pending: uriInput.errorState === Pairing.errors.notChecked
|
2024-07-05 09:32:31 +00:00
|
|
|
|
|
|
|
onTextChanged: {
|
|
|
|
root.isPairing = false
|
|
|
|
root.pairUriChanged(uriInput.text)
|
|
|
|
}
|
2024-05-01 16:15:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Spacer
|
2024-05-06 20:22:43 +00:00
|
|
|
Item { Layout.fillHeight: true }
|
2024-05-01 16:15:42 +00:00
|
|
|
|
|
|
|
StatusLinkText {
|
|
|
|
text: qsTr("How to copy the dApp URI")
|
|
|
|
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
Layout.margins: 18
|
|
|
|
|
|
|
|
normalColor: linkColor
|
|
|
|
|
|
|
|
onClicked: {
|
2024-07-01 11:34:30 +00:00
|
|
|
Global.openPopup(uriCopyInstructionsPopup)
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: uriCopyInstructionsPopup
|
|
|
|
DAppsUriCopyInstructionsPopup{}
|
2024-05-01 16:15:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
footer: StatusDialogFooter {
|
|
|
|
id: footer
|
|
|
|
rightButtons: ObjectModel {
|
|
|
|
StatusButton {
|
|
|
|
height: 44
|
|
|
|
text: qsTr("Done")
|
|
|
|
|
2024-07-05 09:32:31 +00:00
|
|
|
enabled: uriInput.valid
|
|
|
|
&& !root.isPairing
|
|
|
|
&& uriInput.text.length > 0
|
2024-07-08 11:18:14 +00:00
|
|
|
&& uriInput.errorState === Pairing.errors.ok
|
2024-05-01 16:15:42 +00:00
|
|
|
|
2024-07-05 09:32:31 +00:00
|
|
|
onClicked: {
|
|
|
|
d.doPair()
|
|
|
|
}
|
2024-05-01 16:15:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-07-05 09:32:31 +00:00
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
function doPair() {
|
|
|
|
root.isPairing = true
|
|
|
|
root.pair(uriInput.text)
|
|
|
|
}
|
|
|
|
}
|
2024-05-01 16:15:42 +00:00
|
|
|
}
|