refactor: contacts-perfomance

This commit is contained in:
Richard Ramos 2021-10-03 08:38:19 -04:00 committed by Iuri Matias
parent a189b0d72b
commit 0fd3182899
3 changed files with 9 additions and 7 deletions

View File

@ -138,7 +138,8 @@ QtObject:
c.ensName = contact.ensName
c.ensVerified = contact.ensVerified
c.identityImage = contact.identityImage
c.systemTags = contact.systemTags
c.added = contact.added
c.blocked = contact.blocked
if not found:
self.addContactToList(contact)

View File

@ -82,13 +82,13 @@ QtObject:
break
self.contactList.updateContact(contact)
if contact.systemTags.contains(contactAdded):
if contact.added:
self.addedContacts.updateContact(contact)
if contact.isBlocked():
self.blockedContacts.updateContact(contact)
if contact.requestReceived() and not contact.systemTags.contains(contactAdded) and not contact.systemTags.contains(contactBlocked):
if contact.requestReceived() and not contact.added and not contact.blocked:
self.contactRequests.updateContact(contact)
if not requestAlreadyAdded and contact.requestReceived():
@ -101,9 +101,10 @@ QtObject:
proc setContactList*(self: ContactsView, contactList: seq[Profile]) =
self.contactList.setNewData(contactList)
self.addedContacts.setNewData(contactList.filter(c => c.systemTags.contains(contactAdded)))
self.blockedContacts.setNewData(contactList.filter(c => c.systemTags.contains(contactBlocked)))
self.contactRequests.setNewData(contactList.filter(c => c.systemTags.contains(contactRequest) and not c.systemTags.contains(contactAdded) and not c.systemTags.contains(contactBlocked)))
self.addedContacts.setNewData(contactList.filter(c => c.added))
self.blockedContacts.setNewData(contactList.filter(c => c.blocked))
self.contactRequests.setNewData(contactList.filter(c => c.hasAddedUs and not c.added and not c.blocked))
self.contactListChanged()
QtProperty[QVariant] list:

2
vendor/status-lib vendored

@ -1 +1 @@
Subproject commit 9f88c1b8b45d8fbcf88dc5fec1e0f255f6e1359f
Subproject commit 1ae94006aed9668571ec9a3ee877364786dc47fb