move asset and collectible rebuild to communities module

This commit is contained in:
Jonathan Rainville 2023-06-26 11:05:10 -04:00
parent 28fa8271a6
commit cde6c53318
6 changed files with 21 additions and 17 deletions

View File

@ -318,11 +318,9 @@ proc init*(self: Controller) =
self.delegate.onCommunityCheckAllChannelsPermissionsResponse(args.checkAllChannelsPermissionsResponse)
self.events.on(SIGNAL_OWNED_COLLECTIBLES_UPDATE_FINISHED) do(e: Args):
self.delegate.onOwnedCollectiblesUpdated()
self.asyncCheckPermissions()
self.events.on(SIGNAL_WALLET_ACCOUNT_TOKENS_REBUILT) do(e: Args):
self.delegate.onWalletAccountTokensRebuilt()
self.asyncCheckPermissions()
self.events.on(SIGNAL_COMMUNITY_KICKED) do (e: Args):

View File

@ -367,9 +367,6 @@ method onCommunityTokenPermissionDeleted*(self: AccessInterface, communityId: st
method onCommunityTokenPermissionDeletionFailed*(self: AccessInterface, communityId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method onWalletAccountTokensRebuilt*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method onKickedFromCommunity*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
@ -391,9 +388,6 @@ method onDeactivateChatLoader*(self: AccessInterface, chatId: string) {.base.} =
method requestToJoinCommunityWithAuthentication*(self: AccessInterface, communityId: string, ensName: string) {.base.} =
raise newException(ValueError, "No implementation available")
method onOwnedcollectiblesUpdated*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method onCommunityCheckPermissionsToJoinResponse*(self: AccessInterface, checkPermissionsToJoinResponse: CheckPermissionsToJoinResponseDto) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -304,12 +304,6 @@ proc reevaluateRequiresTokenPermissionToJoin(self: Module) =
proc initCommunityTokenPermissionsModel(self: Module, channelGroup: ChannelGroupDto) =
self.rebuildCommunityTokenPermissionsModel()
method onWalletAccountTokensRebuilt*(self: Module) =
self.rebuildCommunityTokenPermissionsModel()
method onOwnedcollectiblesUpdated*(self: Module) =
self.rebuildCommunityTokenPermissionsModel()
proc convertPubKeysToJson(self: Module, pubKeys: string): seq[string] =
return map(parseJson(pubKeys).getElems(), proc(x:JsonNode):string = x.getStr)

View File

@ -1,4 +1,4 @@
import Tables, stint
import stint
import ./io_interface
import ../../../core/signals/types
@ -8,8 +8,8 @@ import ../../../../app_service/service/contacts/service as contacts_service
import ../../../../app_service/service/network/service as networks_service
import ../../../../app_service/service/community_tokens/service as community_tokens_service
import ../../../../app_service/service/token/service as token_service
import ../../shared_models/token_permissions_model
import ../../../../app_service/service/wallet_account/service as wallet_account_service
import ../../../../app_service/service/collectible/service as collectible_service
type
Controller* = ref object of RootObj
@ -120,6 +120,12 @@ proc init*(self: Controller) =
let args = CommunityTokenMetadataArgs(e)
self.delegate.onCommunityTokenMetadataAdded(args.communityId, args.tokenMetadata)
self.events.on(SIGNAL_OWNED_COLLECTIBLES_UPDATE_FINISHED) do(e: Args):
self.delegate.onOwnedCollectiblesUpdated()
self.events.on(SIGNAL_WALLET_ACCOUNT_TOKENS_REBUILT) do(e: Args):
self.delegate.onWalletAccountTokensRebuilt()
proc getCommunityTags*(self: Controller): string =
result = self.communityService.getCommunityTags()

View File

@ -153,3 +153,9 @@ method communityInfoAlreadyRequested*(self: AccessInterface) {.base.} =
method onCommunityTokenMetadataAdded*(self: AccessInterface, communityId: string, tokenMetadata: CommunityTokensMetadataDto) {.base.} =
raise newException(ValueError, "No implementation available")
method onOwnedCollectiblesUpdated*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method onWalletAccountTokensRebuilt*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -424,6 +424,12 @@ proc buildTokenList(self: Module) =
self.view.setTokenListItems(tokenListItems)
self.view.setCollectiblesListItems(collectiblesListItems)
method onWalletAccountTokensRebuilt*(self: Module) =
self.buildTokenList()
method onOwnedCollectiblesUpdated*(self: Module) =
self.buildTokenList()
method onCommunityTokenMetadataAdded*(self: Module, communityId: string, tokenMetadata: CommunityTokensMetadataDto) =
let tokenListItem = initTokenListItem(
key = tokenMetadata.symbol,