fix: contact status not reflected in list

This commit is contained in:
Richard Ramos 2022-09-15 10:17:42 -04:00
parent 992bd01f83
commit 8a9a23a89e
3 changed files with 13 additions and 0 deletions

View File

@ -65,6 +65,10 @@ proc init*(self: Controller) =
var args = ContactArgs(e) var args = ContactArgs(e)
self.delegate.contactUpdated(args.contactId) self.delegate.contactUpdated(args.contactId)
self.events.on(SIGNAL_CONTACTS_STATUS_UPDATED) do(e: Args):
let args = ContactsStatusUpdatedArgs(e)
self.delegate.contactsStatusUpdated(args.statusUpdates)
self.events.on(SIGNAL_CONTACT_VERIFICATION_DECLINED) do(e: Args): self.events.on(SIGNAL_CONTACT_VERIFICATION_DECLINED) do(e: Args):
var args = ContactArgs(e) var args = ContactArgs(e)
self.delegate.onVerificationRequestDeclined(args.contactId) self.delegate.onVerificationRequestDeclined(args.contactId)

View File

@ -1,5 +1,6 @@
import NimQml import NimQml
import ../../../../../app_service/service/contacts/dto/contacts as contacts import ../../../../../app_service/service/contacts/dto/contacts as contacts
import ../../../../../app_service/service/contacts/dto/status_update
type type
AccessInterface* {.pure inheritable.} = ref object of RootObj AccessInterface* {.pure inheritable.} = ref object of RootObj
@ -76,6 +77,9 @@ method contactTrustStatusChanged*(self: AccessInterface, publicKey: string, isUn
method contactUpdated*(self: AccessInterface, publicKey: string) {.base.} = method contactUpdated*(self: AccessInterface, publicKey: string) {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")
method contactsStatusUpdated*(self: AccessInterface, statusUpdates: seq[StatusUpdateDto]) {.base.} =
raise newException(ValueError, "No implementation available")
method markUntrustworthy*(self: AccessInterface, publicKey: string): void {.base.} = method markUntrustworthy*(self: AccessInterface, publicKey: string): void {.base.} =
raise newException(ValueError, "No implementation available") raise newException(ValueError, "No implementation available")

View File

@ -177,6 +177,11 @@ method contactRequestRejectionRemoved*(self: Module, publicKey: string) =
method contactUpdated*(self: Module, publicKey: string) = method contactUpdated*(self: Module, publicKey: string) =
self.removeIfExistsAndAddToAppropriateModel(publicKey) self.removeIfExistsAndAddToAppropriateModel(publicKey)
method contactsStatusUpdated*(self: Module, statusUpdates: seq[StatusUpdateDto]) =
for s in statusUpdates:
let status = toOnlineStatus(s.statusType)
self.view.myMutualContactsModel().setOnlineStatus(s.publicKey, status)
method contactNicknameChanged*(self: Module, publicKey: string) = method contactNicknameChanged*(self: Module, publicKey: string) =
let (name, _, _) = self.controller.getContactNameAndImage(publicKey) let (name, _, _) = self.controller.getContactNameAndImage(publicKey)
self.view.myMutualContactsModel().updateName(publicKey, name) self.view.myMutualContactsModel().updateName(publicKey, name)