diff --git a/src/status/contacts.nim b/src/status/contacts.nim index e0d6001451..09f001d77f 100644 --- a/src/status/contacts.nim +++ b/src/status/contacts.nim @@ -1,3 +1,4 @@ +import NimQml, chronicles, os, strformat import json, sequtils, sugar import libstatus/contacts as status_contacts import libstatus/accounts as status_accounts @@ -40,7 +41,7 @@ proc blockContact*(self: ContactModel, id: string): string = proc unblockContact*(self: ContactModel, id: string): string = var contact = self.getContactByID(id) contact.systemTags.delete(contact.systemTags.find(":contact/blocked")) - discard status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.ensVerifiedAt, contact.ensVerificationRetries,contact.alias, contact.identicon, contact.systemTags, contact.localNickname) + discard status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.ensVerifiedAt, contact.ensVerificationRetries,contact.alias, contact.identicon, contact.identityImage.thumbnail, contact.systemTags, contact.localNickname) self.events.emit("contactUnblocked", Args()) proc getAllContacts*(): seq[Profile] = @@ -81,7 +82,7 @@ proc addContact*(self: ContactModel, id: string, localNickname: string): string "" else: localNickname - result = status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.ensVerifiedAt, contact.ensVerificationRetries, contact.alias, contact.identicon, contact.systemTags, nickname) + result = status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.ensVerifiedAt, contact.ensVerificationRetries, contact.alias, contact.identicon, contact.identityImage.thumbnail, contact.systemTags, nickname) self.events.emit("contactAdded", Args()) discard requestContactUpdate(contact.id) if updating: @@ -106,7 +107,7 @@ proc addContact*(self: ContactModel, id: string): string = proc removeContact*(self: ContactModel, id: string) = let contact = self.getContactByID(id) contact.systemTags.delete(contact.systemTags.find(":contact/added")) - discard status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.ensVerifiedAt, contact.ensVerificationRetries, contact.alias, contact.identicon, contact.systemTags, contact.localNickname) + discard status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.ensVerifiedAt, contact.ensVerificationRetries, contact.alias, contact.identicon, contact.identityImage.thumbnail, contact.systemTags, contact.localNickname) self.events.emit("contactRemoved", Args()) proc isAdded*(self: ContactModel, id: string): bool = diff --git a/src/status/libstatus/contacts.nim b/src/status/libstatus/contacts.nim index 5f386f73ab..f6ed9666ea 100644 --- a/src/status/libstatus/contacts.nim +++ b/src/status/libstatus/contacts.nim @@ -1,4 +1,4 @@ -import json +import json, strmisc import core, utils, types, settings from ../profile/profile import Profile @@ -26,7 +26,7 @@ proc getContacts*(): JsonNode = return %* [] return response["result"] -proc saveContact*(id: string, ensVerified: bool, ensName: string, ensVerifiedAt: int, ensVerificationRetries: int, alias: string, identicon: string, systemTags: seq[string], localNickname: string): string = +proc saveContact*(id: string, ensVerified: bool, ensName: string, ensVerifiedAt: int, ensVerificationRetries: int, alias: string, identicon: string, thumbnail: string, systemTags: seq[string], localNickname: string): string = let payload = %* [{ "id": id, "name": ensName, @@ -35,6 +35,7 @@ proc saveContact*(id: string, ensVerified: bool, ensName: string, ensVerifiedAt: "ensVerificationRetries": ensVerificationRetries, "alias": alias, "identicon": identicon, + "images": {"thumbnail": {"Payload": thumbnail.partition(",")[2]}}, "systemTags": systemTags, "localNickname": localNickname }]