feat(Contacts): refresh profile on live data update, review fixes

This commit is contained in:
MishkaRogachev 2023-11-07 15:02:43 +04:00 committed by Jonathan Rainville
parent 84f3626390
commit e2c3cebdb5
15 changed files with 184 additions and 100 deletions

View File

@ -53,10 +53,18 @@ proc init*(self: Controller) =
let args = SocialLinksArgs(e)
self.delegate.onSocialLinksUpdated(args.socialLinks, args.error)
self.events.on(SIGNAL_PROFILE_SHOWCASE_PREFERENCES_LOADED) do(e: Args):
self.events.on(SIGNAL_PROFILE_SHOWCASE_PREFERENCES_UPDATED) do(e: Args):
let args = ProfileShowcasePreferencesArgs(e)
self.delegate.updateProfileShowcasePreferences(args.preferences)
self.events.on(SIGNAL_CONTACT_UPDATED) do(e: Args):
var args = ContactArgs(e)
self.delegate.onContactDetailsUpdated(args.contactId)
self.events.on(SIGNAL_COMMUNITIES_UPDATE) do(e: Args):
let args = CommunitiesArgs(e)
self.delegate.onCommunitiesUpdated(args.communities)
proc storeIdentityImage*(self: Controller, address: string, image: string, aX: int, aY: int, bX: int, bY: int) =
discard self.profileService.storeIdentityImage(address, image, aX, aY, bX, bY)
@ -75,8 +83,8 @@ proc getCommunityById*(self: Controller, id: string): CommunityDto =
proc getAccountByAddress*(self: Controller, address: string): WalletAccountDto =
return self.walletAccountService.getAccountByAddress(address)
proc getTokensByAddress*(self: Controller, address: string): seq[WalletTokenDto] =
return self.walletAccountService.getTokensByAddress(address)
proc getTokensByAddresses*(self: Controller, addresses: seq[string]): seq[WalletTokenDto] =
return self.walletAccountService.getTokensByAddresses(addresses)
proc getContactById*(self: Controller, id: string): ContactsDto =
return self.contactsService.getContactById(id)
@ -95,3 +103,6 @@ proc storeProfileShowcasePreferences*(self: Controller, preferences: ProfileShow
proc requestProfileShowcasePreferences*(self: Controller) =
self.profileService.requestProfileShowcasePreferences()
proc requestCommunityInfo*(self: Controller, communityId: string) =
self.communityService.requestCommunityInfo(communityId)

View File

@ -2,6 +2,7 @@ import NimQml
import app_service/common/social_links
import app_service/service/profile/dto/profile_showcase_preferences
import app_service/service/community/dto/community
import models/profile_preferences_community_item
import models/profile_preferences_account_item
@ -64,6 +65,12 @@ method requestProfileShowcase*(self: AccessInterface, publicKey: string) {.base.
method updateProfileShowcasePreferences*(self: AccessInterface, preferences: ProfileShowcasePreferencesDto) {.base.} =
raise newException(ValueError, "No implementation available")
method onContactDetailsUpdated*(self: AccessInterface, contactId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method onCommunitiesUpdated*(self: AccessInterface, communities: seq[CommunityDto]) {.base.} =
raise newException(ValueError, "No implementation available")
# View Delegate Interface
# Delegate for the view must be declared here due to use of QtObject and multi
# inheritance, which is not well supported in Nim.

View File

@ -138,13 +138,16 @@ QtObject:
self.recalcOrder()
self.baseModelFilterConditionsMayHaveChanged()
proc reset*(self: ProfileShowcaseAccountsModel) {.slot.} =
proc reset*(self: ProfileShowcaseAccountsModel, items: seq[ProfileShowcaseAccountItem]) =
self.beginResetModel()
self.items = @[]
self.items = items
self.endResetModel()
self.countChanged()
self.baseModelFilterConditionsMayHaveChanged()
proc clear*(self: ProfileShowcaseAccountsModel) {.slot.} =
self.reset(@[])
proc remove*(self: ProfileShowcaseAccountsModel, index: int) {.slot.} =
if index < 0 or index >= self.items.len:
return

View File

@ -138,13 +138,16 @@ QtObject:
self.recalcOrder()
self.baseModelFilterConditionsMayHaveChanged()
proc reset*(self: ProfileShowcaseAssetsModel) {.slot.} =
proc reset*(self: ProfileShowcaseAssetsModel, items: seq[ProfileShowcaseAssetItem]) =
self.beginResetModel()
self.items = @[]
self.items = items
self.endResetModel()
self.countChanged()
self.baseModelFilterConditionsMayHaveChanged()
proc clear*(self: ProfileShowcaseAssetsModel) {.slot.} =
self.reset(@[])
proc remove*(self: ProfileShowcaseAssetsModel, index: int) {.slot.} =
if index < 0 or index >= self.items.len:
return

View File

@ -143,13 +143,16 @@ QtObject:
self.recalcOrder()
self.baseModelFilterConditionsMayHaveChanged()
proc reset*(self: ProfileShowcaseCollectiblesModel) {.slot.} =
proc reset*(self: ProfileShowcaseCollectiblesModel, items: seq[ProfileShowcaseCollectibleItem]) =
self.beginResetModel()
self.items = @[]
self.items = items
self.endResetModel()
self.countChanged()
self.baseModelFilterConditionsMayHaveChanged()
proc clear*(self: ProfileShowcaseCollectiblesModel) {.slot.} =
self.reset(@[])
proc remove*(self: ProfileShowcaseCollectiblesModel, index: int) {.slot.} =
if index < 0 or index >= self.items.len:
return

View File

@ -13,6 +13,9 @@ type
MemberRole
Image
Color
Description
MembersCount
Loading
QtObject:
type
@ -56,6 +59,9 @@ QtObject:
ModelRole.MemberRole.int: "memberRole",
ModelRole.Image.int: "image",
ModelRole.Color.int: "color",
ModelRole.Description.int: "description",
ModelRole.MembersCount.int: "membersCount",
ModelRole.Loading.int: "loading",
}.toTable
method data(self: ProfileShowcaseCommunitiesModel, index: QModelIndex, role: int): QVariant =
@ -83,6 +89,12 @@ QtObject:
result = newQVariant(item.image)
of ModelRole.Color:
result = newQVariant(item.color)
of ModelRole.Description:
result = newQVariant(item.description)
of ModelRole.MembersCount:
result = newQVariant(item.membersCount)
of ModelRole.Loading:
result = newQVariant(item.loading)
proc findIndexForCommunity(self: ProfileShowcaseCommunitiesModel, id: string): int =
for i in 0 ..< self.items.len:
@ -124,6 +136,9 @@ QtObject:
ModelRole.MemberRole.int,
ModelRole.Image.int,
ModelRole.Color.int,
ModelRole.Description.int,
ModelRole.MembersCount.int,
ModelRole.Loading.int,
])
proc upsertItemJson(self: ProfileShowcaseCommunitiesModel, itemJson: string) {.slot.} =
@ -142,13 +157,16 @@ QtObject:
self.recalcOrder()
self.baseModelFilterConditionsMayHaveChanged()
proc reset*(self: ProfileShowcaseCommunitiesModel) {.slot.} =
proc reset*(self: ProfileShowcaseCommunitiesModel, items: seq[ProfileShowcaseCommunityItem]) =
self.beginResetModel()
self.items = @[]
self.items = items
self.endResetModel()
self.countChanged()
self.baseModelFilterConditionsMayHaveChanged()
proc clear*(self: ProfileShowcaseCommunitiesModel) {.slot.} =
self.reset(@[])
proc remove*(self: ProfileShowcaseCommunitiesModel, index: int) {.slot.} =
if index < 0 or index >= self.items.len:
return
@ -190,4 +208,4 @@ QtObject:
proc setVisibility*(self: ProfileShowcaseCommunitiesModel, id: string, visibility: int) {.slot.} =
let index = self.findIndexForCommunity(id)
if index != -1:
self.setVisibilityByIndex(index, visibility)
self.setVisibilityByIndex(index, visibility)

View File

@ -15,6 +15,9 @@ type
memberRole*: MemberRole
image*: string
color*: string
description*: string
membersCount*: int
loading*: bool
proc initProfileShowcaseCommunityItem*(community: CommunityDto, visibility: ProfileShowcaseVisibility, order: int): ProfileShowcaseCommunityItem =
result = ProfileShowcaseCommunityItem()
@ -27,6 +30,17 @@ proc initProfileShowcaseCommunityItem*(community: CommunityDto, visibility: Prof
result.memberRole = community.memberRole
result.image = community.images.thumbnail
result.color = community.color
result.description = community.description
result.membersCount = len(community.members)
result.loading = false
proc initProfileShowcaseCommunityLoadingItem*(communityId: string, visibility: ProfileShowcaseVisibility, order: int): ProfileShowcaseCommunityItem =
result = ProfileShowcaseCommunityItem()
result.showcaseVisibility = visibility
result.order = order
result.id = communityId
result.loading = true
proc toProfileShowcaseCommunityItem*(jsonObj: JsonNode): ProfileShowcaseCommunityItem =
result = ProfileShowcaseCommunityItem()
@ -43,6 +57,7 @@ proc toProfileShowcaseCommunityItem*(jsonObj: JsonNode): ProfileShowcaseCommunit
discard jsonObj.getProp("memberRole", result.memberRole)
discard jsonObj.getProp("image", result.image)
discard jsonObj.getProp("color", result.color)
result.loading = false
proc toShowcasePreferenceItem*(self: ProfileShowcaseCommunityItem): ProfileShowcaseCommunityPreference =
result = ProfileShowcaseCommunityPreference()
@ -51,6 +66,15 @@ proc toShowcasePreferenceItem*(self: ProfileShowcaseCommunityItem): ProfileShowc
result.showcaseVisibility = self.showcaseVisibility
result.order = self.order
proc patchFromCommunity*(self: ProfileShowcaseCommunityItem, community: CommunityDto) =
self.name = community.name
self.memberRole = community.memberRole
self.image = community.images.thumbnail
self.color = community.color
self.description = community.description
self.membersCount = len(community.members)
self.loading = false
proc name*(self: ProfileShowcaseCommunityItem): string {.inline.} =
self.name

View File

@ -33,6 +33,7 @@ type
view: View
viewVariant: QVariant
moduleLoaded: bool
presentedPublicKey: string
proc newModule*(
delegate: delegate_interface.AccessInterface,
@ -109,6 +110,10 @@ method storeProfileShowcasePreferences(self: Module,
accounts: seq[ProfileShowcaseAccountItem],
collectibles: seq[ProfileShowcaseCollectibleItem],
assets: seq[ProfileShowcaseAssetItem]) =
if self.presentedPublicKey != singletonInstance.userProfile.getPubKey():
error "Attempt to save preferences with wrong public key"
return
self.controller.storeProfileShowcasePreferences(ProfileShowcasePreferencesDto(
communities: communities.map(item => item.toShowcasePreferenceItem()),
accounts: accounts.map(item => item.toShowcasePreferenceItem()),
@ -117,9 +122,22 @@ method storeProfileShowcasePreferences(self: Module,
))
method requestProfileShowcasePreferences(self: Module) =
let myPublicKey = singletonInstance.userProfile.getPubKey()
if self.presentedPublicKey != myPublicKey:
self.view.clearModels()
self.presentedPublicKey = myPublicKey
self.controller.requestProfileShowcasePreferences()
method requestProfileShowcase*(self: Module, publicKey: string) =
if publicKey == singletonInstance.userProfile.getPubKey():
self.requestProfileShowcasePreferences()
return
if self.presentedPublicKey != publicKey:
self.view.clearModels()
self.presentedPublicKey = publicKey
let contact = self.controller.getContactById(publicKey)
var profileCommunityItems: seq[ProfileShowcaseCommunityItem] = @[]
@ -128,11 +146,17 @@ method requestProfileShowcase*(self: Module, publicKey: string) =
var profileAssetItems: seq[ProfileShowcaseAssetItem] = @[]
for communityEntry in contact.profileShowcase.communities:
# TODO: what if we don't know such community?
let community = self.controller.getCommunityById(communityEntry.communityId)
profileCommunityItems.add(initProfileShowcaseCommunityItem(
community, ProfileShowcaseVisibility.ToEveryone, communityEntry.order))
if community.id == "":
self.controller.requestCommunityInfo(communityEntry.communityId)
profileCommunityItems.add(initProfileShowcaseCommunityLoadingItem(
communityEntry.communityId, ProfileShowcaseVisibility.ToEveryone, communityEntry.order))
else:
profileCommunityItems.add(initProfileShowcaseCommunityItem(
community, ProfileShowcaseVisibility.ToEveryone, communityEntry.order))
self.view.updateProfileShowcaseCommunities(profileCommunityItems)
var addresses: seq[string] = @[]
for account in contact.profileShowcase.accounts:
profileAccountItems.add(initProfileShowcaseAccountItem(
account.address,
@ -142,17 +166,16 @@ method requestProfileShowcase*(self: Module, publicKey: string) =
ProfileShowcaseVisibility.ToEveryone,
account.order
))
addresses.add(account.address)
for assetEntry in contact.profileShowcase.assets:
# TODO: need wallet api to fetch token by symbol
for token in self.controller.getTokensByAddress(account.address):
if assetEntry.symbol == token.symbol:
# NOTE: here can be intersections
profileAssetItems.add(initProfileShowcaseAssetItem(token,
ProfileShowcaseVisibility.ToEveryone, assetEntry.order))
for assetEntry in contact.profileShowcase.assets:
for token in self.controller.getTokensByAddresses(addresses):
if assetEntry.symbol == token.symbol:
profileAssetItems.add(initProfileShowcaseAssetItem(token, ProfileShowcaseVisibility.ToEveryone, assetEntry.order))
# TODO: collectibles, need wallet api to fetch collectible by uid
self.view.updateProfileShowcasePreferences(profileCommunityItems, profileAccountItems, profileCollectibleItems, profileAssetItems)
self.view.updateProfileShowcaseAccounts(profileAccountItems)
self.view.updateProfileShowcaseAssets(profileAssetItems)
# TODO: collectibles, need wallet api to fetch collectible by uid
method updateProfileShowcasePreferences(self: Module, preferences: ProfileShowcasePreferencesDto) =
var profileCommunityItems: seq[ProfileShowcaseCommunityItem] = @[]
@ -162,8 +185,16 @@ method updateProfileShowcasePreferences(self: Module, preferences: ProfileShowca
for communityEntry in preferences.communities:
let community = self.controller.getCommunityById(communityEntry.communityId)
profileCommunityItems.add(initProfileShowcaseCommunityItem(community, communityEntry.showcaseVisibility, communityEntry.order))
if community.id == "":
self.controller.requestCommunityInfo(communityEntry.communityId)
profileCommunityItems.add(initProfileShowcaseCommunityLoadingItem(
communityEntry.communityId, communityEntry.showcaseVisibility, communityEntry.order))
else:
profileCommunityItems.add(initProfileShowcaseCommunityItem(
community, communityEntry.showcaseVisibility, communityEntry.order))
self.view.updateProfileShowcaseCommunities(profileCommunityItems)
var addresses: seq[string] = @[]
for account in preferences.accounts:
profileAccountItems.add(initProfileShowcaseAccountItem(
account.address,
@ -173,14 +204,27 @@ method updateProfileShowcasePreferences(self: Module, preferences: ProfileShowca
account.showcaseVisibility,
account.order
))
addresses.add(account.address)
for assetEntry in preferences.assets:
# TODO: need wallet api to fetch token by symbol
for token in self.controller.getTokensByAddress(account.address):
if assetEntry.symbol == token.symbol:
# NOTE: here can be intersections
profileAssetItems.add(initProfileShowcaseAssetItem(token, assetEntry.showcaseVisibility, assetEntry.order))
for assetEntry in preferences.assets:
for token in self.controller.getTokensByAddresses(addresses):
if assetEntry.symbol == token.symbol:
profileAssetItems.add(initProfileShowcaseAssetItem(token, assetEntry.showcaseVisibility, assetEntry.order))
# TODO: collectibles, need wallet api to fetch collectible by uid
self.view.updateProfileShowcaseAccounts(profileAccountItems)
self.view.updateProfileShowcaseAssets(profileAssetItems)
# TODO: collectibles, need wallet api to fetch collectible by uid
self.view.updateProfileShowcasePreferences(profileCommunityItems, profileAccountItems, profileCollectibleItems, profileAssetItems)
method onContactDetailsUpdated*(self: Module, contactId: string) =
if self.presentedPublicKey == contactId:
self.requestProfileShowcase(contactId)
method onCommunitiesUpdated*(self: Module, communities: seq[CommunityDto]) =
var profileCommunityItems = self.view.getProfileShowcaseCommunities()
for community in communities:
for item in profileCommunityItems:
if item.id == community.id:
item.patchFromCommunity(community)
self.view.updateProfileShowcaseCommunities(profileCommunityItems)

View File

@ -1,11 +1,9 @@
import NimQml, json, sequtils, chronicles
import NimQml, json, sequtils, sugar, std/algorithm
import io_interface
import app/modules/shared_models/social_links_model
import app/modules/shared_models/social_link_item
import app/global/global_singleton
import models/profile_preferences_communities_model
import models/profile_preferences_community_item
import models/profile_preferences_accounts_model
@ -31,7 +29,6 @@ QtObject:
profileShowcaseCollectiblesModelVariant: QVariant
profileShowcaseAssetsModel: ProfileShowcaseAssetsModel
profileShowcaseAssetsModelVariant: QVariant
presentedPublicKey: string
proc delete*(self: View) =
self.QObject.delete
@ -202,10 +199,6 @@ QtObject:
read = getProfileShowcaseAssetsModel
proc storeProfileShowcasePreferences(self: View) {.slot.} =
if self.presentedPublicKey != singletonInstance.userProfile.getPubKey():
error "Attempt to save preferences with wrong public key"
return
let communities = self.profileShowcaseCommunitiesModel.items()
let accounts = self.profileShowcaseAccountsModel.items()
let collectibles = self.profileShowcaseCollectiblesModel.items()
@ -213,44 +206,29 @@ QtObject:
self.delegate.storeProfileShowcasePreferences(communities, accounts, collectibles, assets)
proc clearModels(self: View) {.slot.} =
self.profileShowcaseCommunitiesModel.reset()
self.profileShowcaseAccountsModel.reset()
self.profileShowcaseCollectiblesModel.reset()
self.profileShowcaseAssetsModel.reset()
proc clearModels*(self: View) {.slot.} =
self.profileShowcaseCommunitiesModel.clear()
self.profileShowcaseAccountsModel.clear()
self.profileShowcaseCollectiblesModel.clear()
self.profileShowcaseAssetsModel.clear()
proc requestProfileShowcase(self: View, publicKey: string) {.slot.} =
if self.presentedPublicKey != publicKey:
self.clearModels()
if publicKey == singletonInstance.userProfile.getPubKey():
self.delegate.requestProfileShowcasePreferences()
else:
self.delegate.requestProfileShowcase(publicKey)
self.delegate.requestProfileShowcase(publicKey)
proc requestProfileShowcasePreferences(self: View) {.slot.} =
if self.presentedPublicKey != singletonInstance.userProfile.getPubKey():
self.clearModels()
self.delegate.requestProfileShowcasePreferences()
proc updateProfileShowcase*(self: View,
presentedPublicKey: string,
communities: seq[ProfileShowcaseCommunityItem],
accounts: seq[ProfileShowcaseAccountItem],
collectibles: seq[ProfileShowcaseCollectibleItem],
assets: seq[ProfileShowcaseAssetItem]) =
self.presentedPublicKey = presentedPublicKey
proc getProfileShowcaseCommunities*(self: View): seq[ProfileShowcaseCommunityItem] =
return self.profileShowcaseCommunitiesModel.items()
self.profileShowcaseCommunitiesModel.upsertItems(communities)
self.profileShowcaseAccountsModel.upsertItems(accounts)
self.profileShowcaseCollectiblesModel.upsertItems(collectibles)
self.profileShowcaseAssetsModel.upsertItems(assets)
proc updateProfileShowcaseCommunities*(self: View, communities: seq[ProfileShowcaseCommunityItem]) =
self.profileShowcaseCommunitiesModel.reset(communities.sorted((a, b) => cmp(a.order, b.order), SortOrder.Ascending))
proc updateProfileShowcasePreferences*(self: View,
communities: seq[ProfileShowcaseCommunityItem],
accounts: seq[ProfileShowcaseAccountItem],
collectibles: seq[ProfileShowcaseCollectibleItem],
assets: seq[ProfileShowcaseAssetItem]) =
self.updateProfileShowcase(singletonInstance.userProfile.getPubKey(), communities, accounts, collectibles, assets)
proc updateProfileShowcaseAccounts*(self: View, accounts: seq[ProfileShowcaseAccountItem]) =
self.profileShowcaseAccountsModel.reset(accounts.sorted((a, b) => cmp(a.order, b.order), SortOrder.Ascending))
proc updateProfileShowcaseCollectibless*(self: View, collectibles: seq[ProfileShowcaseCollectibleItem]) =
self.profileShowcaseCollectiblesModel.reset(collectibles.sorted((a, b) => cmp(a.order, b.order), SortOrder.Ascending))
proc updateProfileShowcaseAssets*(self: View, assets: seq[ProfileShowcaseAssetItem]) =
self.profileShowcaseAssetsModel.reset(assets.sorted((a, b) => cmp(a.order, b.order), SortOrder.Ascending))

View File

@ -1,4 +1,4 @@
import json, json_serialization, sugar, std/algorithm
import json, json_serialization, sugar
include ../../../common/json_utils
@ -61,9 +61,3 @@ proc toProfileShowcase*(jsonObj: JsonNode): ProfileShowcase =
result.collectibles.add(jsonMsg.toProfileShowcaseCollectible())
for jsonMsg in jsonObj["assets"]:
result.assets.add(jsonMsg.toProfileShowcaseAsset())
# Sort by order as early as possible
result.communities.sort((a, b) => cmp(a.order, b.order))
result.accounts.sort((a, b) => cmp(a.order, b.order))
result.collectibles.sort((a, b) => cmp(a.order, b.order))
result.assets.sort((a, b) => cmp(a.order, b.order))

View File

@ -1,4 +1,4 @@
import json, strformat, strutils, stint, sequtils, json_serialization, std/algorithm
import json, strformat, strutils, stint, sequtils, json_serialization
include ../../../common/json_utils
include ../../../common/utils
@ -116,12 +116,6 @@ proc toProfileShowcasePreferencesDto*(jsonObj: JsonNode): ProfileShowcasePrefere
for jsonMsg in jsonObj["assets"]:
result.assets.add(jsonMsg.toProfileShowcaseAssetPreference())
# Sort by order as early as possible
result.communities.sort((a, b) => cmp(a.order, b.order))
result.accounts.sort((a, b) => cmp(a.order, b.order))
result.collectibles.sort((a, b) => cmp(a.order, b.order))
result.assets.sort((a, b) => cmp(a.order, b.order))
proc toJsonNode*(self: ProfileShowcasePreferencesDto): JsonNode =
let communities = self.communities.map(entry => entry.toJsonNode())
let accounts = self.accounts.map(entry => entry.toJsonNode())

View File

@ -22,7 +22,7 @@ type
preferences*: ProfileShowcasePreferencesDto
# Signals which may be emitted by this service:
const SIGNAL_PROFILE_SHOWCASE_PREFERENCES_LOADED* = "profileShowcasePreferencesLoaded"
const SIGNAL_PROFILE_SHOWCASE_PREFERENCES_UPDATED* = "profileShowcasePreferencesUpdated"
QtObject:
type Service* = ref object of QObject
@ -110,7 +110,7 @@ QtObject:
let preferences = rpcResponseObj["response"]["result"].toProfileShowcasePreferencesDto()
self.events.emit(SIGNAL_PROFILE_SHOWCASE_PREFERENCES_LOADED,
self.events.emit(SIGNAL_PROFILE_SHOWCASE_PREFERENCES_UPDATED,
ProfileShowcasePreferencesArgs(preferences: preferences))
except Exception as e:
error "Error requesting profile showcase preferences", msg = e.msg

View File

@ -9,7 +9,7 @@ ProfileShowcasePanel {
keyRole: "symbol"
roleNames: ["symbol", "name", "enabledNetworkBalance"].concat(showcaseRoles)
filterFunc: (modelData) => !showcaseModel.hasItemInShowcase(modelData.symbol)
filterFunc: (modelData) => modelData.symbol !== "" && !showcaseModel.hasItemInShowcase(modelData.symbol)
hiddenPlaceholderBanner: qsTr("Assets here will show on your profile")
showcasePlaceholderBanner: qsTr("Assets here will be hidden from your profile")

View File

@ -34,7 +34,7 @@ Control {
signal showcaseEntryChanged()
function reset() {
showcaseModel.reset()
showcaseModel.clear()
updateBaseModelFilters()
}
@ -324,7 +324,7 @@ Control {
onDropped: function(drop) {
showcaseModel.setVisibilityByIndex(drop.source.visualIndex, Constants.ShowcaseVisibility.NoOne)
root.showcaseEntryChanged()
root.updateModelsAfterChange()
root.updateBaseModelFilters()
}
}
}

View File

@ -81,11 +81,17 @@ Control {
visible: count
model: SortFilterProxyModel {
sourceModel: root.profileStore.profileShowcaseCommunitiesModel
filters: ValueFilter {
roleName: "showcaseVisibility"
value: Constants.ShowcaseVisibility.NoOne
inverted: true
}
filters: [
ValueFilter {
roleName: "showcaseVisibility"
value: Constants.ShowcaseVisibility.NoOne
inverted: true
},
ValueFilter {
roleName: "loading"
value: false
}
]
}
ScrollBar.vertical: StatusScrollBar { }
delegate: StatusListItem { // TODO custom delegate
@ -94,8 +100,8 @@ Control {
title: model.name
statusListItemTitle.font.pixelSize: 17
statusListItemTitle.font.bold: true
//subTitle: model.description // TODO: no data in showcase model
//tertiaryTitle: qsTr("%n member(s)", "", model.members.count) // TODO: no data in showcase model
subTitle: model.description
tertiaryTitle: qsTr("%n member(s)", "", model.membersCount)
asset.name: model.image ?? model.name
asset.isImage: asset.name.startsWith(Constants.dataImagePrefix)
asset.isLetterIdenticon: !model.image
@ -169,7 +175,6 @@ Control {
components: [
StatusIcon {
anchors.verticalCenter: parent.verticalCenter
//visible: model.walletType === Constants.watchWalletType
icon: "show"
color: Theme.palette.directColor1
},