mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-26 13:36:04 +00:00
fix missing contact and simplify
This commit is contained in:
parent
29ec688689
commit
e83a43d075
@ -39,15 +39,15 @@ proc init*(self: Controller) =
|
|||||||
|
|
||||||
self.events.on(SIGNAL_CONTACT_BLOCKED) do(e: Args):
|
self.events.on(SIGNAL_CONTACT_BLOCKED) do(e: Args):
|
||||||
var args = ContactArgs(e)
|
var args = ContactArgs(e)
|
||||||
self.delegate.contactBlocked(args.contactId)
|
self.delegate.addOrUpdateContactItem(args.contactId)
|
||||||
|
|
||||||
self.events.on(SIGNAL_CONTACT_UNBLOCKED) do(e: Args):
|
self.events.on(SIGNAL_CONTACT_UNBLOCKED) do(e: Args):
|
||||||
var args = ContactArgs(e)
|
var args = ContactArgs(e)
|
||||||
self.delegate.contactUnblocked(args.contactId)
|
self.delegate.addOrUpdateContactItem(args.contactId)
|
||||||
|
|
||||||
self.events.on(SIGNAL_CONTACT_REMOVED) do(e: Args):
|
self.events.on(SIGNAL_CONTACT_REMOVED) do(e: Args):
|
||||||
var args = ContactArgs(e)
|
var args = ContactArgs(e)
|
||||||
self.delegate.contactRemoved(args.contactId)
|
self.delegate.addOrUpdateContactItem(args.contactId)
|
||||||
|
|
||||||
self.events.on(SIGNAL_CONTACT_NICKNAME_CHANGED) do(e: Args):
|
self.events.on(SIGNAL_CONTACT_NICKNAME_CHANGED) do(e: Args):
|
||||||
var args = ContactArgs(e)
|
var args = ContactArgs(e)
|
||||||
@ -67,7 +67,7 @@ proc init*(self: Controller) =
|
|||||||
|
|
||||||
self.events.on(SIGNAL_CONTACT_UPDATED) do(e: Args):
|
self.events.on(SIGNAL_CONTACT_UPDATED) do(e: Args):
|
||||||
var args = ContactArgs(e)
|
var args = ContactArgs(e)
|
||||||
self.delegate.contactUpdated(args.contactId)
|
self.delegate.addOrUpdateContactItem(args.contactId)
|
||||||
|
|
||||||
self.events.on(SIGNAL_CONTACTS_STATUS_UPDATED) do(e: Args):
|
self.events.on(SIGNAL_CONTACTS_STATUS_UPDATED) do(e: Args):
|
||||||
let args = ContactsStatusUpdatedArgs(e)
|
let args = ContactsStatusUpdatedArgs(e)
|
||||||
|
@ -62,13 +62,7 @@ method removeContact*(self: AccessInterface, publicKey: string) {.base.} =
|
|||||||
|
|
||||||
# Controller Delegate Interface
|
# Controller Delegate Interface
|
||||||
|
|
||||||
method contactBlocked*(self: AccessInterface, publicKey: string) {.base.} =
|
method addOrUpdateContactItem*(self: AccessInterface, publicKey: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
|
||||||
|
|
||||||
method contactUnblocked*(self: AccessInterface, publicKey: string) {.base.} =
|
|
||||||
raise newException(ValueError, "No implementation available")
|
|
||||||
|
|
||||||
method contactRemoved*(self: AccessInterface, publicKey: string) {.base.} =
|
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method contactNicknameChanged*(self: AccessInterface, publicKey: string) {.base.} =
|
method contactNicknameChanged*(self: AccessInterface, publicKey: string) {.base.} =
|
||||||
@ -77,9 +71,6 @@ method contactNicknameChanged*(self: AccessInterface, publicKey: string) {.base.
|
|||||||
method contactTrustStatusChanged*(self: AccessInterface, publicKey: string, trustStatus: TrustStatus) {.base.} =
|
method contactTrustStatusChanged*(self: AccessInterface, publicKey: string, trustStatus: TrustStatus) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method contactUpdated*(self: AccessInterface, publicKey: string) {.base.} =
|
|
||||||
raise newException(ValueError, "No implementation available")
|
|
||||||
|
|
||||||
method contactsStatusUpdated*(self: AccessInterface, statusUpdates: seq[StatusUpdateDto]) {.base.} =
|
method contactsStatusUpdated*(self: AccessInterface, statusUpdates: seq[StatusUpdateDto]) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ method removeContact*(self: Module, publicKey: string) =
|
|||||||
method changeContactNickname*(self: Module, publicKey: string, nickname: string) =
|
method changeContactNickname*(self: Module, publicKey: string, nickname: string) =
|
||||||
self.controller.changeContactNickname(publicKey, nickname)
|
self.controller.changeContactNickname(publicKey, nickname)
|
||||||
|
|
||||||
proc addOrUpdateContactItem(self: Module, publicKey: string) =
|
proc addOrUpdateContactItem*(self: Module, publicKey: string) =
|
||||||
let ind = self.view.contactsModel().findIndexByPubKey(publicKey)
|
let ind = self.view.contactsModel().findIndexByPubKey(publicKey)
|
||||||
let item = self.createItemFromPublicKey(publicKey)
|
let item = self.createItemFromPublicKey(publicKey)
|
||||||
if ind == -1:
|
if ind == -1:
|
||||||
@ -186,18 +186,6 @@ proc addOrUpdateContactItem(self: Module, publicKey: string) =
|
|||||||
item.isRemoved,
|
item.isRemoved,
|
||||||
)
|
)
|
||||||
|
|
||||||
method contactBlocked*(self: Module, publicKey: string) =
|
|
||||||
self.addOrUpdateContactItem(publicKey)
|
|
||||||
|
|
||||||
method contactUnblocked*(self: Module, publicKey: string) =
|
|
||||||
self.addOrUpdateContactItem(publicKey)
|
|
||||||
|
|
||||||
method contactRemoved*(self: Module, publicKey: string) =
|
|
||||||
self.addOrUpdateContactItem(publicKey)
|
|
||||||
|
|
||||||
method contactUpdated*(self: Module, publicKey: string) =
|
|
||||||
self.addOrUpdateContactItem(publicKey)
|
|
||||||
|
|
||||||
method contactsStatusUpdated*(self: Module, statusUpdates: seq[StatusUpdateDto]) =
|
method contactsStatusUpdated*(self: Module, statusUpdates: seq[StatusUpdateDto]) =
|
||||||
for s in statusUpdates:
|
for s in statusUpdates:
|
||||||
self.view.contactsModel().setOnlineStatus(s.publicKey, toOnlineStatus(s.statusType))
|
self.view.contactsModel().setOnlineStatus(s.publicKey, toOnlineStatus(s.statusType))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user