feat(@wallet): sort saved addresses

fixes #9772
This commit is contained in:
Anthony Laibe 2023-03-08 14:44:22 +01:00 committed by Anthony Laibe
parent 12520214d2
commit c8d0cb36e6
4 changed files with 8 additions and 3 deletions

View File

@ -10,6 +10,7 @@ type
favourite*: bool
chainShortNames*: string
isTest*: bool
createdAt*: int64
proc newSavedAddressDto*(
name: string,
@ -36,3 +37,4 @@ proc toSavedAddressDto*(jsonObj: JsonNode): SavedAddressDto =
discard jsonObj.getProp("favourite", result.favourite)
discard jsonObj.getProp("chainShortNames", result.chainShortNames)
discard jsonObj.getProp("isTest", result.isTest)
discard jsonObj.getProp("createdAt", result.createdAt)

View File

@ -36,7 +36,6 @@ proc newService*(events: EventEmitter, networkService: network_service.Service,
proc fetchAddresses(self: Service) =
try:
let response = backend.getSavedAddresses()
self.savedAddresses = map(
response.result.getElems(),
proc(x: JsonNode): SavedAddressDto = toSavedAddressDto(x)

View File

@ -9,6 +9,7 @@ import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Popups 0.1
import shared.controls 1.0
import SortFilterProxyModel 0.2
import "../stores"
import "../popups"
@ -107,7 +108,10 @@ Item {
anchors.left: parent.left
visible: listView.count > 0
spacing: 5
model: RootStore.savedAddresses
model: SortFilterProxyModel {
sourceModel: RootStore.savedAddresses
sorters: RoleSorter { roleName: "createdAt"; sortOrder: Qt.DescendingOrder }
}
delegate: SavedAddressesDelegate {
id: savedAddressDelegate

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 34badf2405043069ad1ee5a303b2a434c1fad53c
Subproject commit dd7c59423f125f7e40b7423e56ae03fe8cfba6a8