fix(wallet): profile network RPC URL editing form closed on "Save and Restart

later".

Fix "Restore defaults" to have confirmation dialog too and not close the
network editing form as well.
This commit is contained in:
Ivan Belyakov 2024-07-10 13:07:34 +02:00 committed by IvanBelyakoff
parent 7caba84833
commit 1e146b76e7
2 changed files with 19 additions and 9 deletions

View File

@ -268,7 +268,6 @@ SettingsContentBase {
onEvaluateRpcEndPoint: root.walletStore.evaluateRpcEndPoint(url, isMainUrl)
onUpdateNetworkValues: {
root.walletStore.updateNetworkEndPointValues(chainId, testNetwork, newMainRpcInput, newFailoverRpcUrl, revertToDefault)
stackContainer.currentIndex = networksViewIndex
}
}

View File

@ -47,7 +47,8 @@ ColumnLayout {
function revertValues() {
if(!!network) {
root.updateNetworkValues(network.chainId, network.originalRpcURL, network.originalFallbackURL, true)
mainRpcInput.text = d.mask(network.originalRpcURL)
failoverRpcUrlInput.text = d.mask(network.originalFallbackURL)
}
}
@ -105,16 +106,24 @@ ColumnLayout {
}
function save() {
if (d.evaluationStatusMainRpc == EditNetworkForm.UnTouched && d.evaluationStatusFallBackRpc == EditNetworkForm.UnTouched) {
return
}
let main = mainRpcInput.text
let fallback = failoverRpcUrlInput.text
let isMainOriginal = false
let isFallbackOriginal = false
if (main === d.mask(network.originalRpcURL)) {
main = network.originalRpcURL
isMainOriginal = true
}
if (fallback === d.mask(network.originalFallbackURL)) {
fallback = network.originalFallbackURL
isFallbackOriginal = true
}
root.updateNetworkValues(network.chainId, main, fallback, false)
root.updateNetworkValues(network.chainId, main, fallback, isMainOriginal && isFallbackOriginal)
root.networkRPCChanged[network.chainId] = true
}
}
@ -314,6 +323,8 @@ ColumnLayout {
onClicked: {
d.revertValues()
root.networkRPCChanged[network.chainId] = true
Global.openPopup(confirmationDialogComponent)
d.evaluationStatusMainRpc = EditNetworkForm.RestartRequired
}
}
StatusButton {
@ -378,6 +389,7 @@ ColumnLayout {
onClicked: {
close()
d.save()
d.evaluationStatusMainRpc = EditNetworkForm.RestartRequired
}
},
StatusButton {
@ -396,6 +408,5 @@ ColumnLayout {
}
]
}
}
}