Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix saved addresses in activity 13663 #14069

Merged
merged 4 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions storybook/stubs/nim/sectionmocks/WalletSectionAccounts.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,4 @@ Item {
function getNameByAddress(address) {
return "Name Mock " + address.substring(0, 5)
}

//
// Silence warnings
readonly property QtObject overview: QtObject {
readonly property string mixedcaseAddress: ""
}
readonly property ListModel mixedcaseAddress: ListModel {}

signal walletAccountRemoved(string address)
}
12 changes: 9 additions & 3 deletions ui/app/AppLayouts/Wallet/panels/ActivityFilterPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,15 @@ Column {

Repeater {
model: activityFilterStore.recentsFilters
delegate: ActivityFilterTagItem {
tagPrimaryLabel.text: root.store.getNameForAddress(modelData) || StatusQUtils.Utils.elideText(modelData,6,4)
onClosed: activityFilterStore.toggleRecents(modelData)

// Use lazy loading as a workaround to refresh the list when the model is updated
// to force an address lookup to all delegates
delegate: Loader {
active: parent.visible
sourceComponent: ActivityFilterTagItem {
tagPrimaryLabel.text: root.store.getNameForAddress(modelData) || StatusQUtils.Utils.elideText(modelData,6,4)
onClosed: activityFilterStore.toggleRecents(modelData)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,52 +111,64 @@ StatusMenu {
StatusBaseText {
Layout.alignment: Qt.AlignHCenter
text: qsTr("No Recents")
visible: recipientsListView.count === 0 && !root.loadingRecipients
visible: !!recipientsLoader.item && recipientsLoader.item.count === 0 && !root.loadingRecipients
}
StatusBaseText {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Loading Recents")
visible: root.loadingRecipients
}
StatusListView {
id: recipientsListView
visible: !root.loadingRecipients

// Use lazy loading as a workaround to refresh the list when the model is updated
// to force an address lookup to all delegates
Loader {
id: recipientsLoader
Layout.fillWidth: true
Layout.fillHeight: true
model: SortFilterProxyModel {
sourceModel: root.recentsList
filters: ExpressionFilter {
enabled: root.recentsList.count > 0 && layout.currentIndex === 0
expression: {
const searchValue = searchBox.searchValue
if (!searchValue)
return true
const address = model.address.toLowerCase()
return address.startsWith(searchValue) || store.getNameForAddress(address).toLowerCase().indexOf(searchValue) !== -1
active: parent.visible && !root.loadingRecipients
sourceComponent: recipientsComponent
}

Component {
id: recipientsComponent

StatusListView {
visible: true
model: SortFilterProxyModel {
sourceModel: root.recentsList
filters: ExpressionFilter {
enabled: root.recentsList.count > 0 && layout.currentIndex === 0
expression: {
const searchValue = searchBox.searchValue
if (!searchValue)
return true
const address = model.address.toLowerCase()
return address.startsWith(searchValue) || store.getNameForAddress(address).toLowerCase().indexOf(searchValue) !== -1
}
}
}
}

reuseItems: true
delegate: ActivityTypeCheckBox {
readonly property string name: store.getNameForAddress(model.address)
width: ListView.view.width
height: 44
title: name || StatusQUtils.Utils.elideText(model.address,6,4)
subTitle: name ? StatusQUtils.Utils.elideText(model.address,6,4): ""
statusListItemSubTitle.elide: Text.ElideMiddle
statusListItemSubTitle.wrapMode: Text.NoWrap
assetSettings.name: name || "address"
assetSettings.isLetterIdenticon: !!name
assetSettings.bgHeight: 32
assetSettings.bgWidth: 32
assetSettings.bgRadius: assetSettings.bgHeight/2
assetSettings.width: !!name ? 32 : 16
assetSettings.height: !!name ? 32 : 16
buttonGroup: recentsButtonGroup
allChecked: root.allRecentsChecked
checked: root.allRecentsChecked ? true : root.recentsFilters.includes(model.address)
onActionTriggered: root.recentsToggled(model.address)
reuseItems: true
delegate: ActivityTypeCheckBox {
readonly property string name: store.getNameForAddress(model.address)
width: ListView.view.width
height: 44
title: name || StatusQUtils.Utils.elideText(model.address,6,4)
subTitle: name ? StatusQUtils.Utils.elideText(model.address,6,4): ""
statusListItemSubTitle.elide: Text.ElideMiddle
statusListItemSubTitle.wrapMode: Text.NoWrap
assetSettings.name: name || "address"
assetSettings.isLetterIdenticon: !!name
assetSettings.bgHeight: 32
assetSettings.bgWidth: 32
assetSettings.bgRadius: assetSettings.bgHeight/2
assetSettings.width: !!name ? 32 : 16
assetSettings.height: !!name ? 32 : 16
buttonGroup: recentsButtonGroup
allChecked: root.allRecentsChecked
checked: root.allRecentsChecked ? true : root.recentsFilters.includes(model.address)
onActionTriggered: root.recentsToggled(model.address)
}
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions ui/app/AppLayouts/Wallet/stores/RootStore.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ pragma Singleton

import QtQuick 2.13

import shared.stores 1.0
// Aliasing not to conflict with the shared.stores.RootStore
import shared.stores 1.0 as Stores

import utils 1.0

Expand Down Expand Up @@ -482,7 +483,7 @@ QtObject {
walletSectionAccounts.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance)
}

property CurrenciesStore currencyStore: CurrenciesStore {}
property Stores.CurrenciesStore currencyStore: Stores.CurrenciesStore {}

function addressWasShown(address) {
return root.mainModuleInst.addressWasShown(address)
Expand Down
38 changes: 21 additions & 17 deletions ui/app/AppLayouts/Wallet/views/RightTabView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ RightTabBaseView {
readonly property var detailedCollectibleActivityController: RootStore.tmpActivityController0
}

// StackLayout.currentIndex === 0
ColumnLayout {
spacing: 0

Expand Down Expand Up @@ -263,27 +264,30 @@ RightTabBaseView {
}
}

TransactionDetailView {
id: transactionDetailView
controller: RootStore.activityDetailsController
onVisibleChanged: {
if (visible) {
if (!!transaction) {
RootStore.addressWasShown(transaction.sender)
if (transaction.sender !== transaction.recipient) {
RootStore.addressWasShown(transaction.recipient)
Loader {
active: stack.currentIndex === 3

sourceComponent: TransactionDetailView {
controller: RootStore.activityDetailsController
onVisibleChanged: {
if (visible) {
if (!!transaction) {
RootStore.addressWasShown(transaction.sender)
if (transaction.sender !== transaction.recipient) {
RootStore.addressWasShown(transaction.recipient)
}
}
} else {
controller.resetActivityEntry()
}
} else {
controller.resetActivityEntry()
}
showAllAccounts: RootStore.showAllAccounts
communitiesStore: root.communitiesStore
sendModal: root.sendModal
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
visible: (stack.currentIndex === 3)
}
showAllAccounts: RootStore.showAllAccounts
communitiesStore: root.communitiesStore
sendModal: root.sendModal
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
visible: (stack.currentIndex === 3)
}
}
}
4 changes: 2 additions & 2 deletions ui/app/AppLayouts/Wallet/views/TransactionDetailView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Item {
width: parent.width
title: d.transactionType === Constants.TransactionType.Swap || d.transactionType === Constants.TransactionType.Bridge ?
qsTr("In") : qsTr("From")
addresses: d.isTransactionValid && d.reEvaluateSender? [d.transaction.from] : []
addresses: d.isTransactionValid && d.reEvaluateSender? [d.transaction.sender] : []
contactsStore: root.contactsStore
rootStore: WalletStores.RootStore
onButtonClicked: {
Expand Down Expand Up @@ -342,7 +342,7 @@ Item {
TransactionAddressTile {
width: parent.width
title: qsTr("To")
addresses: d.isTransactionValid && visible && d.reEvaluateRecipient? [d.transaction.to] : []
addresses: d.isTransactionValid && visible && d.reEvaluateRecipient? [d.transaction.recipient] : []
contactsStore: root.contactsStore
rootStore: WalletStores.RootStore
onButtonClicked: addressMenu.openReceiverMenu(this, addresses[0], [d.networkShortName])
Expand Down