feat(@desktop/wallet): Add has activity to the derived addresses in wallet

fix #5655
This commit is contained in:
Khushboo Mehta 2022-05-05 17:01:54 +02:00 committed by Khushboo-dev-cpp
parent 3769687d45
commit 0ee0c8ddd4
3 changed files with 19 additions and 5 deletions

View File

@ -291,8 +291,8 @@ proc setDisplayName*(displayName: string): RpcResponse[JsonNode] {.raises: [Exce
proc getDerivedAddressList*(password: string, derivedFrom: string, path: string, pageSize: int = 0, pageNumber: int = 6,): RpcResponse[JsonNode] {.raises: [Exception].} = proc getDerivedAddressList*(password: string, derivedFrom: string, path: string, pageSize: int = 0, pageNumber: int = 6,): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [password, derivedFrom, path, pageSize, pageNumber ] let payload = %* [password, derivedFrom, path, pageSize, pageNumber ]
result = core.callPrivateRPC("accounts_getDerivedAddressesForPath", payload) result = core.callPrivateRPC("wallet_getDerivedAddressesForPath", payload)
proc getDerivedAddressListForMnemonic*(mnemonic: string, path: string, pageSize: int = 0, pageNumber: int = 6,): RpcResponse[JsonNode] {.raises: [Exception].} = proc getDerivedAddressListForMnemonic*(mnemonic: string, path: string, pageSize: int = 0, pageNumber: int = 6,): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [mnemonic, path, pageSize, pageNumber ] let payload = %* [mnemonic, path, pageSize, pageNumber ]
result = core.callPrivateRPC("accounts_getDerivedAddressesForMenominicWithPath", payload) result = core.callPrivateRPC("wallet_getDerivedAddressesForMenominicWithPath", payload)

View File

@ -35,6 +35,7 @@ Item {
stackLayout.currentIndex = nextSelectableAddressIndex/_internal.pageSize stackLayout.currentIndex = nextSelectableAddressIndex/_internal.pageSize
if(nextSelectableAddressIndex >= 0 && nextSelectableAddressIndex < RootStore.derivedAddressesList.count) { if(nextSelectableAddressIndex >= 0 && nextSelectableAddressIndex < RootStore.derivedAddressesList.count) {
selectedDerivedAddress.title = RootStore.getDerivedAddressData(nextSelectableAddressIndex) selectedDerivedAddress.title = RootStore.getDerivedAddressData(nextSelectableAddressIndex)
selectedDerivedAddress.hasActivity = RootStore.getDerivedAddressHasActivityData(nextSelectableAddressIndex)
selectedDerivedAddress.subTitle = RootStore.getDerivedAddressHasActivityData(nextSelectableAddressIndex) ? qsTr("Has Activity"): qsTr("No Activity") selectedDerivedAddress.subTitle = RootStore.getDerivedAddressHasActivityData(nextSelectableAddressIndex) ? qsTr("Has Activity"): qsTr("No Activity")
selectedDerivedAddress.enabled = !RootStore.getDerivedAddressAlreadyCreatedData(nextSelectableAddressIndex) selectedDerivedAddress.enabled = !RootStore.getDerivedAddressAlreadyCreatedData(nextSelectableAddressIndex)
selectedDerivedAddress.pathSubFix = nextSelectableAddressIndex selectedDerivedAddress.pathSubFix = nextSelectableAddressIndex
@ -70,12 +71,14 @@ Item {
StatusListItem { StatusListItem {
id: selectedDerivedAddress id: selectedDerivedAddress
property int pathSubFix: 0 property int pathSubFix: 0
property bool hasActivity: false
implicitWidth: parent.width implicitWidth: parent.width
color: "transparent" color: "transparent"
border.width: 1 border.width: 1
border.color: Theme.palette.baseColor2 border.color: Theme.palette.baseColor2
title: "---" title: "---"
subTitle: qsTr("No activity") subTitle: selectedDerivedAddress.hasActivity ? qsTr("Has Activity"): qsTr("No Activity")
statusListItemSubTitle.color: selectedDerivedAddress.hasActivity ? Theme.palette.primaryColor1 : Theme.palette.baseColor1
statusListItemTitle.wrapMode: Text.NoWrap statusListItemTitle.wrapMode: Text.NoWrap
statusListItemTitle.width: _internal.maxAddressWidth statusListItemTitle.width: _internal.maxAddressWidth
statusListItemTitle.elide: Qt.ElideMiddle statusListItemTitle.elide: Qt.ElideMiddle
@ -115,6 +118,7 @@ Item {
delegate: StatusListItem { delegate: StatusListItem {
id: element id: element
property int actualIndex: index + (stackLayout.currentIndex* _internal.pageSize) property int actualIndex: index + (stackLayout.currentIndex* _internal.pageSize)
property bool hasActivity: RootStore.getDerivedAddressHasActivityData(actualIndex)
implicitWidth: derivedAddressPopup.width implicitWidth: derivedAddressPopup.width
statusListItemTitle.wrapMode: Text.NoWrap statusListItemTitle.wrapMode: Text.NoWrap
statusListItemTitle.width: _internal.maxAddressWidth statusListItemTitle.width: _internal.maxAddressWidth
@ -122,19 +126,29 @@ Item {
statusListItemTitle.anchors.left: undefined statusListItemTitle.anchors.left: undefined
statusListItemTitle.anchors.right: undefined statusListItemTitle.anchors.right: undefined
title: RootStore.getDerivedAddressData(actualIndex) title: RootStore.getDerivedAddressData(actualIndex)
subTitle: RootStore.getDerivedAddressHasActivityData(actualIndex) ? qsTr("Has Activity"): qsTr("No Activity") subTitle: element.hasActivity ? qsTr("Has Activity"): qsTr("No Activity")
statusListItemSubTitle.color: element.hasActivity ? Theme.palette.primaryColor1 : Theme.palette.baseColor1
enabled: !RootStore.getDerivedAddressAlreadyCreatedData(actualIndex) enabled: !RootStore.getDerivedAddressAlreadyCreatedData(actualIndex)
components: [ components: [
StatusBaseText { StatusBaseText {
text: element.actualIndex text: element.actualIndex
font.pixelSize: 15 font.pixelSize: 15
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1
},
Rectangle {
radius: width/2
height: 5
width: 5
color: Theme.palette.primaryColor1
visible: element.hasActivity
anchors.verticalCenter: parent.verticalCenter
} }
] ]
onClicked: { onClicked: {
selectedDerivedAddress.title = title selectedDerivedAddress.title = title
selectedDerivedAddress.subTitle = subTitle selectedDerivedAddress.subTitle = subTitle
selectedDerivedAddress.pathSubFix = actualIndex selectedDerivedAddress.pathSubFix = actualIndex
selectedDerivedAddress.hasActivity = element.hasActivity
derivedAddressPopup.close() derivedAddressPopup.close()
} }
} }

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 4018e4334beaaa5243a8a6e6450ecd5aeb3addef Subproject commit 15e5584ed2cd82e5f14ab0edff2a22af0bf83744