fix(@desktop/communities): Fix double toast message

Fix #10486
This commit is contained in:
Michal Iskierko 2023-04-28 20:48:20 +02:00 committed by Michał Iskierko
parent 202a789c67
commit a73ea4604e
7 changed files with 17 additions and 13 deletions

View File

@ -47,10 +47,10 @@ proc init*(self: Controller) =
self.communityTokensModule.onDeployFeeComputed(args.ethCurrency, args.fiatCurrency, args.errorCode)
self.events.on(SIGNAL_COMMUNITY_TOKEN_DEPLOYED) do(e: Args):
let args = CommunityTokenDeployedArgs(e)
self.communityTokensModule.onCommunityTokenDeployStateChanged(args.communityToken.chainId, args.transactionHash, args.communityToken.deployState)
self.communityTokensModule.onCommunityTokenDeployStateChanged(args.communityToken.communityId, args.communityToken.chainId, args.transactionHash, args.communityToken.deployState)
self.events.on(SIGNAL_COMMUNITY_TOKEN_DEPLOY_STATUS) do(e: Args):
let args = CommunityTokenDeployedStatusArgs(e)
self.communityTokensModule.onCommunityTokenDeployStateChanged(args.chainId, args.transactionHash, args.deployState)
self.communityTokensModule.onCommunityTokenDeployStateChanged(args.communityId, args.chainId, args.transactionHash, args.deployState)
proc deployCollectibles*(self: Controller, communityId: string, addressFrom: string, password: string, deploymentParams: DeploymentParameters, tokenMetadata: CommunityTokensMetadataDto, chainId: int) =
self.communityTokensService.deployCollectibles(communityId, addressFrom, password, deploymentParams, tokenMetadata, chainId)

View File

@ -29,5 +29,5 @@ method computeDeployFee*(self: AccessInterface, chainId: int, accountAddress: st
method onDeployFeeComputed*(self: AccessInterface, ethCurrency: CurrencyAmount, fiatCurrency: CurrencyAmount, errorCode: ComputeFeeErrorCode) {.base.} =
raise newException(ValueError, "No implementation available")
method onCommunityTokenDeployStateChanged*(self: AccessInterface, chainId: int, transactionHash: string, deployState: DeployState) {.base.} =
method onCommunityTokenDeployStateChanged*(self: AccessInterface, communityId: string, chainId: int, transactionHash: string, deployState: DeployState) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -126,7 +126,7 @@ method onDeployFeeComputed*(self: Module, ethCurrency: CurrencyAmount, fiatCurre
method computeDeployFee*(self: Module, chainId: int, accountAddress: string) =
self.controller.computeDeployFee(chainId, accountAddress)
method onCommunityTokenDeployStateChanged*(self: Module, chainId: int, transactionHash: string, deployState: DeployState) =
method onCommunityTokenDeployStateChanged*(self: Module, communityId: string, chainId: int, transactionHash: string, deployState: DeployState) =
let network = self.controller.getNetwork(chainId)
let url = if network != nil: network.blockExplorerURL & "/tx/" & transactionHash else: ""
self.view.emitDeploymentStateChanged(deployState.int, url)
self.view.emitDeploymentStateChanged(communityId, deployState.int, url)

View File

@ -33,6 +33,6 @@ QtObject:
proc updateDeployFee*(self: View, ethCurrency: CurrencyAmount, fiatCurrency: CurrencyAmount, errorCode: int) =
self.deployFeeUpdated(newQVariant(ethCurrency), newQVariant(fiatCurrency), errorCode)
proc deploymentStateChanged*(self: View, status: int, url: string) {.signal.}
proc emitDeploymentStateChanged*(self: View, status: int, url: string) =
self.deploymentStateChanged(status, url)
proc deploymentStateChanged*(self: View, communityId: string, status: int, url: string) {.signal.}
proc emitDeploymentStateChanged*(self: View, communityId: string, status: int, url: string) =
self.deploymentStateChanged(communityId, status, url)

View File

@ -222,7 +222,7 @@ QtObject:
let txData = TransactionDataDto(source: parseAddress(addressFrom)) #TODO estimate fee in UI
let response = tokens_backend.mintTo(collectibleAndAmount.communityToken.chainId, collectibleAndAmount.communityToken.address, %txData, password, walletAddresses, collectibleAndAmount.amount)
let transactionHash = response.result.getStr()
debug "Deployment transaction hash ", transactionHash=transactionHash
debug "Airdrop transaction hash ", transactionHash=transactionHash
let airdropDetails = AirdropDetails(
chainId: collectibleAndAmount.communityToken.chainId,

View File

@ -355,7 +355,11 @@ StatusSectionLayout {
mintPanel.isFeeLoading = true
}
function onDeploymentStateChanged(status, url) {
function onDeploymentStateChanged(communityId, status, url) {
if (root.community.id !== communityId) {
return
}
let title = ""
let loading = false
let type = Constants.ephemeralNotificationType.normal

View File

@ -66,7 +66,7 @@ QtObject {
}
signal deployFeeUpdated(var ethCurrency, var fiatCurrency, int error)
signal deploymentStateChanged(int status, string url)
signal deploymentStateChanged(string communityId, int status, string url)
signal selfDestructFeeUpdated(string value) // TO BE REMOVED
readonly property Connections connections: Connections {
@ -74,8 +74,8 @@ QtObject {
function onDeployFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
root.deployFeeUpdated(ethCurrency, fiatCurrency, errorCode)
}
function onDeploymentStateChanged(status, url) {
root.deploymentStateChanged(status, url)
function onDeploymentStateChanged(communityId, status, url) {
root.deploymentStateChanged(communityId, status, url)
}
}