mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-09 13:56:10 +00:00
81a4d70932
Fixing QML Connections warnings due to deprecated onFoo handlers. Now we're using function onFoo(params). Fixing QML compilation error due to js filename format. Fixing cyclic dependencies between qml components.
56 lines
1.4 KiB
QML
56 lines
1.4 KiB
QML
import QtQuick 2.13
|
|
import QtQuick.Controls 2.13
|
|
import QtQuick.Layouts 1.13
|
|
import QtGraphicalEffects 1.13
|
|
|
|
import StatusQ.Components 0.1
|
|
import utils 1.0
|
|
import shared.stores 1.0
|
|
|
|
Item {
|
|
id: root
|
|
property bool isPending: false
|
|
readonly property string uuid: Utils.uuid()
|
|
property int debounceDelay: 600
|
|
|
|
readonly property var validateAsync: Backpressure.debounce(inpAddress, debounceDelay, function (inputValue) {
|
|
root.isPending = true
|
|
var name = inputValue.startsWith("@") ? inputValue.substring(1) : inputValue
|
|
mainModule.resolveENS(name, uuid)
|
|
});
|
|
signal resolved(string resolvedAddress)
|
|
|
|
function resolveEns(name) {
|
|
if (Utils.isValidEns(name)) {
|
|
root.validateAsync(name)
|
|
}
|
|
}
|
|
width: 12
|
|
height: 12
|
|
|
|
Loader {
|
|
anchors.fill: parent
|
|
sourceComponent: loadingIndicator
|
|
active: root.isPending
|
|
}
|
|
|
|
Component {
|
|
id: loadingIndicator
|
|
StatusLoadingIndicator {
|
|
width: root.width
|
|
height: root.height
|
|
}
|
|
}
|
|
|
|
Connections {
|
|
target: mainModule
|
|
function onResolvedENS(resolvedPubKey: string, resolvedAddress: string, uuid: string) {
|
|
if (uuid !== root.uuid) {
|
|
return
|
|
}
|
|
root.isPending = false
|
|
root.resolved(resolvedAddress)
|
|
}
|
|
}
|
|
}
|