fix: add contact using status ens name

This commit is contained in:
Richard Ramos 2021-02-08 16:03:09 -04:00 committed by Iuri Matias
parent 4b7769c391
commit 2ac67f95aa
2 changed files with 18 additions and 3 deletions

View File

@ -119,15 +119,19 @@ QtObject:
id = status_ens.pubkey(id)
id
proc ensResolved(self: ContactsView, id: string) {.slot.} =
let contact = self.status.contacts.getContactByID(id)
proc ensWasResolved*(self: ContactsView, resolvedPubKey: string) {.signal.}
proc ensResolved(self: ContactsView, id: string) {.slot.} =
self.ensWasResolved(id)
let contact = self.status.contacts.getContactByID(id)
if contact != nil:
self.contactToAdd = contact
else:
self.contactToAdd = Profile(
address: id,
username: "",
alias: "",
alias: generateAlias(id),
ensName: "",
ensVerified: false
)

View File

@ -189,6 +189,17 @@ Item {
visible: !contactsContainer.isPending && !!!profileModel.contacts.contactToAddUsername
}
Connections {
target: profileModel.contacts
onEnsWasResolved: {
if(addContactSearchInput.text !== "" && !Utils.isHex(addContactSearchInput.text) && resolvedPubKey !== ""){
contactUsername.text = Qt.binding(function () {
return chatsModel.formatENSUsername(addContactSearchInput.text) + " • "
});
}
}
}
StyledText {
id: contactUsername
text: profileModel.contacts.contactToAddUsername + " • "