From 180932b7998a3d07f2a4753f564cb0c13785977b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Tue, 9 Apr 2024 14:24:53 +0200 Subject: [PATCH] chore(SharedAddressesAccountSelector): Remove workaround related to issue #14244 Additionally flow is simplified slightly by setting `type` role in ConcatModel --- .../panels/SharedAddressesAccountSelector.qml | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/ui/app/AppLayouts/Communities/panels/SharedAddressesAccountSelector.qml b/ui/app/AppLayouts/Communities/panels/SharedAddressesAccountSelector.qml index 7ac83e6a07..0e73b00b31 100644 --- a/ui/app/AppLayouts/Communities/panels/SharedAddressesAccountSelector.qml +++ b/ui/app/AppLayouts/Communities/panels/SharedAddressesAccountSelector.qml @@ -153,7 +153,6 @@ StatusListView { symbol: d.collectiblesNamesToSymbols[firstEntry.name] || "", enabledNetworkBalance: e.length, account: firstEntry.ownership[0].accountAddress, - type: Constants.TokenType.ERC721, imageUrl: d.collectiblesNamesToImages[firstEntry.name] || "" } }) @@ -210,15 +209,16 @@ StatusListView { ConcatModel { id: concatModel + markerRoleName: "type" + sources: [ SourceModel { - // During initialization sfpm provides rowCount not taking - // filtering into account, deferring model assignment as - // a workaround - Component.onCompleted: model = walletAccountAssetsModel + model: walletAccountAssetsModel + markerRoleValue: Constants.TokenType.ERC20 }, SourceModel { - Component.onCompleted: model = accountCollectiblesModel + model: accountCollectiblesModel + markerRoleValue: Constants.TokenType.ERC721 } ] } @@ -254,15 +254,6 @@ StatusListView { expression: d.getTotalBalance(model.balances, model.decimals) expectedRoles: ["balances", "decimals"] }, - FastExpressionRole { - name: "type" - - readonly property int typeVal: Constants.TokenType.ERC20 - - // Singletons cannot be used directly in sfpm's expressions - expression: typeVal - expectedRoles: [] - }, FastExpressionRole { name: "imageUrl" @@ -295,8 +286,11 @@ StatusListView { StatusBaseText { anchors.verticalCenter: parent.verticalCenter font.pixelSize: Theme.tertiaryTextFontSize + + readonly property int type: model.type + text: { - if (model.type === Constants.TokenType.ERC20) + if (type === Constants.TokenType.ERC20) return LocaleUtils.currencyAmountToLocaleString( root.getCurrencyAmount(model.enabledNetworkBalance, model.symbol))