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

Fixes: #3420
This commit is contained in:
saledjenic 2021-09-21 20:24:32 +02:00 committed by GitHub
parent 9c40da50de
commit a9b06fde83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

@ -23,11 +23,14 @@ proc newContactModel*(events: EventEmitter): ContactModel =
result.events = events result.events = events
proc saveContact(self: ContactModel, contact: Profile): string = proc saveContact(self: ContactModel, contact: Profile): string =
var thumbnail = "" var
thumbnail = ""
largeImage = ""
if contact.identityImage != nil: if contact.identityImage != nil:
thumbnail = contact.identityImage.thumbnail 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 = proc getContactByID*(self: ContactModel, id: string): Profile =
let response = status_contacts.getContactByID(id) let response = status_contacts.getContactByID(id)

View File

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