From d389808a535234a9ba7fe993f970285915a2e520 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Tue, 5 Nov 2024 19:51:17 +0100 Subject: [PATCH] chore(@desktop/wallet): Chnage the send modal mechanism to follow new architecture guidelines. After this change there is not need to pass sendModal instance from AppMain to other parts of app. Then SendModal should be launched simply by calling Global.openSendModal(....) --- ui/app/AppLayouts/Chat/ChatLayout.qml | 4 - ui/app/AppLayouts/Chat/views/ChatView.qml | 2 - .../panels/MintTokensSettingsPanel.qml | 4 +- .../panels/OverviewSettingsPanel.qml | 12 +- .../popups/TransferOwnershipPopup.qml | 21 ++- .../views/CommunitySettingsView.qml | 3 - ui/app/AppLayouts/Profile/ProfileLayout.qml | 3 - ui/app/AppLayouts/Profile/views/EnsView.qml | 80 +++++----- .../AppLayouts/Profile/views/WalletView.qml | 3 - .../views/wallet/SavedAddressesView.qml | 2 - ui/app/AppLayouts/Wallet/WalletLayout.qml | 86 ++++++----- .../popups/SavedAddressActivityPopup.qml | 32 +++- .../Wallet/views/RightTabBaseView.qml | 2 - .../AppLayouts/Wallet/views/RightTabView.qml | 52 ++++--- .../Wallet/views/SavedAddresses.qml | 17 ++- .../Wallet/views/SavedAddressesView.qml | 1 - .../Wallet/views/TransactionDetailView.qml | 41 ++++-- ui/app/mainui/AppMain.qml | 139 +++++++----------- ui/app/mainui/Popups.qml | 4 +- ui/app/mainui/ToastsManager.qml | 5 +- ui/imports/shared/popups/send/SendModal.qml | 16 +- .../shared/status/StatusStickerMarket.qml | 26 ++-- .../status/StatusStickerPackClickPopup.qml | 26 ++-- .../shared/status/StatusStickersPopup.qml | 2 - ui/imports/shared/views/HistoryView.qml | 40 ++--- ui/imports/shared/views/chat/MessageView.qml | 16 +- .../profile/ProfileShowcaseAccountsView.qml | 18 ++- ui/imports/utils/Global.qml | 11 +- 28 files changed, 381 insertions(+), 287 deletions(-) diff --git a/ui/app/AppLayouts/Chat/ChatLayout.qml b/ui/app/AppLayouts/Chat/ChatLayout.qml index 42345f2a4a4..41e803eb8f5 100644 --- a/ui/app/AppLayouts/Chat/ChatLayout.qml +++ b/ui/app/AppLayouts/Chat/ChatLayout.qml @@ -44,8 +44,6 @@ StackLayout { allMembers: !!sectionItemModel ? sectionItemModel.allMembers : null } - property var sendModalPopup - readonly property bool isOwner: sectionItemModel.memberRole === Constants.memberRole.owner readonly property bool isAdmin: sectionItemModel.memberRole === Constants.memberRole.admin readonly property bool isTokenMasterOwner: sectionItemModel.memberRole === Constants.memberRole.tokenMaster @@ -164,7 +162,6 @@ StackLayout { communitiesStore: root.communitiesStore walletAssetsStore: root.walletAssetsStore currencyStore: root.currencyStore - sendModalPopup: root.sendModalPopup sectionItemModel: root.sectionItemModel joinedMembersCount: membersModelAdaptor.joinedMembers.ModelCount.count amIMember: sectionItem.amIMember @@ -257,7 +254,6 @@ StackLayout { enabledChainIds: WalletStore.RootStore.networkFilters onEnableNetwork: WalletStore.RootStore.enableNetwork(chainId) tokensStore: root.tokensStore - sendModalPopup: root.sendModalPopup transactionStore: root.transactionStore isPendingOwnershipRequest: root.isPendingOwnershipRequest diff --git a/ui/app/AppLayouts/Chat/views/ChatView.qml b/ui/app/AppLayouts/Chat/views/ChatView.qml index 82592982f0f..b49c2844f4a 100644 --- a/ui/app/AppLayouts/Chat/views/ChatView.qml +++ b/ui/app/AppLayouts/Chat/views/ChatView.qml @@ -48,7 +48,6 @@ StatusSectionLayout { property CommunitiesStores.CommunitiesStore communitiesStore required property WalletStore.WalletAssetsStore walletAssetsStore required property SharedStores.CurrenciesStore currencyStore - required property var sendModalPopup property var sectionItemModel property int joinedMembersCount @@ -325,7 +324,6 @@ StatusSectionLayout { id: statusStickerPackClickPopup StatusStickerPackClickPopup{ walletAssetsStore: root.walletAssetsStore - sendModalPopup: root.sendModalPopup onClosed: { destroy(); } diff --git a/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml b/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml index 5f322f5864a..a7a70d12a4d 100644 --- a/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml @@ -31,7 +31,6 @@ StackView { required property string communityName required property string communityLogo required property color communityColor - property var sendModalPopup // User profile props: required property bool isOwner @@ -786,8 +785,7 @@ StackView { onSendOwnershipClicked: Global.openTransferOwnershipPopup(root.communityId, root.communityName, root.communityLogo, - tokenViewPage.token, - root.sendModalPopup) + tokenViewPage.token) // helper properties to pass data through popups property var walletsAndAmounts diff --git a/ui/app/AppLayouts/Communities/panels/OverviewSettingsPanel.qml b/ui/app/AppLayouts/Communities/panels/OverviewSettingsPanel.qml index dbda4227de2..bcf6db55419 100644 --- a/ui/app/AppLayouts/Communities/panels/OverviewSettingsPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/OverviewSettingsPanel.qml @@ -40,7 +40,6 @@ StackLayout { property bool requestToJoinEnabled property bool pinMessagesEnabled property string previousPageName: (currentIndex === 1) ? qsTr("Overview") : "" - property var sendModalPopup property bool archiveSupporVisible: true property bool editable: false @@ -134,8 +133,15 @@ StackLayout { Global.openTransferOwnershipPopup(root.communityId, root.name, root.logoImageData, - root.ownerToken, - root.sendModalPopup) + { + key: "0", + privilegesLevel: root.ownerToken.privilegesLevel, + chainId: root.ownerToken.chainId, + name: root.ownerToken.name, + artworkSource: root.ownerToken.image, + accountAddress: root.ownerToken.accountAddress.toLowerCase(), + tokenAddress: root.ownerToken.tokenAddress.toLowerCase() + }) } else { Global.openPopup(transferOwnershipAlertPopup, { mode: TransferOwnershipAlertPopup.Mode.TransferOwnership }) } diff --git a/ui/app/AppLayouts/Communities/popups/TransferOwnershipPopup.qml b/ui/app/AppLayouts/Communities/popups/TransferOwnershipPopup.qml index ec5289ffd0b..63c3292ebac 100644 --- a/ui/app/AppLayouts/Communities/popups/TransferOwnershipPopup.qml +++ b/ui/app/AppLayouts/Communities/popups/TransferOwnershipPopup.qml @@ -12,6 +12,7 @@ import StatusQ.Core.Utils 0.1 import StatusQ.Components 0.1 import shared.popups 1.0 +import shared.popups.send 1.0 import AppLayouts.Wallet.stores 1.0 as WalletStores import utils 1.0 @@ -26,7 +27,6 @@ StatusDialog { // Transaction related props: property var token // Expected roles: accountAddress, key, chainId, name, artworkSource - property var sendModalPopup signal cancelClicked @@ -109,13 +109,22 @@ StatusDialog { onClicked: { // Pre-populated dialog with the relevant Owner token info: - root.sendModalPopup.preSelectedSendType = Constants.SendType.ERC721Transfer - root.sendModalPopup.preSelectedAccountAddress = token.accountAddress const store = WalletStores.RootStore.currentActivityFiltersStore const uid = store.collectiblesList.getUidForData(token.key, token.tokenAddress, token.chainId); - root.sendModalPopup.preSelectedHoldingID = uid - root.sendModalPopup.preSelectedHoldingType = Constants.TokenType.ERC721 - root.sendModalPopup.open() + Global.openSendModal(Constants.SendType.ERC721Transfer, //sendType + token.accountAddress, //senderAddress + uid, //tokenId + Constants.TokenType.ERC721, //tokenType + "", //tokenAmount + 0, //chainId + "", //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) close() } } diff --git a/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml b/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml index b977df8497d..4fa31682c9c 100644 --- a/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml +++ b/ui/app/AppLayouts/Communities/views/CommunitySettingsView.qml @@ -46,7 +46,6 @@ StatusSectionLayout { required property var declinedMembers required property TransactionStore transactionStore property bool communitySettingsDisabled - property var sendModalPopup required property string enabledChainIds @@ -221,7 +220,6 @@ StatusSectionLayout { pubsubTopic: root.community.pubsubTopic pubsubTopicKey: root.community.pubsubTopicKey - sendModalPopup: root.sendModalPopup ownerToken: tokensModelChangesTracker.ownerToken isPendingOwnershipRequest: root.isPendingOwnershipRequest @@ -380,7 +378,6 @@ StatusSectionLayout { communityName: root.community.name communityLogo: root.community.image communityColor: root.community.color - sendModalPopup: root.sendModalPopup // User profile props isOwner: root.isOwner diff --git a/ui/app/AppLayouts/Profile/ProfileLayout.qml b/ui/app/AppLayouts/Profile/ProfileLayout.qml index ea057716f79..3e4a8645d17 100644 --- a/ui/app/AppLayouts/Profile/ProfileLayout.qml +++ b/ui/app/AppLayouts/Profile/ProfileLayout.qml @@ -45,7 +45,6 @@ StatusSectionLayout { property ProfileStores.ProfileSectionStore store property AppLayoutsStores.RootStore globalStore property CommunitiesStore.CommunitiesStore communitiesStore - required property var sendModalPopup property var systemPalette property var emojiPopup property SharedStores.NetworkConnectionStore networkConnectionStore @@ -249,7 +248,6 @@ StatusSectionLayout { implicitHeight: parent.height ensUsernamesStore: root.store.ensUsernamesStore walletAssetsStore: root.walletAssetsStore - sendModalPopup: root.sendModalPopup contactsStore: root.store.contactsStore networkConnectionStore: root.networkConnectionStore profileContentWidth: d.contentWidth @@ -289,7 +287,6 @@ StatusSectionLayout { myPublicKey: root.store.contactsStore.myPublicKey currencySymbol: root.sharedRootStore.currencyStore.currentCurrency emojiPopup: root.emojiPopup - sendModalPopup: root.sendModalPopup sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.wallet) } onLoaded: root.store.backButtonName = "" diff --git a/ui/app/AppLayouts/Profile/views/EnsView.qml b/ui/app/AppLayouts/Profile/views/EnsView.qml index 285716f3d7f..09677387d64 100644 --- a/ui/app/AppLayouts/Profile/views/EnsView.qml +++ b/ui/app/AppLayouts/Profile/views/EnsView.qml @@ -24,8 +24,6 @@ Item { property EnsUsernamesStore ensUsernamesStore property WalletAssetsStore walletAssetsStore - required property var sendModalPopup - property ContactsStore contactsStore property SharedStores.NetworkConnectionStore networkConnectionStore @@ -262,18 +260,20 @@ Item { onConnectUsername: { ensView.selectedUsername = username - ensView.sendModalPopup.modalHeaderText = qsTr("Connect username with your pubkey") - ensView.sendModalPopup.interactive = false - ensView.sendModalPopup.preSelectedRecipient = ensView.ensUsernamesStore.getEnsRegisteredAddress() - ensView.sendModalPopup.preSelectedRecipientType = Helpers.RecipientAddressObjectType.Address - ensView.sendModalPopup.preSelectedHoldingID = Constants.ethToken - ensView.sendModalPopup.preSelectedHoldingType = Constants.TokenType.ERC20 - ensView.sendModalPopup.preSelectedSendType = Constants.SendType.ENSSetPubKey - ensView.sendModalPopup.preDefinedAmountToSend = LocaleUtils.numberToLocaleString(0) - ensView.sendModalPopup.preSelectedChainId = ensView.selectedChainId - ensView.sendModalPopup.publicKey = ensView.contactsStore.myPublicKey - ensView.sendModalPopup.ensName = ensView.selectedUsername - ensView.sendModalPopup.open() + Global.openSendModal(Constants.SendType.ENSSetPubKey, //sendType + "", //senderAddress + Constants.ethToken, //tokenId + Constants.TokenType.ERC20, //tokenType + LocaleUtils.numberToLocaleString(0), //tokenAmount + ensView.selectedChainId, //chainId + ensView.ensUsernamesStore.getEnsRegisteredAddress(), //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + false, //interactive + ensView.contactsStore.myPublicKey, //publicKey + ensView.selectedUsername, //ensName + "", //stickersPackId + ) } Connections { @@ -297,17 +297,20 @@ Item { onBackBtnClicked: back(); onRegisterUsername: { - ensView.sendModalPopup.interactive = false - ensView.sendModalPopup.preSelectedRecipient = ensView.ensUsernamesStore.getEnsRegisteredAddress() - ensView.sendModalPopup.preSelectedRecipientType = Helpers.RecipientAddressObjectType.Address - ensView.sendModalPopup.preSelectedHoldingID = !!d.sntToken && !!d.sntToken.symbol ? d.sntToken.symbol: "" - ensView.sendModalPopup.preSelectedHoldingType = Constants.TokenType.ERC20 - ensView.sendModalPopup.preSelectedSendType = Constants.SendType.ENSRegister - ensView.sendModalPopup.preDefinedAmountToSend = LocaleUtils.numberToLocaleString(10) - ensView.sendModalPopup.preSelectedChainId = ensView.selectedChainId - ensView.sendModalPopup.publicKey = ensView.contactsStore.myPublicKey - ensView.sendModalPopup.ensName = ensView.selectedUsername - ensView.sendModalPopup.open() + Global.openSendModal(Constants.SendType.ENSRegister, //sendType + "", //senderAddress + !!d.sntToken && !!d.sntToken.symbol ? d.sntToken.symbol: "", //tokenId + Constants.TokenType.ERC20, //tokenType + LocaleUtils.numberToLocaleString(10), //tokenAmount + ensView.selectedChainId, //chainId + ensView.ensUsernamesStore.getEnsRegisteredAddress(), //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + false, //interactive + ensView.contactsStore.myPublicKey, //publicKey + ensView.selectedUsername, //ensName + "", //stickersPackId + ) } Connections { @@ -385,19 +388,20 @@ Item { return } - ensView.sendModalPopup.modalHeaderText = qsTr("Release your username") - ensView.sendModalPopup.interactive = false - ensView.sendModalPopup.preSelectedAccountAddress = senderAddress - ensView.sendModalPopup.preSelectedRecipient = ensView.ensUsernamesStore.getEnsRegisteredAddress() - ensView.sendModalPopup.preSelectedRecipientType = Helpers.RecipientAddressObjectType.Address - ensView.sendModalPopup.preSelectedHoldingID = Constants.ethToken - ensView.sendModalPopup.preSelectedHoldingType = Constants.TokenType.Native - ensView.sendModalPopup.preSelectedSendType = Constants.SendType.ENSRelease - ensView.sendModalPopup.preDefinedAmountToSend = LocaleUtils.numberToLocaleString(0) - ensView.sendModalPopup.preSelectedChainId = ensView.selectedChainId - ensView.sendModalPopup.publicKey = ensView.contactsStore.myPublicKey - ensView.sendModalPopup.ensName = ensView.selectedUsername - ensView.sendModalPopup.open() + Global.openSendModal(Constants.SendType.ENSRelease, //sendType + senderAddress, //senderAddress + Constants.ethToken, //tokenId + Constants.TokenType.Native, //tokenType + LocaleUtils.numberToLocaleString(0), //tokenAmount + ensView.selectedChainId, //chainId + ensView.ensUsernamesStore.getEnsRegisteredAddress(), //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + false, //interactive + ensView.contactsStore.myPublicKey, //publicKey + ensView.selectedUsername, //ensName + "", //stickersPackId + ) } Connections { diff --git a/ui/app/AppLayouts/Profile/views/WalletView.qml b/ui/app/AppLayouts/Profile/views/WalletView.qml index bc55d946959..7bc1fb0862d 100644 --- a/ui/app/AppLayouts/Profile/views/WalletView.qml +++ b/ui/app/AppLayouts/Profile/views/WalletView.qml @@ -44,8 +44,6 @@ SettingsContentBase { required property WalletAssetsStore assetsStore required property CollectiblesStore collectiblesStore - required property var sendModalPopup - readonly property int mainViewIndex: 0 readonly property int networksViewIndex: 1 readonly property int editNetworksViewIndex: 2 @@ -372,7 +370,6 @@ SettingsContentBase { id: savedAddressesView contactsStore: root.rootStore.contactsStore networkConnectionStore: root.networkConnectionStore - sendModal: root.sendModalPopup } Component { diff --git a/ui/app/AppLayouts/Profile/views/wallet/SavedAddressesView.qml b/ui/app/AppLayouts/Profile/views/wallet/SavedAddressesView.qml index 624eadff313..aa37a274e0b 100644 --- a/ui/app/AppLayouts/Profile/views/wallet/SavedAddressesView.qml +++ b/ui/app/AppLayouts/Profile/views/wallet/SavedAddressesView.qml @@ -12,10 +12,8 @@ ColumnLayout { property ContactsStore contactsStore property SharedStores.NetworkConnectionStore networkConnectionStore - property var sendModal SavedAddresses { - sendModal: root.sendModal contactsStore: root.contactsStore networkConnectionStore: root.networkConnectionStore } diff --git a/ui/app/AppLayouts/Wallet/WalletLayout.qml b/ui/app/AppLayouts/Wallet/WalletLayout.qml index d547d8a5258..81d503fe543 100644 --- a/ui/app/AppLayouts/Wallet/WalletLayout.qml +++ b/ui/app/AppLayouts/Wallet/WalletLayout.qml @@ -12,6 +12,7 @@ import shared.popups.keypairimport 1.0 import shared.stores 1.0 as SharedStores import shared.stores.send 1.0 +import shared.popups.send 1.0 import AppLayouts.stores 1.0 as AppLayoutsStores import AppLayouts.Communities.stores 1.0 @@ -37,7 +38,6 @@ Item { required property TransactionStore transactionStore property var emojiPopup: null - property var sendModalPopup property SharedStores.NetworkConnectionStore networkConnectionStore property bool appMainVisible @@ -208,7 +208,6 @@ Item { store: root.store contactsStore: root.contactsStore networkConnectionStore: root.networkConnectionStore - sendModal: root.sendModalPopup networkFilter.visible: false headerButton.text: qsTr("Add new address") @@ -225,7 +224,6 @@ Item { store: root.store contactsStore: root.contactsStore communitiesStore: root.communitiesStore - sendModal: root.sendModalPopup networkConnectionStore: root.networkConnectionStore dappsEnabled: root.dappsEnabled @@ -328,40 +326,56 @@ Item { hasFloatingButtons: true }) onLaunchSendModal: (fromAddress) => { - if(isCommunityOwnershipTransfer) { - const tokenItem = walletStore.currentViewedCollectible - const ownership = StatusQUtils.ModelUtils.get(tokenItem.ownership, 0) - - Global.openTransferOwnershipPopup(tokenItem.communityId, - footer.communityName, - tokenItem.communityImage, - { - key: tokenItem.tokenId, - privilegesLevel: tokenItem.communityPrivilegesLevel, - chainId: tokenItem.chainId, - name: tokenItem.name, - artworkSource: tokenItem.artworkSource, - accountAddress: fromAddress, - tokenAddress: tokenItem.contractAddress - }, - root.sendModalPopup) - return - } - - // Common send modal popup: - root.sendModalPopup.preSelectedAccountAddress = fromAddress - root.sendModalPopup.preSelectedSendType = Constants.SendType.Transfer - root.sendModalPopup.preSelectedHoldingID = walletStore.currentViewedHoldingTokensKey - root.sendModalPopup.preSelectedHoldingType = walletStore.currentViewedHoldingType - root.sendModalPopup.onlyAssets = false - root.sendModalPopup.open() - } + if(isCommunityOwnershipTransfer) { + const tokenItem = walletStore.currentViewedCollectible + const ownership = StatusQUtils.ModelUtils.get(tokenItem.ownership, 0) + + Global.openTransferOwnershipPopup(tokenItem.communityId, + footer.communityName, + tokenItem.communityImage, + { + key: tokenItem.tokenId, + privilegesLevel: tokenItem.communityPrivilegesLevel, + chainId: tokenItem.chainId, + name: tokenItem.name, + artworkSource: tokenItem.artworkSource, + accountAddress: fromAddress, + tokenAddress: tokenItem.contractAddress + }) + return + } + + // Common send modal popup: + Global.openSendModal(Constants.SendType.Transfer, //sendType + fromAddress, //senderAddress + walletStore.currentViewedHoldingTokensKey, //tokenId + walletStore.currentViewedHoldingType, //tokenType + "", //tokenAmount + 0, //chainId + "", //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) + } onLaunchBridgeModal: { - root.sendModalPopup.preSelectedSendType = Constants.SendType.Bridge - root.sendModalPopup.preSelectedHoldingID = walletStore.currentViewedHoldingID - root.sendModalPopup.preSelectedHoldingType = walletStore.currentViewedHoldingType - root.sendModalPopup.onlyAssets = true - root.sendModalPopup.open() + Global.openSendModal(Constants.SendType.Bridge, //sendType + "", //senderAddress + walletStore.currentViewedHoldingID, //tokenId + walletStore.currentViewedHoldingType, //tokenType + "", //tokenAmount + 0, //chainId + "", //recipientAddress + "", //recipientType + true, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) } onLaunchSwapModal: { d.swapFormData.fromTokensKey = "" diff --git a/ui/app/AppLayouts/Wallet/popups/SavedAddressActivityPopup.qml b/ui/app/AppLayouts/Wallet/popups/SavedAddressActivityPopup.qml index bfd07a7e07f..80ed1031c6d 100644 --- a/ui/app/AppLayouts/Wallet/popups/SavedAddressActivityPopup.qml +++ b/ui/app/AppLayouts/Wallet/popups/SavedAddressActivityPopup.qml @@ -14,6 +14,7 @@ import AppLayouts.Wallet.stores 1.0 as WalletStore import utils 1.0 import shared.views 1.0 +import shared.popups.send 1.0 import shared.stores 1.0 as SharedStores import "../controls" @@ -24,7 +25,6 @@ StatusModal { property SharedStores.NetworkConnectionStore networkConnectionStore property ProfileStores.ContactsStore contactsStore - property var sendModalPopup closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside hasCloseButton: false @@ -163,7 +163,20 @@ StatusModal { } onOpenSendModal: { root.close() - root.sendModalPopup.open(recipient) + Global.openSendModal(Constants.SendType.Transfer, //sendType + "", //senderAddress + "", //tokenId + Constants.TokenType.Unknown, //tokenType + "", //tokenAmount + 0, //chainId + recipient, //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) } } @@ -241,7 +254,20 @@ StatusModal { enabled: root.networkConnectionStore.sendBuyBridgeEnabled onClicked: { root.close() - root.sendModalPopup.open(d.visibleAddress) + Global.openSendModal(Constants.SendType.Transfer, //sendType + "", //senderAddress + "", //tokenId + Constants.TokenType.Unknown, //tokenType + "", //tokenAmount + 0, //chainId + d.visibleAddress, //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) } } diff --git a/ui/app/AppLayouts/Wallet/views/RightTabBaseView.qml b/ui/app/AppLayouts/Wallet/views/RightTabBaseView.qml index 01f4882e89b..63c41df1650 100644 --- a/ui/app/AppLayouts/Wallet/views/RightTabBaseView.qml +++ b/ui/app/AppLayouts/Wallet/views/RightTabBaseView.qml @@ -22,8 +22,6 @@ FocusScope { property bool dappsEnabled property bool swapEnabled - property var sendModal - property alias header: header property alias headerButton: header.headerButton property alias networkFilter: header.networkFilter diff --git a/ui/app/AppLayouts/Wallet/views/RightTabView.qml b/ui/app/AppLayouts/Wallet/views/RightTabView.qml index afa80232f6c..9b74499a50b 100644 --- a/ui/app/AppLayouts/Wallet/views/RightTabView.qml +++ b/ui/app/AppLayouts/Wallet/views/RightTabView.qml @@ -15,6 +15,7 @@ import shared.controls 1.0 import shared.views 1.0 import shared.stores 1.0 as SharedStores import shared.panels 1.0 +import shared.popups.send 1.0 import "./" import "../stores" @@ -274,13 +275,20 @@ RightTabBaseView { swapVisible: root.swapEnabled onSendRequested: { - const modal = root.sendModal - - modal.preSelectedSendType = Constants.SendType.Transfer - modal.preSelectedHoldingID = key - modal.preSelectedHoldingType = Constants.TokenType.ERC20 - modal.onlyAssets = true - modal.open() + Global.openSendModal(Constants.SendType.Transfer, //sendType + "", //senderAddress + key, //tokenId + Constants.TokenType.ERC20, //tokenType + "", //tokenAmount + 0, //chainId + "", //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + true, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) } onSwapRequested: root.launchSwapModal(key) @@ -398,19 +406,27 @@ RightTabBaseView { artworkSource: collectible.communityImage, accountAddress: fromAddress, tokenAddress: collectible.contractAddress - }, - root.sendModal) + }) return } - root.sendModal.preSelectedAccountAddress = fromAddress - root.sendModal.preSelectedHoldingID = symbol - root.sendModal.preSelectedHoldingType = tokenType - root.sendModal.preSelectedSendType = tokenType === Constants.TokenType.ERC721 ? - Constants.SendType.ERC721Transfer: - Constants.SendType.ERC1155Transfer - root.sendModal.onlyAssets = false - root.sendModal.open() + let sendType = tokenType === Constants.TokenType.ERC721 ? + Constants.SendType.ERC721Transfer: + Constants.SendType.ERC1155Transfer + Global.openSendModal(sendType, //sendType + fromAddress, //senderAddress + symbol, //tokenId + tokenType, //tokenType + "", //tokenAmount + 0, //chainId + "", //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) } onReceiveRequested: (symbol) => root.launchShareAddressModal() onSwitchToCommunityRequested: (communityId) => Global.switchToCommunity(communityId) @@ -429,7 +445,6 @@ RightTabBaseView { communitiesStore: root.communitiesStore currencyStore: root.sharedRootStore.currencyStore showAllAccounts: RootStore.showAllAccounts - sendModal: root.sendModal filterVisible: filterButton.checked onLaunchTransactionDetail: function (txID) { RootStore.activityController.fetchTxDetails(txID) @@ -505,7 +520,6 @@ RightTabBaseView { } showAllAccounts: RootStore.showAllAccounts communitiesStore: root.communitiesStore - sendModal: root.sendModal rootStore: root.sharedRootStore currenciesStore: root.sharedRootStore.currencyStore contactsStore: root.contactsStore diff --git a/ui/app/AppLayouts/Wallet/views/SavedAddresses.qml b/ui/app/AppLayouts/Wallet/views/SavedAddresses.qml index 75dc66fd20f..e93ed678245 100644 --- a/ui/app/AppLayouts/Wallet/views/SavedAddresses.qml +++ b/ui/app/AppLayouts/Wallet/views/SavedAddresses.qml @@ -12,6 +12,7 @@ import SortFilterProxyModel 0.2 import utils 1.0 import shared.controls 1.0 import shared.stores 1.0 as SharedStores +import shared.popups.send 1.0 import AppLayouts.Profile.stores 1.0 as ProfileStores import "../stores" @@ -20,7 +21,6 @@ import "../controls" ColumnLayout { id: root - property var sendModal property ProfileStores.ContactsStore contactsStore property SharedStores.NetworkConnectionStore networkConnectionStore @@ -149,7 +149,20 @@ ColumnLayout { colorId: model.colorId networkConnectionStore: root.networkConnectionStore areTestNetworksEnabled: RootStore.areTestNetworksEnabled - onOpenSendModal: root.sendModal.open(recipient); + onOpenSendModal: Global.openSendModal(Constants.SendType.Transfer, //sendType + "", //senderAddress + "", //tokenId + Constants.TokenType.Unknown, //tokenType + "", //tokenAmount + 0, //chainId + recipient, //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) states: [ State { diff --git a/ui/app/AppLayouts/Wallet/views/SavedAddressesView.qml b/ui/app/AppLayouts/Wallet/views/SavedAddressesView.qml index e55a5c16f1b..3a5028bf3af 100644 --- a/ui/app/AppLayouts/Wallet/views/SavedAddressesView.qml +++ b/ui/app/AppLayouts/Wallet/views/SavedAddressesView.qml @@ -8,7 +8,6 @@ RightTabBaseView { width: root.width height: root.height - header.height - sendModal: root.sendModal contactsStore: root.contactsStore networkConnectionStore: root.networkConnectionStore } diff --git a/ui/app/AppLayouts/Wallet/views/TransactionDetailView.qml b/ui/app/AppLayouts/Wallet/views/TransactionDetailView.qml index 6f03a70ea67..f8851d43412 100644 --- a/ui/app/AppLayouts/Wallet/views/TransactionDetailView.qml +++ b/ui/app/AppLayouts/Wallet/views/TransactionDetailView.qml @@ -36,7 +36,6 @@ Item { property CommunitiesStore communitiesStore property NetworkConnectionStore networkConnectionStore property var controller - property var sendModal property bool showAllAccounts: false readonly property alias transaction: d.transaction @@ -787,17 +786,20 @@ Item { tx.isNFT, tx.amount, tx.chainId) - - root.sendModal.preSelectedAccountAddress = req.preSelectedAccount.address - root.sendModal.preSelectedRecipient = req.preSelectedRecipient - root.sendModal.preSelectedRecipientType = req.preSelectedRecipientType - root.sendModal.preSelectedHoldingID = req.preSelectedHoldingID - root.sendModal.preSelectedHoldingType = req.preSelectedHoldingType - root.sendModal.preSelectedSendType = req.preSelectedSendType - root.sendModal.preDefinedAmountToSend = req.preDefinedAmountToSend - root.sendModal.preSelectedChainId = req.preSelectedChainId - root.sendModal.onlyAssets = false - root.sendModal.open() + Global.openSendModal(req.preSelectedSendType, //sendType + req.preSelectedAccount.address, //senderAddress + req.preSelectedHoldingID, //tokenId + req.preSelectedHoldingType, //tokenType + req.preDefinedAmountToSend, //tokenAmount + req.preSelectedChainId, //chainId + req.preSelectedRecipient, //recipientAddress + req.preSelectedRecipientType, //recipientType + false, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) } } StatusButton { @@ -820,7 +822,20 @@ Item { areTestNetworksEnabled: WalletStores.RootStore.areTestNetworksEnabled contactsStore: root.contactsStore networkConnectionStore: root.networkConnectionStore - onOpenSendModal: (address) => root.sendModal.open(address) + onOpenSendModal: (address) => Global.openSendModal(Constants.SendType.Transfer, //sendType + "", //senderAddress + "", //tokenId + Constants.TokenType.Unknown, //tokenType + "", //tokenAmount + 0, //chainId + address, //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) } component DetailsPanel: Item { diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index ff0be0d8767..ff3809ff320 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -112,8 +112,6 @@ Item { rootChatStore: appMain.rootChatStore communityTokensStore: appMain.communityTokensStore profileStore: appMain.profileStore - - sendModalPopup: sendModal } Connections { @@ -511,8 +509,30 @@ Item { } } - function onOpenSendModal(address: string) { - sendModal.open(address) + function onOpenSendModal(sendType: int, senderAddress: string, + tokenId: string, tokenType: int, + tokenAmount: string, chainId: int, + recipientAddress: string, recipientType: int, + onlyAssets: bool, interactive: bool, + publicKey: string, ensName: string, + stickersPackId: string) { + if (sendType === undefined) sendType = Constants.SendType.Transfer + if (senderAddress === undefined) senderAddress = "" + if (tokenId === undefined) tokenId = "" + if (tokenType === undefined) tokenType = Constants.TokenType.Unknown + if (tokenAmount === undefined) tokenAmount = "" + if (chainId === undefined) chainId = 0 + if (recipientAddress === undefined) recipientAddress = "" + if (recipientType === undefined) recipientType = SendPopups.Helpers.RecipientAddressObjectType.Address + if (onlyAssets === undefined) onlyAssets = false + if (interactive === undefined) interactive = true + if (publicKey === undefined) publicKey = "" + if (ensName === undefined) ensName = "" + if (stickersPackId === undefined) stickersPackId = "" + + sendModal.open(sendType, senderAddress, tokenId, tokenType, tokenAmount, chainId, + recipientAddress, recipientType, onlyAssets, interactive, + publicKey, ensName, stickersPackId) } function onSwitchToCommunity(communityId: string) { @@ -657,8 +677,6 @@ Item { sourceComponent: StatusStickersPopup { store: appMain.rootChatStore walletAssetsStore: appMain.walletAssetsStore - sendModalPopup: sendModal - isWalletEnabled: appMain.profileStore.isWalletEnabled } } @@ -1427,7 +1445,6 @@ Item { communitiesStore: appMain.communitiesStore transactionStore: appMain.transactionStore emojiPopup: statusEmojiPopup.item - sendModalPopup: sendModal networkConnectionStore: appMain.networkConnectionStore appMainVisible: appMain.visible dappsEnabled: featureFlagsStore.dappsEnabled @@ -1452,7 +1469,6 @@ Item { store: appMain.rootStore.profileSectionStore globalStore: appMain.rootStore communitiesStore: appMain.communitiesStore - sendModalPopup: sendModal systemPalette: appMain.sysPalette emojiPopup: statusEmojiPopup.item networkConnectionStore: appMain.networkConnectionStore @@ -1530,7 +1546,6 @@ Item { } } - sendModalPopup: sendModal emojiPopup: statusEmojiPopup.item stickersPopup: statusStickersPopupLoader.item sectionItemModel: model @@ -1630,13 +1645,35 @@ Item { id: sendModal active: false - function open(address = "") { - if (!!address) { - preSelectedRecipient = address - preSelectedRecipientType = SendPopups.Helpers.RecipientAddressObjectType.Address - } + function open(sendType = Constants.SendType.Transfer, + senderAddress = "", + tokenId = "", + tokenType = Constants.TokenType.Unknown, + tokenAmount = "", + chainId = 0, + recipientAddress = "", + recipientType = SendPopups.Helpers.RecipientAddressObjectType.Address, + onlyAssets = false, + interactive = true, + publicKey = "", ensName = "", + stickersPackId = "") { this.active = true - this.item.open() + if (!!this.item) { + if (!!sendType) this.item.preSelectedSendType = sendType + if (!!senderAddress) this.item.preSelectedAccountAddress = senderAddress + if (!!tokenId) this.item.preSelectedHoldingID = tokenId + this.item.preSelectedHoldingType = tokenType + if (!!tokenAmount) this.item.preDefinedAmountToSend = tokenAmount + if (chainId !== 0) this.item.preSelectedChainId = chainId + if (!!recipientAddress) this.item.preSelectedRecipient = recipientAddress + this.item.preSelectedRecipientType = recipientType + this.item.onlyAssets = onlyAssets + this.item.interactive = interactive + this.item.publicKey = publicKey + this.item.ensName = ensName + this.item.stickersPackId = stickersPackId + this.item.open() + } } function closed() { @@ -1644,26 +1681,7 @@ Item { this.active = false } - property string modalHeaderText - property bool interactive: true - property string preSelectedAccountAddress - property var preSelectedRecipient - property int preSelectedRecipientType - property string preSelectedHoldingID - property int preSelectedHoldingType: Constants.TokenType.Unknown - property int preSelectedSendType: Constants.SendType.Unknown - property string preDefinedAmountToSend - property int preSelectedChainId: 0 - property bool onlyAssets: false - - property string stickersPackId: "" - property string publicKey: "" - property string ensName: "" - - sourceComponent: SendPopups.SendModal { - interactive: sendModal.interactive - onlyAssets: sendModal.onlyAssets - + sourceComponent: SendPopups.SendModal { loginType: appMain.rootStore.loginType store: appMain.transactionStore @@ -1671,55 +1689,7 @@ Item { showCustomRoutingMode: !production - onClosed: { - sendModal.closed() - sendModal.modalHeaderText = "" - sendModal.interactive = true - sendModal.preSelectedSendType = Constants.SendType.Unknown - sendModal.preSelectedHoldingID = "" - sendModal.preSelectedHoldingType = Constants.TokenType.Unknown - sendModal.preSelectedAccountAddress = "" - sendModal.preSelectedRecipient = undefined - sendModal.preDefinedAmountToSend = "" - sendModal.preSelectedChainId = 0 - - sendModal.stickersPackId = "" - sendModal.publicKey = "" - sendModal.ensName = "" - } - } - onLoaded: { - if (!!sendModal.preSelectedAccountAddress) { - item.preSelectedAccountAddress = sendModal.preSelectedAccountAddress - } - if (!!sendModal.preSelectedRecipient) { - // NOTE Should be assigned in that order: type then recipient - item.preSelectedRecipientType = sendModal.preSelectedRecipientType - item.preSelectedRecipient = sendModal.preSelectedRecipient - } - if (sendModal.preSelectedSendType !== Constants.SendType.Unknown) { - item.preSelectedSendType = sendModal.preSelectedSendType - } - if (sendModal.preSelectedHoldingType !== Constants.TokenType.Unknown) { - item.preSelectedHoldingID = sendModal.preSelectedHoldingID - item.preSelectedHoldingType = sendModal.preSelectedHoldingType - } - if (sendModal.preDefinedAmountToSend != "") { - item.preDefinedAmountToSend = sendModal.preDefinedAmountToSend - } - if (!!sendModal.preSelectedChainId) { - item.preSelectedChainId = sendModal.preSelectedChainId - } - - if (!!sendModal.stickersPackId) { - item.stickersPackId = sendModal.stickersPackId - } - if (!!sendModal.publicKey) { - item.publicKey = sendModal.publicKey - } - if (!!sendModal.ensName) { - item.ensName = sendModal.ensName - } + onClosed: sendModal.closed() } } @@ -2152,7 +2122,6 @@ Item { sourceComponent: WalletPopups.SavedAddressActivityPopup { networkConnectionStore: appMain.networkConnectionStore contactsStore: appMain.rootStore.contactStore - sendModalPopup: sendModal onClosed: { savedAddressActivity.close() diff --git a/ui/app/mainui/Popups.qml b/ui/app/mainui/Popups.qml index d0a2cb14bf9..1c68f644d02 100644 --- a/ui/app/mainui/Popups.qml +++ b/ui/app/mainui/Popups.qml @@ -314,8 +314,8 @@ QtObject { openPopup(importControlNodePopup, { community }) } - function openTransferOwnershipPopup(communityId, communityName, communityLogo, token, sendModalPopup) { - openPopup(transferOwnershipPopup, { communityId, communityName, communityLogo, token, sendModalPopup }) + function openTransferOwnershipPopup(communityId, communityName, communityLogo, token) { + openPopup(transferOwnershipPopup, { communityId, communityName, communityLogo, token }) } function openConfirmExternalLinkPopup(link, domain) { diff --git a/ui/app/mainui/ToastsManager.qml b/ui/app/mainui/ToastsManager.qml index 063ad2f240e..f45ca385b75 100644 --- a/ui/app/mainui/ToastsManager.qml +++ b/ui/app/mainui/ToastsManager.qml @@ -34,9 +34,6 @@ QtObject { required property SharedStores.CommunityTokensStore communityTokensStore required property ProfileStore profileStore - // Properties: - required property var sendModalPopup - // Utils: readonly property string viewOptimismExplorerText: qsTr("View on Optimism Explorer") readonly property string checkmarkCircleAssetName: "checkmark-circle" @@ -241,7 +238,7 @@ QtObject { Global.openFinaliseOwnershipPopup(actionData) return case ToastsManager.ActionType.OpenSendModalPopup: - root.sendModalPopup.open() + Global.openSendModal() return case ToastsManager.ActionType.ViewTransactionDetails: if(actionData) { diff --git a/ui/imports/shared/popups/send/SendModal.qml b/ui/imports/shared/popups/send/SendModal.qml index ffb8ce77c9c..e3bb9d40630 100644 --- a/ui/imports/shared/popups/send/SendModal.qml +++ b/ui/imports/shared/popups/send/SendModal.qml @@ -183,6 +183,20 @@ StatusDialog { d.routerErrorDetails = "" debounceRecalculateRoutesAndFees() } + + function getTitleText() { + switch (store.sendType) { + case Constants.SendType.Bridge: + return qsTr("Bridge") + case Constants.SendType.ENSRegister: + return qsTr("Register Ens") + case Constants.SendType.ENSSetPubKey: + return qsTr("Connect username with your pubkey") + case Constants.SendType.ENSRelease: + return qsTr("Release your username") + default: return qsTr("Send") + } + } } LeftJoinModel { @@ -372,7 +386,7 @@ StatusDialog { objectName: "modalHeader" Layout.maximumWidth: contentWidth Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft - text: d.isBridgeTx ? qsTr("Bridge") : qsTr("Send") + text: d.getTitleText() } TokenSelector { diff --git a/ui/imports/shared/status/StatusStickerMarket.qml b/ui/imports/shared/status/StatusStickerMarket.qml index 7d2f9323873..49d07f9190f 100644 --- a/ui/imports/shared/status/StatusStickerMarket.qml +++ b/ui/imports/shared/status/StatusStickerMarket.qml @@ -27,7 +27,6 @@ Item { property ChatStores.RootStore store property var stickerPacks: ChatStores.StickerPackData {} required property WalletAssetsStore walletAssetsStore - required property var sendModalPopup property string packId property bool marketVisible property bool isWalletEnabled @@ -45,17 +44,20 @@ Item { function runSendModal(price, packId) { const token = ModelUtils.getByKey(root.walletAssetsStore.groupedAccountAssetsModel, "tokensKey", root.store.stickersStore.getStatusTokenKey()) - - root.sendModalPopup.interactive = false - root.sendModalPopup.preSelectedRecipient = root.store.stickersStore.getStickersMarketAddress() - root.sendModalPopup.preSelectedRecipientType = Helpers.RecipientAddressObjectType.Address - root.sendModalPopup.preSelectedHoldingID = !!token && !!token.symbol ? token.symbol : "" - root.sendModalPopup.preSelectedHoldingType = Constants.TokenType.ERC20 - root.sendModalPopup.preSelectedSendType = Constants.SendType.StickersBuy - root.sendModalPopup.preDefinedAmountToSend = LocaleUtils.numberToLocaleString(parseFloat(price)) - root.sendModalPopup.preSelectedChainId = root.store.appNetworkId - root.sendModalPopup.stickersPackId = packId - root.sendModalPopup.open() + Global.openSendModal(Constants.SendType.StickersBuy, //sendType + "", //senderAddress + !!token && !!token.symbol ? token.symbol : "", //tokenId + Constants.TokenType.ERC20, //tokenType + LocaleUtils.numberToLocaleString(parseFloat(price)), //tokenAmount + root.store.appNetworkId, //chainId + root.store.stickersStore.getStickersMarketAddress(), //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + false, //interactive + "", //publicKey + "", //ensName + packId, //stickersPackId + ) } } diff --git a/ui/imports/shared/status/StatusStickerPackClickPopup.qml b/ui/imports/shared/status/StatusStickerPackClickPopup.qml index ea9c77849e5..b5ddfe5be0a 100644 --- a/ui/imports/shared/status/StatusStickerPackClickPopup.qml +++ b/ui/imports/shared/status/StatusStickerPackClickPopup.qml @@ -26,7 +26,6 @@ ModalPopup { property ChatStores.RootStore store required property WalletAssetsStore walletAssetsStore - required property var sendModalPopup property string thumbnail: "" property string name: "" property string author: "" @@ -95,17 +94,20 @@ ModalPopup { onUpdateClicked: function(){} onBuyClicked: { const token = SQUtils.ModelUtils.getByKey(stickerPackDetailsPopup.walletAssetsStore.groupedAccountAssetsModel, "tokensKey", stickerPackDetailsPopup.store.stickersStore.getStatusTokenKey()) - - stickerPackDetailsPopup.sendModalPopup.interactive = false - stickerPackDetailsPopup.sendModalPopup.preSelectedRecipient = stickerPackDetailsPopup.store.stickersStore.getStickersMarketAddress() - stickerPackDetailsPopup.sendModalPopup.preSelectedRecipientType = Helpers.RecipientAddressObjectType.Address - stickerPackDetailsPopup.sendModalPopup.preSelectedHoldingID = !!token && !!token.symbol ? token.symbol : "" - stickerPackDetailsPopup.sendModalPopup.preSelectedHoldingType = Constants.TokenType.ERC20 - stickerPackDetailsPopup.sendModalPopup.preSelectedSendType = Constants.SendType.StickersBuy - stickerPackDetailsPopup.sendModalPopup.preDefinedAmountToSend = LocaleUtils.numberToLocaleString(parseFloat(stickerPackDetailsPopup.price)) - stickerPackDetailsPopup.sendModalPopup.preSelectedChainId = stickerPackDetailsPopup.store.appNetworkId - stickerPackDetailsPopup.sendModalPopup.stickersPackId = stickerPackDetailsPopup.packId - stickerPackDetailsPopup.sendModalPopup.open() + Global.openSendModal(Constants.SendType.StickersBuy, //sendType + "", //senderAddress + !!token && !!token.symbol ? token.symbol : "", //tokenId + Constants.TokenType.ERC20, //tokenType + LocaleUtils.numberToLocaleString(parseFloat(stickerPackDetailsPopup.price)), //tokenAmount + stickerPackDetailsPopup.store.appNetworkId, //chainId + stickerPackDetailsPopup.store.stickersStore.getStickersMarketAddress(), //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + false, //interactive + "", //publicKey + "", //ensName + stickerPackDetailsPopup.packId, //stickersPackId + ) stickerPackDetailsPopup.buyClicked(stickerPackDetailsPopup.packId) } diff --git a/ui/imports/shared/status/StatusStickersPopup.qml b/ui/imports/shared/status/StatusStickersPopup.qml index 0cf54634a55..2668cb7f7f2 100644 --- a/ui/imports/shared/status/StatusStickersPopup.qml +++ b/ui/imports/shared/status/StatusStickersPopup.qml @@ -20,7 +20,6 @@ Popup { property ChatStores.RootStore store required property WalletAssetsStore walletAssetsStore - required property var sendModalPopup property alias isWalletEnabled: stickerMarket.isWalletEnabled @@ -103,7 +102,6 @@ Popup { Layout.fillHeight: true store: root.store walletAssetsStore: root.walletAssetsStore - sendModalPopup: root.sendModalPopup stickerPacks: d.stickerPackList packId: stickerPackListView.selectedPackId marketVisible: d.stickerPacksLoaded && d.online diff --git a/ui/imports/shared/views/HistoryView.qml b/ui/imports/shared/views/HistoryView.qml index e4b7c04f207..8b808852d78 100644 --- a/ui/imports/shared/views/HistoryView.qml +++ b/ui/imports/shared/views/HistoryView.qml @@ -37,7 +37,6 @@ ColumnLayout { property CurrenciesStore currencyStore property bool showAllAccounts: false property bool displayValues: true - property var sendModal property bool filterVisible property bool disableShadowOnScroll: false property bool hideVerticalScrollbar: false @@ -359,24 +358,27 @@ ColumnLayout { let asset = root.walletRootStore.getAssetForSendTx(tx) const req = Helpers.lookupAddressesForSendModal(root.walletRootStore.accounts, - root.walletRootStore.savedAddresses, - tx.sender, - tx.recipient, - asset, - tx.isNFT, - tx.amount, - tx.chainId) - - root.sendModal.preSelectedAccountAddress = req.preSelectedAccount.address - root.sendModal.preSelectedRecipient = req.preSelectedRecipient - root.sendModal.preSelectedRecipientType = req.preSelectedRecipientType - root.sendModal.preSelectedHoldingID = req.preSelectedHoldingID - root.sendModal.preSelectedHoldingType = req.preSelectedHoldingType - root.sendModal.preSelectedSendType = req.preSelectedSendType - root.sendModal.preDefinedAmountToSend = req.preDefinedAmountToSend - root.sendModal.preSelectedChainId = req.preSelectedChainId - root.sendModal.onlyAssets = false - root.sendModal.open() + root.walletRootStore.savedAddresses, + tx.sender, + tx.recipient, + asset, + tx.isNFT, + tx.amount, + tx.chainId) + Global.openSendModal(req.preSelectedSendType, //sendType + req.preSelectedAccount.address, //senderAddress + req.preSelectedHoldingID, //tokenId + req.preSelectedHoldingType, //tokenType + req.preDefinedAmountToSend, //tokenAmount + req.preSelectedChainId, //chainId + req.preSelectedRecipient, //recipientAddress + req.preSelectedRecipientType, //recipientType + false, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) } } StatusSuccessAction { diff --git a/ui/imports/shared/views/chat/MessageView.qml b/ui/imports/shared/views/chat/MessageView.qml index 48b138c869c..a047b77b1af 100644 --- a/ui/imports/shared/views/chat/MessageView.qml +++ b/ui/imports/shared/views/chat/MessageView.qml @@ -10,6 +10,7 @@ import shared.popups 1.0 import shared.views.chat 1.0 import shared.controls.chat 1.0 import shared.stores 1.0 as SharedStores +import shared.popups.send 1.0 import StatusQ 0.1 import StatusQ.Core 0.1 @@ -745,7 +746,20 @@ Loader { onLinkActivated: { if (link.startsWith(Constants.sendViaChatPrefix)) { const addressOrEns = link.replace(Constants.sendViaChatPrefix, ""); - Global.openSendModal(addressOrEns) + Global.openSendModal(Constants.SendType.Transfer, //sendType + "", //senderAddress + "", //tokenId + Constants.TokenType.Unknown, //tokenType + "", //tokenAmount + 0, //chainId + addressOrEns, //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) return } if (link.startsWith('//')) { diff --git a/ui/imports/shared/views/profile/ProfileShowcaseAccountsView.qml b/ui/imports/shared/views/profile/ProfileShowcaseAccountsView.qml index 95e8ceb4495..16ad5716a24 100644 --- a/ui/imports/shared/views/profile/ProfileShowcaseAccountsView.qml +++ b/ui/imports/shared/views/profile/ProfileShowcaseAccountsView.qml @@ -9,6 +9,7 @@ import StatusQ.Core.Utils 0.1 as StatusQUtils import StatusQ.Popups 0.1 import shared.controls.delegates 1.0 +import shared.popups.send 1.0 import utils 1.0 import AppLayouts.Wallet.stores 1.0 as WalletStores @@ -68,9 +69,20 @@ Item { icon.name: "send" icon.color: !hovered ? Theme.palette.baseColor1 : Theme.palette.directColor1 enabled: root.sendToAccountEnabled - onClicked: { - Global.openSendModal(model.address) - } + onClicked: Global.openSendModal(Constants.SendType.Transfer, //sendType + "", //senderAddress + "", //tokenId + Constants.TokenType.Unknown, //tokenType + "", //tokenAmount + 0, //chainId + model.address, //recipientAddress + Helpers.RecipientAddressObjectType.Address, //recipientType + false, //onlyAssets + true, //interactive + "", //publicKey + "", //ensName + "", //stickersPackId + ) onHoveredChanged: accountInfoDelegate.highlight = hovered } StatusFlatRoundButton { diff --git a/ui/imports/utils/Global.qml b/ui/imports/utils/Global.qml index d5111d97b68..ec705bef8b5 100644 --- a/ui/imports/utils/Global.qml +++ b/ui/imports/utils/Global.qml @@ -50,8 +50,7 @@ QtObject { signal openTransferOwnershipPopup(string communityId, string communityName, string communityLogo, - var token, - var sendModalPopup) + var token) signal openFinaliseOwnershipPopup(string communityId) signal openDeclineOwnershipPopup(string communityId, string communityName) signal openFirstTokenReceivedPopup(string communityId, @@ -72,7 +71,13 @@ QtObject { signal setNthEnabledSectionActive(int nthSection) signal appSectionBySectionTypeChanged(int sectionType, int subsection, int subSubsection, var data) - signal openSendModal(string address) + signal openSendModal(int sendType, string senderAddress, + string tokenId, int tokenType, + string tokenAmount, int chainId, + string recipientAddress, int recipientType, + bool onlyAssets, bool interactive, + string publicKey, string ensName, + string stickersPackId) signal switchToCommunity(string communityId) signal switchToCommunitySettings(string communityId) signal switchToCommunityChannelsView(string communityId)