fix(desktop/contacts) Contacts list not shown

Contacts updates were somehow lost in the base_02
branch, brought back related changes
This commit is contained in:
Alexandra Betouni 2021-11-24 02:50:15 +02:00
parent 6c7deb85a0
commit 683e96f276
2 changed files with 8 additions and 9 deletions

View File

@ -14,7 +14,7 @@ proc getContactById*(id: string): RpcResponse[JsonNode] {.raises: [Exception].}
proc saveContact*(id: string, ensVerified: bool, ensName: string, alias: string, proc saveContact*(id: string, ensVerified: bool, ensName: string, alias: string,
identicon: string, thumbnail: string, largeImage: string, added: bool, identicon: string, thumbnail: string, largeImage: string, added: bool,
blocked: bool, hasAddedUs: bool, localNickname: string) blocked: bool, hasAddedUs: bool, localNickname: string)
{.raises: [Exception].} = {.raises: [Exception].} =
let payload = %* [{ let payload = %* [{
"id": id, "id": id,
@ -23,19 +23,18 @@ proc saveContact*(id: string, ensVerified: bool, ensName: string, alias: string,
"alias": alias, "alias": alias,
"identicon": identicon, "identicon": identicon,
"images": { "images": {
"thumbnail": {"Payload": thumbnail.partition(",")[2]}, "thumbnail": thumbnail,
"large": {"Payload": largeImage.partition(",")[2]} "large": largeImage
}, },
"added": added, "added": added,
"blocked": blocked, "blocked": blocked,
"hasAddedUs": hasAddedUs, "hasAddedUs": hasAddedUs,
"localNickname": localNickname "localNickname": localNickname
}] }]
#TODO figure out why this causes the app to crash and uncomment
discard callPrivateRPC("saveContact".prefix, payload) #discard callPrivateRPC("saveContact".prefix, payload)
proc sendContactUpdate*(publicKey, ensName, thumbnail: string) proc sendContactUpdate*(publicKey, ensName, thumbnail: string)
{.raises: [Exception].} = {.raises: [Exception].} =
let payload = %* [publicKey, ensName, thumbnail] let payload = %* [publicKey, ensName, thumbnail]
discard callPrivateRPC("sendContactUpdate".prefix, payload) discard callPrivateRPC("sendContactUpdate".prefix, payload)

View File

@ -13,7 +13,7 @@ proc callRPC*(inputJSON: string): string =
proc callPrivateRPCRaw*(inputJSON: string): string {.raises: [].} = proc callPrivateRPCRaw*(inputJSON: string): string {.raises: [].} =
result = $status_go.callPrivateRPC(inputJSON) result = $status_go.callPrivateRPC(inputJSON)
proc callPrivateRPC*(methodName: string, payload = %* []): RpcResponse[JsonNode] proc callPrivateRPC*(methodName: string, payload = %* []): RpcResponse[JsonNode]
{.raises: [RpcException, ValueError, Defect, SerializationError].} = {.raises: [RpcException, ValueError, Defect, SerializationError].} =
try: try:
let inputJSON = %* { let inputJSON = %* {
@ -24,7 +24,7 @@ proc callPrivateRPC*(methodName: string, payload = %* []): RpcResponse[JsonNode]
debug "NewBE_callPrivateRPC", rpc_method=methodName debug "NewBE_callPrivateRPC", rpc_method=methodName
let rpcResponseRaw = status_go.callPrivateRPC($inputJSON) let rpcResponseRaw = status_go.callPrivateRPC($inputJSON)
result = Json.decode(rpcResponseRaw, RpcResponse[JsonNode]) result = Json.decode(rpcResponseRaw, RpcResponse[JsonNode])
if(not result.error.isNil): if(not result.error.isNil):
var err = "\nstatus-go error [" var err = "\nstatus-go error ["
err &= fmt"methodName:{methodName}, " err &= fmt"methodName:{methodName}, "
@ -37,7 +37,7 @@ proc callPrivateRPC*(methodName: string, payload = %* []): RpcResponse[JsonNode]
except RpcException as e: except RpcException as e:
error "error doing rpc request", methodName = methodName, exception=e.msg error "error doing rpc request", methodName = methodName, exception=e.msg
raise newException(RpcException, e.msg) raise newException(RpcException, e.msg)
proc signMessage*(rpcParams: string): string = proc signMessage*(rpcParams: string): string =
return $status_go.signMessage(rpcParams) return $status_go.signMessage(rpcParams)