fix(@desktop/chat): saveContact method extended with `large` image

Fixes: #3420
This commit is contained in:
Sale Djenic 2021-09-21 16:39:37 +02:00
parent 4f7e899953
commit 2cdf6a6f1c
2 changed files with 12 additions and 4 deletions

View File

@ -20,11 +20,14 @@ proc newContactModel*(events: EventEmitter): ContactModel =
result.events = events
proc saveContact(self: ContactModel, contact: Profile): string =
var thumbnail = ""
var
thumbnail = ""
largeImage = ""
if contact.identityImage != nil:
thumbnail = contact.identityImage.thumbnail
largeImage = contact.identityImage.large
return status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.alias, contact.identicon, thumbnail, contact.systemTags, contact.localNickname)
return status_contacts.saveContact(contact.id, contact.ensVerified, contact.ensName, contact.alias, contact.identicon, thumbnail, largeImage, contact.systemTags, contact.localNickname)
proc getContactByID*(self: ContactModel, id: string): Profile =
let response = status_contacts.getContactByID(id)

View File

@ -41,14 +41,19 @@ proc getContactsIndex*(): (Table[string, Profile], bool)=
discard getContacts()
return (contactsIndex, false)
proc saveContact*(id: string, ensVerified: bool, ensName: string, alias: string, identicon: string, thumbnail: string, systemTags: seq[string], localNickname: string): string =
proc saveContact*(id: string, ensVerified: bool, ensName: string, alias: string,
identicon: string, thumbnail: string, largeImage: string, systemTags: seq[string],
localNickname: string): string =
let payload = %* [{
"id": id,
"name": ensName,
"ensVerified": ensVerified,
"alias": alias,
"identicon": identicon,
"images": {"thumbnail": {"Payload": thumbnail.partition(",")[2]}},
"images": {
"thumbnail": {"Payload": thumbnail.partition(",")[2]},
"large": {"Payload": largeImage.partition(",")[2]}
},
"systemTags": systemTags,
"localNickname": localNickname
}]