From df4a006a513c2bc4cc87f8de15a0cd5cc1b58e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Wed, 19 Jun 2024 16:16:56 +0200 Subject: [PATCH] feat(Chat/RootStore): collectibles model holding both community and wallet tokens --- ui/app/AppLayouts/Chat/stores/RootStore.qml | 57 ++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index b70484f318..c1a2849843 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -6,6 +6,10 @@ import SortFilterProxyModel 0.2 import StatusQ.Core.Utils 0.1 as StatusQUtils import shared.stores 1.0 +import AppLayouts.Wallet.stores 1.0 as WalletStore + +import StatusQ 0.1 + QtObject { id: root @@ -45,7 +49,9 @@ QtObject { } } - property var collectiblesModel: SortFilterProxyModel { + readonly property var tmp: SortFilterProxyModel { + id: tmpSfpm + sourceModel: communitiesModuleInst.collectiblesModel proxyRoles: ExpressionRole { @@ -57,6 +63,55 @@ QtObject { } } + readonly property var tmp2: ObjectProxyModel { + + sourceModel: WalletStore.RootStore.collectiblesStore.allCollectiblesModel + + delegate: QtObject { + readonly property string key: model.symbol + readonly property string shortName: model.collectionName ? model.collectionName : model.collectionUid ? model.collectionUid : "" + readonly property string symbol: shortName + readonly property int category: 1 + } + + exposedRoles: ["key", "symbol", "shortName"] + expectedRoles: ["symbol", "collectionName", "collectionUid"] + } + + readonly property var tmp3: SortFilterProxyModel { + id: tmpSfpm2 + + sourceModel: tmp2 + + filters: ValueFilter { + roleName: "communityId" + value: "" + } + } + + property var r: RolesRenamingModel { + id: renaming + + sourceModel: tmpSfpm2 + + mapping: RoleRename { + from: "mediaUrl" + to: "iconSource" + } + } + + property var collectiblesModel: ConcatModel { + + sources: [ + SourceModel { + model: tmpSfpm + }, + SourceModel { + model: renaming + } + ] + } + function prepareTokenModelForCommunity(publicKey) { root.communitiesModuleInst.prepareTokenModelForCommunity(publicKey) }