fix(wallet): Show community name in tag (#14622)
This commit is contained in:
parent
8b8af40979
commit
2565c8a135
|
@ -22,10 +22,7 @@ type
|
||||||
Ownership
|
Ownership
|
||||||
# Community-related roles
|
# Community-related roles
|
||||||
CommunityId
|
CommunityId
|
||||||
CommunityName
|
|
||||||
CommunityColor
|
|
||||||
CommunityPrivilegesLevel
|
CommunityPrivilegesLevel
|
||||||
CommunityImage
|
|
||||||
TokenType
|
TokenType
|
||||||
Soulbound
|
Soulbound
|
||||||
|
|
||||||
|
@ -145,10 +142,7 @@ QtObject:
|
||||||
CollectibleRole.IsLoading.int:"isLoading",
|
CollectibleRole.IsLoading.int:"isLoading",
|
||||||
CollectibleRole.Ownership.int:"ownership",
|
CollectibleRole.Ownership.int:"ownership",
|
||||||
CollectibleRole.CommunityId.int:"communityId",
|
CollectibleRole.CommunityId.int:"communityId",
|
||||||
CollectibleRole.CommunityName.int:"communityName",
|
|
||||||
CollectibleRole.CommunityColor.int:"communityColor",
|
|
||||||
CollectibleRole.CommunityPrivilegesLevel.int:"communityPrivilegesLevel",
|
CollectibleRole.CommunityPrivilegesLevel.int:"communityPrivilegesLevel",
|
||||||
CollectibleRole.CommunityImage.int:"communityImage",
|
|
||||||
CollectibleRole.TokenType.int:"tokenType",
|
CollectibleRole.TokenType.int:"tokenType",
|
||||||
CollectibleRole.Soulbound.int:"soulbound"
|
CollectibleRole.Soulbound.int:"soulbound"
|
||||||
}.toTable
|
}.toTable
|
||||||
|
@ -195,14 +189,8 @@ QtObject:
|
||||||
result = item.getOwnershipModelAsVariant()
|
result = item.getOwnershipModelAsVariant()
|
||||||
of CollectibleRole.CommunityId:
|
of CollectibleRole.CommunityId:
|
||||||
result = newQVariant(item.getCommunityId())
|
result = newQVariant(item.getCommunityId())
|
||||||
of CollectibleRole.CommunityName:
|
|
||||||
result = newQVariant(item.getCommunityName())
|
|
||||||
of CollectibleRole.CommunityColor:
|
|
||||||
result = newQVariant(item.getCommunityColor())
|
|
||||||
of CollectibleRole.CommunityPrivilegesLevel:
|
of CollectibleRole.CommunityPrivilegesLevel:
|
||||||
result = newQVariant(item.getCommunityPrivilegesLevel())
|
result = newQVariant(item.getCommunityPrivilegesLevel())
|
||||||
of CollectibleRole.CommunityImage:
|
|
||||||
result = newQVariant(item.getCommunityImage())
|
|
||||||
of CollectibleRole.TokenType:
|
of CollectibleRole.TokenType:
|
||||||
result = newQVariant(item.getTokenType())
|
result = newQVariant(item.getTokenType())
|
||||||
of CollectibleRole.Soulbound:
|
of CollectibleRole.Soulbound:
|
||||||
|
@ -227,10 +215,7 @@ QtObject:
|
||||||
of "collectionSlug": result = item.getCollectionSlug()
|
of "collectionSlug": result = item.getCollectionSlug()
|
||||||
of "isLoading": result = $false
|
of "isLoading": result = $false
|
||||||
of "communityId": result = item.getCommunityID()
|
of "communityId": result = item.getCommunityID()
|
||||||
of "communityName": result = item.getCommunityName()
|
|
||||||
of "communityColor": result = item.getCommunityColor()
|
|
||||||
of "communityPrivilegesLevel": result = $item.getCommunityPrivilegesLevel()
|
of "communityPrivilegesLevel": result = $item.getCommunityPrivilegesLevel()
|
||||||
of "communityImage": result = item.getCommunityImage()
|
|
||||||
|
|
||||||
proc resetCollectibleItems(self: Model, newItems: seq[CollectiblesEntry] = @[]) =
|
proc resetCollectibleItems(self: Model, newItems: seq[CollectiblesEntry] = @[]) =
|
||||||
self.beginResetModel()
|
self.beginResetModel()
|
||||||
|
|
|
@ -3,6 +3,7 @@ import QtQuick 2.13
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
import StatusQ 0.1
|
import StatusQ 0.1
|
||||||
|
import StatusQ.Models 0.1
|
||||||
import StatusQ.Core.Utils 0.1
|
import StatusQ.Core.Utils 0.1
|
||||||
|
|
||||||
import SortFilterProxyModel 0.2
|
import SortFilterProxyModel 0.2
|
||||||
|
@ -13,7 +14,7 @@ QtObject {
|
||||||
property var walletModule
|
property var walletModule
|
||||||
property var accountsModule: root.walletModule.accountsModule
|
property var accountsModule: root.walletModule.accountsModule
|
||||||
property var networksModuleInst: networksModule
|
property var networksModuleInst: networksModule
|
||||||
property var collectibles: root.walletModule.collectiblesModel
|
property var collectibles: _jointCollectiblesBySymbolModel
|
||||||
|
|
||||||
property var accountSensitiveSettings: Global.appIsReady? localAccountSensitiveSettings : null
|
property var accountSensitiveSettings: Global.appIsReady? localAccountSensitiveSettings : null
|
||||||
property var dappList: Global.appIsReady? dappPermissionsModule.dapps : null
|
property var dappList: Global.appIsReady? dappPermissionsModule.dapps : null
|
||||||
|
@ -56,6 +57,42 @@ QtObject {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* PRIVATE: This model renames the roles
|
||||||
|
1. "id" to "communityId"
|
||||||
|
2. "name" to "communityName"
|
||||||
|
3. "image" to "communityImage"
|
||||||
|
4. "description" to "communityDescription"
|
||||||
|
in communitiesModule.model so that it can be easily
|
||||||
|
joined with the Collectibles model */
|
||||||
|
readonly property var _renamedCommunitiesModel: RolesRenamingModel {
|
||||||
|
sourceModel: communitiesModule.model
|
||||||
|
mapping: [
|
||||||
|
RoleRename {
|
||||||
|
from: "id"
|
||||||
|
to: "communityId"
|
||||||
|
},
|
||||||
|
RoleRename {
|
||||||
|
from: "name"
|
||||||
|
to: "communityName"
|
||||||
|
},
|
||||||
|
RoleRename {
|
||||||
|
from: "image"
|
||||||
|
to: "communityImage"
|
||||||
|
},
|
||||||
|
RoleRename {
|
||||||
|
from: "description"
|
||||||
|
to: "communityDescription"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PRIVATE: This model joins the "Tokens By Symbol Model" and "Communities Model" by communityId */
|
||||||
|
property LeftJoinModel _jointCollectiblesBySymbolModel: LeftJoinModel {
|
||||||
|
leftModel: root.walletModule.collectiblesModel
|
||||||
|
rightModel: _renamedCommunitiesModel
|
||||||
|
joinRole: "communityId"
|
||||||
|
}
|
||||||
|
|
||||||
property string userProfilePublicKey: userProfile.pubKey
|
property string userProfilePublicKey: userProfile.pubKey
|
||||||
|
|
||||||
function deleteAccount(address) {
|
function deleteAccount(address) {
|
||||||
|
|
|
@ -19,7 +19,6 @@ Control {
|
||||||
property string communityId
|
property string communityId
|
||||||
property var communityImage
|
property var communityImage
|
||||||
property bool loading
|
property bool loading
|
||||||
property bool useLongTextDescription: true
|
|
||||||
|
|
||||||
property Component customBackground: Component {
|
property Component customBackground: Component {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -53,7 +52,7 @@ Control {
|
||||||
Layout.preferredHeight: visible ? asset.width : 0
|
Layout.preferredHeight: visible ? asset.width : 0
|
||||||
asset.width: 16
|
asset.width: 16
|
||||||
asset.height: 16
|
asset.height: 16
|
||||||
visible: root.useLongTextDescription && !!asset.source
|
visible: !d.unknownCommunityName && !!asset.source
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
updateCommunityImage()
|
updateCommunityImage()
|
||||||
|
|
|
@ -5,6 +5,8 @@ import StatusQ.Models 0.1
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
|
import SortFilterProxyModel 0.2
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
@ -27,7 +29,7 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property var collectiblesController: ManageTokensController {
|
readonly property var collectiblesController: ManageTokensController {
|
||||||
sourceModel: allCollectiblesModel
|
sourceModel: _jointCollectiblesBySymbolModel
|
||||||
settingsKey: "WalletCollectibles"
|
settingsKey: "WalletCollectibles"
|
||||||
serializeAsCollectibles: true
|
serializeAsCollectibles: true
|
||||||
|
|
||||||
|
@ -51,6 +53,43 @@ QtObject {
|
||||||
qsTr("%1 community collectibles are now visible").arg(communityName), "", "checkmark-circle",
|
qsTr("%1 community collectibles are now visible").arg(communityName), "", "checkmark-circle",
|
||||||
false, Constants.ephemeralNotificationType.success, "")
|
false, Constants.ephemeralNotificationType.success, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* PRIVATE: This model renames the roles
|
||||||
|
1. "id" to "communityId"
|
||||||
|
2. "name" to "communityName"
|
||||||
|
3. "image" to "communityImage"
|
||||||
|
4. "description" to "communityDescription"
|
||||||
|
in communitiesModule.model so that it can be easily
|
||||||
|
joined with the Collectibles model */
|
||||||
|
readonly property var _renamedCommunitiesModel: RolesRenamingModel {
|
||||||
|
sourceModel: communitiesModule.model
|
||||||
|
mapping: [
|
||||||
|
RoleRename {
|
||||||
|
from: "id"
|
||||||
|
to: "communityId"
|
||||||
|
},
|
||||||
|
RoleRename {
|
||||||
|
from: "name"
|
||||||
|
to: "communityName"
|
||||||
|
},
|
||||||
|
RoleRename {
|
||||||
|
from: "image"
|
||||||
|
to: "communityImage"
|
||||||
|
},
|
||||||
|
RoleRename {
|
||||||
|
from: "description"
|
||||||
|
to: "communityDescription"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PRIVATE: This model joins the "Tokens By Symbol Model" and "Communities Model" by communityId */
|
||||||
|
property LeftJoinModel _jointCollectiblesBySymbolModel: LeftJoinModel {
|
||||||
|
leftModel: allCollectiblesModel
|
||||||
|
rightModel: _renamedCommunitiesModel
|
||||||
|
joinRole: "communityId"
|
||||||
|
}
|
||||||
|
|
||||||
readonly property bool areCollectiblesFetching: !!root._allCollectiblesModel ? root._allCollectiblesModel.isFetching : true
|
readonly property bool areCollectiblesFetching: !!root._allCollectiblesModel ? root._allCollectiblesModel.isFetching : true
|
||||||
readonly property bool areCollectiblesUpdating: !!root._allCollectiblesModel ? root._allCollectiblesModel.isUpdating : false
|
readonly property bool areCollectiblesUpdating: !!root._allCollectiblesModel ? root._allCollectiblesModel.isUpdating : false
|
||||||
readonly property bool areCollectiblesError: !!root._allCollectiblesModel ? root._allCollectiblesModel.isError : false
|
readonly property bool areCollectiblesError: !!root._allCollectiblesModel ? root._allCollectiblesModel.isError : false
|
||||||
|
|
|
@ -189,7 +189,6 @@ Control {
|
||||||
communityImage: root.communityImage
|
communityImage: root.communityImage
|
||||||
visible: root.isCommunityCollectible
|
visible: root.isCommunityCollectible
|
||||||
enabled: !root.isLoading
|
enabled: !root.isLoading
|
||||||
useLongTextDescription: false
|
|
||||||
|
|
||||||
TapHandler {
|
TapHandler {
|
||||||
enabled: !d.unknownCommunityName
|
enabled: !d.unknownCommunityName
|
||||||
|
|
Loading…
Reference in New Issue