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 e6a7af8708
commit d389808a53
28 changed files with 379 additions and 285 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
@ -325,7 +324,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,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()
}
}

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

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
@ -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
@ -343,25 +341,41 @@ Item {
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()
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 = ""

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

View File

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

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"
@ -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 ?
let sendType = tokenType === Constants.TokenType.ERC721 ?
Constants.SendType.ERC721Transfer:
Constants.SendType.ERC1155Transfer
root.sendModal.onlyAssets = false
root.sendModal.open()
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

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

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

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

View File

@ -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,40 +1645,43 @@ 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
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() {
// 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
@ -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()

View File

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

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

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

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

@ -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
@ -366,17 +365,20 @@ ColumnLayout {
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
)
}
}
StatusSuccessAction {

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
@ -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('//')) {

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

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)