refactor: move `generateIdenticon` to utils

This commit is contained in:
Richard Ramos 2020-12-06 11:35:25 -04:00 committed by Iuri Matias
parent ae83818eed
commit 426fe504b4
4 changed files with 5 additions and 5 deletions

View File

@ -433,9 +433,6 @@ QtObject:
proc formatENSUsername*(self: ChatsView, username: string): string {.slot.} = proc formatENSUsername*(self: ChatsView, username: string): string {.slot.} =
result = status_ens.addDomain(username) result = status_ens.addDomain(username)
proc generateIdenticon*(self: ChatsView, pk: string): string {.slot.} =
result = status_accounts.generateIdenticon(pk)
# Resolving a ENS name # Resolving a ENS name
proc resolveENS*(self: ChatsView, ens: string) {.slot.} = proc resolveENS*(self: ChatsView, ens: string) {.slot.} =
spawnAndSend(self, "ensResolved") do: # Call self.ensResolved(string) when ens is resolved spawnAndSend(self, "ensResolved") do: # Call self.ensResolved(string) when ens is resolved

View File

@ -1,6 +1,7 @@
import NimQml, os, strformat, strutils, parseUtils, chronicles import NimQml, os, strformat, strutils, parseUtils, chronicles
import stint import stint
import ../../status/status import ../../status/status
import ../../status/accounts as status_accounts
import ../../status/stickers import ../../status/stickers
import ../../status/libstatus/accounts/constants as accountConstants import ../../status/libstatus/accounts/constants as accountConstants
import ../../status/libstatus/tokens import ../../status/libstatus/tokens
@ -88,3 +89,5 @@ QtObject:
weiValue = fromHex(Stuint[256], weiValue).toString() weiValue = fromHex(Stuint[256], weiValue).toString()
return status_utils.wei2Eth(weiValue, decimals) return status_utils.wei2Eth(weiValue, decimals)
proc generateIdenticon*(self: UtilsView, pk: string): string {.slot.} =
result = status_accounts.generateIdenticon(pk)

View File

@ -173,7 +173,7 @@ Rectangle {
}, },
selectedRecipient: { selectedRecipient: {
address: request.payload.params[0].to, address: request.payload.params[0].to,
identicon: chatsModel.generateIdenticon(request.payload.params[0].to), identicon: utilsModel.generateIdenticon(request.payload.params[0].to),
name: chatsModel.activeChannel.name, name: chatsModel.activeChannel.name,
type: RecipientSelector.Type.Address type: RecipientSelector.Type.Address
}, },

View File

@ -50,7 +50,7 @@ Item {
if (link.startsWith('//')) { if (link.startsWith('//')) {
let pk = link.replace("//", ""); let pk = link.replace("//", "");
openProfilePopup(chatsModel.userNameOrAlias(pk), pk, chatsModel.generateIdenticon(pk)) openProfilePopup(chatsModel.userNameOrAlias(pk), pk, utilsModel.generateIdenticon(pk))
return; return;
} }