diff --git a/src/app/modules/main/profile_section/contacts/controller.nim b/src/app/modules/main/profile_section/contacts/controller.nim index 669cdda3d3..6693e5b4d0 100644 --- a/src/app/modules/main/profile_section/contacts/controller.nim +++ b/src/app/modules/main/profile_section/contacts/controller.nim @@ -65,6 +65,10 @@ proc init*(self: Controller) = var args = ContactArgs(e) 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): var args = ContactArgs(e) self.delegate.onVerificationRequestDeclined(args.contactId) diff --git a/src/app/modules/main/profile_section/contacts/io_interface.nim b/src/app/modules/main/profile_section/contacts/io_interface.nim index 2c2efb68a7..5fd7a4d179 100644 --- a/src/app/modules/main/profile_section/contacts/io_interface.nim +++ b/src/app/modules/main/profile_section/contacts/io_interface.nim @@ -1,5 +1,6 @@ import NimQml import ../../../../../app_service/service/contacts/dto/contacts as contacts +import ../../../../../app_service/service/contacts/dto/status_update type 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.} = 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.} = raise newException(ValueError, "No implementation available") diff --git a/src/app/modules/main/profile_section/contacts/module.nim b/src/app/modules/main/profile_section/contacts/module.nim index d0dabd8742..9ece802340 100644 --- a/src/app/modules/main/profile_section/contacts/module.nim +++ b/src/app/modules/main/profile_section/contacts/module.nim @@ -177,6 +177,11 @@ method contactRequestRejectionRemoved*(self: Module, publicKey: string) = method contactUpdated*(self: Module, publicKey: string) = 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) = let (name, _, _) = self.controller.getContactNameAndImage(publicKey) self.view.myMutualContactsModel().updateName(publicKey, name)