fix(savedaddresses): saved addresses should be displayed in mixed cases format

Fixes #13665
This commit is contained in:
Sale Djenic 2024-02-22 09:33:16 +01:00 committed by saledjenic
parent 343cfa0982
commit a3923461e8
6 changed files with 17 additions and 2 deletions

View File

@ -6,6 +6,7 @@ type
Item* = object
name: string
address: string
mixedcaseAddress: string
ens: string
colorId: string
chainShortNames: string
@ -14,6 +15,7 @@ type
proc initItem*(
name: string,
address: string,
mixedcaseAddress: string,
ens: string,
colorId: string,
chainShortNames: string,
@ -21,6 +23,7 @@ proc initItem*(
): Item =
result.name = name
result.address = address
result.mixedcaseAddress = mixedcaseAddress
result.ens = ens
result.colorId = colorId
result.chainShortNames = chainShortNames
@ -30,6 +33,7 @@ proc `$`*(self: Item): string =
result = fmt"""SavedAddressItem(
name: {self.name},
address: {self.address},
mixedcaseAddress: {self.mixedcaseAddress},
ens: {self.ens},
colorId: {self.colorId},
chainShortNames: {self.chainShortNames},
@ -48,6 +52,9 @@ proc getEns*(self: Item): string =
proc getAddress*(self: Item): string =
return self.address
proc getMixedcaseAddress*(self: Item): string =
return self.mixedcaseAddress
proc getColorId*(self: Item): string =
return self.colorId

View File

@ -9,6 +9,7 @@ type
ModelRole {.pure.} = enum
Name = UserRole + 1,
Address
MixedcaseAddress
Ens
ColorId
ChainShortNames
@ -51,6 +52,7 @@ QtObject:
{
ModelRole.Name.int:"name",
ModelRole.Address.int:"address",
ModelRole.MixedcaseAddress.int:"mixedcaseAddress",
ModelRole.Ens.int:"ens",
ModelRole.ColorId.int:"colorId",
ModelRole.ChainShortNames.int:"chainShortNames",
@ -72,6 +74,8 @@ QtObject:
result = newQVariant(item.getName())
of ModelRole.Address:
result = newQVariant(item.getAddress())
of ModelRole.MixedcaseAddress:
result = newQVariant(item.getMixedcaseAddress())
of ModelRole.Ens:
result = newQVariant(item.getEns())
of ModelRole.ColorId:

View File

@ -36,6 +36,7 @@ method loadSavedAddresses*(self: Module) =
savedAddresses.map(s => initItem(
s.name,
s.address,
s.mixedcaseAddress,
s.ens,
s.colorId,
s.chainShortNames,

View File

@ -6,6 +6,7 @@ type
SavedAddressDto* = ref object of RootObj
name*: string
address*: string
mixedcaseAddress*: string
ens*: string
colorId*: string
chainShortNames*: string
@ -17,6 +18,7 @@ proc toSavedAddressDto*(jsonObj: JsonNode): SavedAddressDto =
result = SavedAddressDto()
discard jsonObj.getProp("name", result.name)
discard jsonObj.getProp("address", result.address)
discard jsonObj.getProp("mixedcaseAddress", result.mixedcaseAddress)
discard jsonObj.getProp("ens", result.ens)
discard jsonObj.getProp("colorId", result.colorId)
result.colorId = result.colorId.toUpper() # to match `preDefinedWalletAccountColors` on the qml side
@ -29,6 +31,7 @@ proc toJsonNode*(self: SavedAddressDto): JsonNode =
result = %* {
"name": self.name,
"address": self.address,
"mixedcaseAddress": self.mixedcaseAddress,
"ens": self.ens,
"colorId": self.colorId,
"chainShortNames": self.chainShortNames,

View File

@ -143,7 +143,7 @@ ColumnLayout {
id: savedAddressDelegate
objectName: "savedAddressView_Delegate_" + name
name: model.name
address: model.address
address: model.mixedcaseAddress
chainShortNames: model.chainShortNames
ens: model.ens
colorId: model.colorId

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit f650915a49f1f2cc771059c3c4ae524aa55ebfb7
Subproject commit 9b17fd66734f810d465a1e463451260c0c0fd762