fix(@desktop/chat): saveContact method extended with `large` image (#45)
Fixes: #3420
This commit is contained in:
parent
9c40da50de
commit
a9b06fde83
|
@ -23,11 +23,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)
|
||||
|
|
|
@ -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
|
||||
}]
|
||||
|
|
Loading…
Reference in New Issue