fix(WC): Disable primary action buttons when the service is not available
+ Disable the `Connect` button after the first request
This commit is contained in:
parent
7d3cd5c7bf
commit
519bfaedfa
|
@ -241,6 +241,7 @@ DappsComboBox {
|
|||
dAppUrl: connectDappLoader.dappUrl
|
||||
dAppName: connectDappLoader.dappName
|
||||
dAppIconUrl: connectDappLoader.dappIcon
|
||||
connectButtonEnabled: root.enabled
|
||||
|
||||
onConnect: {
|
||||
if (!selectedAccount || !selectedAccount.address) {
|
||||
|
@ -327,6 +328,7 @@ DappsComboBox {
|
|||
enoughFundsForTransaction: request.haveEnoughFunds
|
||||
enoughFundsForFees: request.haveEnoughFees
|
||||
|
||||
signButtonEnabled: ((!hasFees) || enoughFundsForTransaction && enoughFundsForFees) && root.enabled
|
||||
signingTransaction: !!request.method && (request.method === SessionRequest.methods.signTransaction.name
|
||||
|| request.method === SessionRequest.methods.sendTransaction.name)
|
||||
requestPayload: {
|
||||
|
|
|
@ -62,6 +62,7 @@ StatusDialog {
|
|||
property alias dAppName: dappCard.name
|
||||
property alias dAppIconUrl: dappCard.iconUrl
|
||||
property alias connectionStatus: d.connectionStatus
|
||||
property bool connectButtonEnabled: true
|
||||
|
||||
/*
|
||||
Selected account address holds the initial account address selection for the account selector.
|
||||
|
@ -79,9 +80,11 @@ StatusDialog {
|
|||
readonly property int connectionFailedStatus: 2
|
||||
|
||||
function pairSuccessful() {
|
||||
d.connectionInProgress = false
|
||||
d.connectionStatus = root.connectionSuccessfulStatus
|
||||
}
|
||||
function pairFailed() {
|
||||
d.connectionInProgress = false
|
||||
d.connectionStatus = root.connectionFailedStatus
|
||||
}
|
||||
|
||||
|
@ -181,16 +184,21 @@ StatusDialog {
|
|||
height: 44
|
||||
text: d.connectionAttempted ? qsTr("Close") : qsTr("Connect")
|
||||
enabled: {
|
||||
if (d.connectionInProgress)
|
||||
return false
|
||||
if (!d.connectionAttempted)
|
||||
return root.selectedChains.length > 0
|
||||
return true
|
||||
return root.connectButtonEnabled
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
if (!d.connectionAttempted)
|
||||
if (!d.connectionAttempted) {
|
||||
d.connectionInProgress = true
|
||||
root.connect()
|
||||
else
|
||||
}
|
||||
else {
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -219,5 +227,6 @@ StatusDialog {
|
|||
readonly property bool connectionSuccessful: d.connectionStatus === root.connectionSuccessfulStatus
|
||||
readonly property bool connectionFailed: d.connectionStatus === root.connectionFailedStatus
|
||||
readonly property bool connectionAttempted: d.connectionStatus !== root.notConnectedStatus
|
||||
property bool connectionInProgress: false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ SignTransactionModalBase {
|
|||
property bool enoughFundsForTransaction: true
|
||||
property bool enoughFundsForFees: false
|
||||
|
||||
signButtonEnabled: (!hasFees) || enoughFundsForTransaction && enoughFundsForFees
|
||||
title: qsTr("Sign Request")
|
||||
subtitle: SQUtils.StringUtils.extractDomainFromLink(root.dappUrl)
|
||||
headerIconComponent: RoundImageWithBadge {
|
||||
|
|
Loading…
Reference in New Issue