fix(SendModal): fix not showing tokens in the holding selector

The previous attempt to control the order of delegate intantiation
and avoid qml warnings didn't work for this case (Loader with injected
properties). Therefore, I reverted to the last working version.
This commit is contained in:
Stefan 2024-04-04 17:41:43 +03:00 committed by Stefan Dunca
parent bf8a86d4af
commit 6762630e51
2 changed files with 30 additions and 48 deletions

View File

@ -12,12 +12,6 @@ import utils 1.0
StatusListItem {
id: root
required property var model
required property string name
required property string symbol
required property int decimals
required property var balances
signal tokenSelected(var selectedToken)
signal tokenHovered(var selectedToken, bool hovered)
property var formatCurrentCurrencyAmount: function(balance){}
@ -55,7 +49,7 @@ StatusListItem {
return root.formatCurrentCurrencyAmount(balance)
}
// Community assets have a dedicated image streamed from status-go
asset.name: !!model.image
asset.name: !!model && !!model.image
? model.image
: Constants.tokenIcon(symbol)
asset.isImage: true

View File

@ -226,26 +226,14 @@ Item {
property var groupName: model.groupName
property var isGroup: model.isGroup
property var count: model.count
sourceComponent: d.isCurrentBrowsingTypeAsset ? assetComboBoxDelegate : collectibleComboBoxDelegate
}
}
// Switch models and delegate in the right order not to mix different models and delegates
function updateComponents() {
holdingItemSelector.comboBoxModel = []
sourceComponent: d.isCurrentBrowsingTypeAsset ? assetComboBoxDelegate : collectibleComboBoxDelegate
holdingItemSelector.comboBoxModel = d.isCurrentBrowsingTypeAsset
comboBoxModel: d.isCurrentBrowsingTypeAsset
? root.assetsModel
: d.collectibleComboBoxModel
}
Component.onCompleted: updateComponents()
Connections {
target: d
function onIsCurrentBrowsingTypeAssetChanged() {
holdingItemSelector.updateComponents()
}
}
comboBoxModel: null
comboBoxPopupHeader: headerComponent
itemTextFn: d.isCurrentBrowsingTypeAsset ? d.assetTextFn : d.collectibleTextFn
itemIconSourceFn: d.isCurrentBrowsingTypeAsset ? d.assetIconSourceFn : d.collectibleIconSourceFn