feat(Chat/RootStore): collectibles model holding both community and wallet tokens

This commit is contained in:
Michał Cieślak 2024-06-19 16:16:56 +02:00
parent 15452aa79c
commit df4a006a51
1 changed files with 56 additions and 1 deletions

View File

@ -6,6 +6,10 @@ import SortFilterProxyModel 0.2
import StatusQ.Core.Utils 0.1 as StatusQUtils import StatusQ.Core.Utils 0.1 as StatusQUtils
import shared.stores 1.0 import shared.stores 1.0
import AppLayouts.Wallet.stores 1.0 as WalletStore
import StatusQ 0.1
QtObject { QtObject {
id: root id: root
@ -45,7 +49,9 @@ QtObject {
} }
} }
property var collectiblesModel: SortFilterProxyModel { readonly property var tmp: SortFilterProxyModel {
id: tmpSfpm
sourceModel: communitiesModuleInst.collectiblesModel sourceModel: communitiesModuleInst.collectiblesModel
proxyRoles: ExpressionRole { 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) { function prepareTokenModelForCommunity(publicKey) {
root.communitiesModuleInst.prepareTokenModelForCommunity(publicKey) root.communitiesModuleInst.prepareTokenModelForCommunity(publicKey)
} }