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 = status_ens.pubkey(id)
id id
proc ensWasResolved*(self: ContactsView, resolvedPubKey: string) {.signal.}
proc ensResolved(self: ContactsView, id: string) {.slot.} = proc ensResolved(self: ContactsView, id: string) {.slot.} =
self.ensWasResolved(id)
let contact = self.status.contacts.getContactByID(id) let contact = self.status.contacts.getContactByID(id)
if contact != nil: if contact != nil:
self.contactToAdd = contact self.contactToAdd = contact
else: else:
self.contactToAdd = Profile( self.contactToAdd = Profile(
address: id,
username: "", username: "",
alias: "", alias: generateAlias(id),
ensName: "", ensName: "",
ensVerified: false ensVerified: false
) )

View File

@ -189,6 +189,17 @@ Item {
visible: !contactsContainer.isPending && !!!profileModel.contacts.contactToAddUsername 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 { StyledText {
id: contactUsername id: contactUsername
text: profileModel.contacts.contactToAddUsername + " • " text: profileModel.contacts.contactToAddUsername + " • "