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(....)
This commit is contained in:
Khushboo Mehta 2024-11-05 19:51:17 +01:00
parent c99697134b
commit d3e043b2e8
28 changed files with 300 additions and 295 deletions

View File

@ -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

View File

@ -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
@ -353,7 +352,6 @@ StatusSectionLayout {
id: statusStickerPackClickPopup
StatusStickerPackClickPopup{
walletAssetsStore: root.walletAssetsStore
sendModalPopup: root.sendModalPopup
onClosed: {
destroy();
}

View File

@ -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

View File

@ -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 })
}

View File

@ -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,13 @@ 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.launchSendWithParams(Constants.SendType.ERC721Transfer, //sendType
token.accountAddress, //senderAddress
uid, //tokenId
Constants.TokenType.ERC721 //tokenType
)
close()
}
}

View File

@ -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

View File

@ -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 = ""

View File

@ -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,19 @@ 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.launchSendWithParams(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
)
}
Connections {
@ -297,17 +296,19 @@ 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.launchSendWithParams(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
)
}
Connections {
@ -385,19 +386,19 @@ 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.launchSendWithParams(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
)
}
Connections {

View File

@ -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 {

View File

@ -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
}

View File

@ -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
@ -200,7 +200,6 @@ Item {
store: root.store
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
sendModal: root.sendModalPopup
networkFilter.visible: false
headerButton.text: qsTr("Add new address")
@ -217,7 +216,6 @@ Item {
store: root.store
contactsStore: root.contactsStore
communitiesStore: root.communitiesStore
sendModal: root.sendModalPopup
networkConnectionStore: root.networkConnectionStore
swapEnabled: root.swapEnabled
@ -319,40 +317,43 @@ Item {
hasFloatingButtons: true
})
onLaunchSendModal: (fromAddress) => {
if(isCommunityOwnershipTransfer) {
const tokenItem = walletStore.currentViewedCollectible
const ownership = StatusQUtils.ModelUtils.get(tokenItem.ownership, 0)
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
}
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:
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()
}
// Common send modal popup:
Global.launchSendWithParams(Constants.SendType.Transfer, //sendType
fromAddress, //senderAddress
walletStore.currentViewedHoldingTokensKey, //tokenId
walletStore.currentViewedHoldingType //tokenType
)
}
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.launchSendWithParams(Constants.SendType.Bridge, //sendType
"", //senderAddress
walletStore.currentViewedHoldingID, //tokenId
walletStore.currentViewedHoldingType, //tokenType
"", //tokenAmount
0, //chainId
"", //recipientAddress
"", //recipientType
true //onlyAssets
)
}
onLaunchSwapModal: {
d.swapFormData.fromTokensKey = ""

View File

@ -122,7 +122,7 @@ Rectangle {
interactive: !d.isCollectibleSoulbound && networkConnectionStore.sendBuyBridgeEnabled
onClicked: {
root.transactionStore.setSenderAccount(root.walletStore.selectedAddress)
root.launchSendModal(d.userOwnedAddressForCollectible)
root.launchSendModal(d.isCollectibleViewed ? d.userOwnedAddressForCollectible: root.walletStore.selectedAddress)
}
tooltip.text: d.isCollectibleSoulbound ? qsTr("Soulbound collectibles cannot be sent to another wallet") : networkConnectionStore.sendBuyBridgeToolTipText
visible: d.sendActionAvailable

View File

@ -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,14 @@ StatusModal {
}
onOpenSendModal: {
root.close()
root.sendModalPopup.open(recipient)
Global.launchSendWithParams(Constants.SendType.Transfer, //sendType
"", //senderAddress
"", //tokenId
Constants.TokenType.Unknown, //tokenType
"", //tokenAmount
0, //chainId
recipient //recipientAddress
)
}
}
@ -241,7 +248,14 @@ StatusModal {
enabled: root.networkConnectionStore.sendBuyBridgeEnabled
onClicked: {
root.close()
root.sendModalPopup.open(d.visibleAddress)
Global.launchSendWithParams(Constants.SendType.Transfer, //sendType
"", //senderAddress
"", //tokenId
Constants.TokenType.Unknown, //tokenType
"", //tokenAmount
0, //chainId
d.visibleAddress //recipientAddress
)
}
}

View File

@ -21,8 +21,6 @@ FocusScope {
property bool swapEnabled
property var sendModal
property alias header: header
property alias headerButton: header.headerButton
property alias networkFilter: header.networkFilter

View File

@ -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"
@ -282,13 +283,16 @@ 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.launchSendWithParams(Constants.SendType.Transfer, //sendType
RootStore.overview.mixedcaseAddress.toLowerCase(), //senderAddress
key, //tokenId
Constants.TokenType.ERC20, //tokenType
"", //tokenAmount
0, //chainId
"", //recipientAddress
Helpers.RecipientAddressObjectType.Address, //recipientType
true //onlyAssets
)
}
onSwapRequested: root.launchSwapModal(key)
@ -393,33 +397,32 @@ RightTabBaseView {
stack.currentIndex = 1
}
onSendRequested: (symbol, tokenType, fromAddress) => {
const collectible = ModelUtils.getByKey(controller.sourceModel, "symbol", symbol)
if (!!collectible && collectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.Owner) {
Global.openTransferOwnershipPopup(collectible.communityId,
collectible.communityName,
collectible.communityImage,
{
key: collectible.tokenId,
privilegesLevel: collectible.communityPrivilegesLevel,
chainId: collectible.chainId,
name: collectible.name,
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()
}
const collectible = ModelUtils.getByKey(controller.sourceModel, "symbol", symbol)
if (!!collectible && collectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.Owner) {
Global.openTransferOwnershipPopup(collectible.communityId,
collectible.communityName,
collectible.communityImage,
{
key: collectible.tokenId,
privilegesLevel: collectible.communityPrivilegesLevel,
chainId: collectible.chainId,
name: collectible.name,
artworkSource: collectible.communityImage,
accountAddress: fromAddress,
tokenAddress: collectible.contractAddress
})
return
}
let sendType = tokenType === Constants.TokenType.ERC721 ?
Constants.SendType.ERC721Transfer:
Constants.SendType.ERC1155Transfer
Global.launchSendWithParams(sendType, //sendType
fromAddress, //senderAddress
symbol, //tokenId
tokenType //tokenType
)
}
onReceiveRequested: (symbol) => root.launchShareAddressModal()
onSwitchToCommunityRequested: (communityId) => Global.switchToCommunity(communityId)
onManageTokensRequested: Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.wallet,

View File

@ -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,14 @@ ColumnLayout {
colorId: model.colorId
networkConnectionStore: root.networkConnectionStore
areTestNetworksEnabled: RootStore.areTestNetworksEnabled
onOpenSendModal: root.sendModal.open(recipient);
onOpenSendModal: Global.launchSendWithParams(Constants.SendType.Transfer, //sendType
"", //senderAddress
"", //tokenId
Constants.TokenType.Unknown, //tokenType
"", //tokenAmount
0, //chainId
recipient //recipientAddress
)
states: [
State {

View File

@ -8,7 +8,6 @@ RightTabBaseView {
width: root.width
height: root.height - header.height
sendModal: root.sendModal
contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore
}

View File

@ -112,8 +112,6 @@ Item {
rootChatStore: appMain.rootChatStore
communityTokensStore: appMain.communityTokensStore
profileStore: appMain.profileStore
sendModalPopup: sendModal
}
Connections {
@ -673,10 +671,6 @@ Item {
}
}
function onOpenSendModal(address: string) {
sendModal.open(address)
}
function onSwitchToCommunity(communityId: string) {
appMain.communitiesStore.setActiveCommunity(communityId)
}
@ -819,8 +813,6 @@ Item {
sourceComponent: StatusStickersPopup {
store: appMain.rootChatStore
walletAssetsStore: appMain.walletAssetsStore
sendModalPopup: sendModal
isWalletEnabled: appMain.profileStore.isWalletEnabled
}
}
@ -1599,7 +1591,6 @@ Item {
communitiesStore: appMain.communitiesStore
transactionStore: appMain.transactionStore
emojiPopup: statusEmojiPopup.item
sendModalPopup: sendModal
networkConnectionStore: appMain.networkConnectionStore
appMainVisible: appMain.visible
swapEnabled: featureFlagsStore.swapEnabled
@ -1624,7 +1615,6 @@ Item {
store: appMain.rootStore.profileSectionStore
globalStore: appMain.rootStore
communitiesStore: appMain.communitiesStore
sendModalPopup: sendModal
systemPalette: appMain.sysPalette
emojiPopup: statusEmojiPopup.item
networkConnectionStore: appMain.networkConnectionStore
@ -1702,7 +1692,6 @@ Item {
}
}
sendModalPopup: sendModal
emojiPopup: statusEmojiPopup.item
stickersPopup: statusStickersPopupLoader.item
sectionItemModel: model
@ -1797,104 +1786,6 @@ Item {
}
}
// Add SendModal here as it is used by the Wallet as well as the Browser
Loader {
id: sendModal
active: false
function open(address = "") {
if (!!address) {
preSelectedRecipient = address
preSelectedRecipientType = SendPopups.Helpers.RecipientAddressObjectType.Address
}
this.active = true
this.item.open()
}
function closed() {
// this.sourceComponent = undefined // kill an opened instance
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
loginType: appMain.rootStore.loginType
store: appMain.transactionStore
collectiblesStore: appMain.walletCollectiblesStore
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
}
}
}
Action {
shortcut: "Ctrl+1"
onTriggered: {
@ -2324,7 +2215,6 @@ Item {
sourceComponent: WalletPopups.SavedAddressActivityPopup {
networkConnectionStore: appMain.networkConnectionStore
contactsStore: appMain.rootStore.contactStore
sendModalPopup: sendModal
onClosed: {
savedAddressActivity.close()

View File

@ -28,6 +28,7 @@ import AppLayouts.Wallet.stores 1.0 as WalletStores
import AppLayouts.Chat.stores 1.0 as ChatStores
import shared.popups 1.0
import shared.popups.send 1.0
import shared.status 1.0
import shared.stores 1.0
import shared.views 1.0
@ -102,6 +103,7 @@ QtObject {
Global.openCommunityMemberMessagesPopupRequested.connect(openCommunityMemberMessagesPopup)
Global.openSwapModalRequested.connect(openSwapModal)
Global.openBuyCryptoModalRequested.connect(openBuyCryptoModal)
Global.openSendModal.connect(openSendModal)
Global.privacyPolicyRequested.connect(() => openPopup(privacyPolicyPopupComponent))
}
@ -346,8 +348,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) {
@ -403,6 +405,44 @@ QtObject {
})
}
function openSendModal(sendType, senderAddress,
tokenId, tokenType,
tokenAmount, chainId,
recipientAddress, recipientType,
onlyAssets, interactive,
publicKey, ensName,
stickersPackId) {
console.error("openSendModal >> ", "sendType >> ", sendType,
"senderAddress >> ",senderAddress,
"tokenId >> ",tokenId,
"tokenType >> ",tokenType,
"tokenAmount >> ",tokenAmount,
"chainId >> ",chainId,
"recipientAddress >> ",recipientAddress,
"recipientType >> ",recipientType,
"onlyAssets >> ",onlyAssets,
"interactive >> ",interactive,
"publicKey >> ",publicKey,
"ensName >> ",ensName,
"stickersPackId >> ",stickersPackId)
openPopup(sendModal, {
preSelectedSendType: sendType,
preSelectedAccountAddress: senderAddress,
preSelectedHoldingID: tokenId ,
preSelectedHoldingType: tokenType,
preDefinedAmountToSend: tokenAmount,
preSelectedChainId: chainId,
preSelectedRecipient: recipientAddress,
preSelectedRecipientType: recipientType,
onlyAssets: onlyAssets,
interactive: interactive,
publicKey: publicKey,
ensName: ensName,
stickersPackId: stickersPackId
})
}
readonly property list<Component> _components: [
Component {
id: removeContactConfirmationDialog
@ -1272,6 +1312,19 @@ QtObject {
standardButtons: Dialog.Ok
destroyOnClose: true
}
},
Component {
id: sendModal
SendModal {
loginType: appMain.rootStore.loginType
store: appMain.transactionStore
collectiblesStore: appMain.walletCollectiblesStore
showCustomRoutingMode: !production
onClosed: destroy()
}
}
]
}

View File

@ -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.launchSendWithParams()
return
case ToastsManager.ActionType.ViewTransactionDetails:
if(actionData) {

View File

@ -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 {

View File

@ -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.launchSendWithParams(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
)
}
}

View File

@ -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.launchSendWithParams(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)
}

View File

@ -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

View File

@ -17,7 +17,6 @@ import utils 1.0
import "../panels"
import "../popups"
import "../popups/send"
import "../stores"
import "../controls"

View File

@ -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
@ -759,7 +760,14 @@ Loader {
onLinkActivated: {
if (link.startsWith(Constants.sendViaChatPrefix)) {
const addressOrEns = link.replace(Constants.sendViaChatPrefix, "");
Global.openSendModal(addressOrEns)
Global.launchSendWithParams(Constants.SendType.Transfer, //sendType
"", //senderAddress
"", //tokenId
Constants.TokenType.Unknown, //tokenType
"", //tokenAmount
0, //chainId
addressOrEns //recipientAddress
)
return
}
if (link.startsWith('//')) {

View File

@ -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,14 @@ Item {
icon.name: "send"
icon.color: !hovered ? Theme.palette.baseColor1 : Theme.palette.directColor1
enabled: root.sendToAccountEnabled
onClicked: {
Global.openSendModal(model.address)
}
onClicked: Global.launchSendWithParams(Constants.SendType.Transfer, //sendType
"", //senderAddress
"", //tokenId
Constants.TokenType.Unknown, //tokenType
"", //tokenAmount
0, //chainId
model.address //recipientAddress
)
onHoveredChanged: accountInfoDelegate.highlight = hovered
}
StatusFlatRoundButton {

View File

@ -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)
@ -151,4 +156,25 @@ QtObject {
""
)
}
function launchSendWithParams(sendType = Constants.SendType.Transfer,
senderAddress = "",
tokenId = "",
tokenType = Constants.TokenType.Unknown,
tokenAmount = "",
chainId = 0,
recipientAddress = "",
recipientType = 0,
onlyAssets = false,
interactive = true,
publicKey = "",
ensName = "",
stickersPackId = "") {
root.openSendModal(sendType, senderAddress,
tokenId, tokenType,
tokenAmount, chainId,
recipientAddress, recipientType,
onlyAssets, interactive,
publicKey, ensName, stickersPackId)
}
}