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 228197e2c4
commit 34ae4aedf3
36 changed files with 372 additions and 348 deletions

View File

@ -45,8 +45,6 @@ StackLayout {
allMembers: !!sectionItemModel ? sectionItemModel.allMembers : null allMembers: !!sectionItemModel ? sectionItemModel.allMembers : null
} }
property var sendModalPopup
readonly property bool isOwner: sectionItemModel.memberRole === Constants.memberRole.owner readonly property bool isOwner: sectionItemModel.memberRole === Constants.memberRole.owner
readonly property bool isAdmin: sectionItemModel.memberRole === Constants.memberRole.admin readonly property bool isAdmin: sectionItemModel.memberRole === Constants.memberRole.admin
readonly property bool isTokenMasterOwner: sectionItemModel.memberRole === Constants.memberRole.tokenMaster readonly property bool isTokenMasterOwner: sectionItemModel.memberRole === Constants.memberRole.tokenMaster
@ -168,7 +166,6 @@ StackLayout {
emojiPopup: root.emojiPopup emojiPopup: root.emojiPopup
stickersPopup: root.stickersPopup stickersPopup: root.stickersPopup
sendModalPopup: root.sendModalPopup
sectionItemModel: root.sectionItemModel sectionItemModel: root.sectionItemModel
joinedMembersCount: membersModelAdaptor.joinedMembers.ModelCount.count joinedMembersCount: membersModelAdaptor.joinedMembers.ModelCount.count
amIMember: sectionItem.amIMember amIMember: sectionItem.amIMember
@ -261,7 +258,6 @@ StackLayout {
enabledChainIds: WalletStore.RootStore.networkFilters enabledChainIds: WalletStore.RootStore.networkFilters
onEnableNetwork: WalletStore.RootStore.enableNetwork(chainId) onEnableNetwork: WalletStore.RootStore.enableNetwork(chainId)
tokensStore: root.tokensStore tokensStore: root.tokensStore
sendModalPopup: root.sendModalPopup
transactionStore: root.transactionStore transactionStore: root.transactionStore
isPendingOwnershipRequest: root.isPendingOwnershipRequest isPendingOwnershipRequest: root.isPendingOwnershipRequest

View File

@ -369,6 +369,10 @@ Item {
stickersLoaded: root.stickersLoaded stickersLoaded: root.stickersLoaded
onSendViaPersonalChatRequested: {
Global.sendViaPersonalChatRequested(recipientAddress)
}
onVisibleChanged: { onVisibleChanged: {
if(!visible && model.editMode) if(!visible && model.editMode)
messageStore.setEditModeOff(model.id) messageStore.setEditModeOff(model.id)

View File

@ -51,7 +51,6 @@ StatusSectionLayout {
property var mutualContactsModel property var mutualContactsModel
required property var sendModalPopup
property var sectionItemModel property var sectionItemModel
property int joinedMembersCount property int joinedMembersCount
@ -358,11 +357,10 @@ StatusSectionLayout {
Component { Component {
id: statusStickerPackClickPopup id: statusStickerPackClickPopup
StatusStickerPackClickPopup{ StatusStickerPackClickPopup{
walletAssetsStore: root.walletAssetsStore onBuyClicked: {
sendModalPopup: root.sendModalPopup Global.buyStickerPackRequested(packId, price)
onClosed: {
destroy();
} }
onClosed: destroy()
} }
} }
} }

View File

@ -31,7 +31,6 @@ StackView {
required property string communityName required property string communityName
required property string communityLogo required property string communityLogo
required property color communityColor required property color communityColor
property var sendModalPopup
// User profile props: // User profile props:
required property bool isOwner required property bool isOwner
@ -786,8 +785,7 @@ StackView {
onSendOwnershipClicked: Global.openTransferOwnershipPopup(root.communityId, onSendOwnershipClicked: Global.openTransferOwnershipPopup(root.communityId,
root.communityName, root.communityName,
root.communityLogo, root.communityLogo,
tokenViewPage.token, tokenViewPage.token)
root.sendModalPopup)
// helper properties to pass data through popups // helper properties to pass data through popups
property var walletsAndAmounts property var walletsAndAmounts

View File

@ -40,7 +40,6 @@ StackLayout {
property bool requestToJoinEnabled property bool requestToJoinEnabled
property bool pinMessagesEnabled property bool pinMessagesEnabled
property string previousPageName: (currentIndex === 1) ? qsTr("Overview") : "" property string previousPageName: (currentIndex === 1) ? qsTr("Overview") : ""
property var sendModalPopup
property bool archiveSupporVisible: true property bool archiveSupporVisible: true
property bool editable: false property bool editable: false
@ -134,8 +133,15 @@ StackLayout {
Global.openTransferOwnershipPopup(root.communityId, Global.openTransferOwnershipPopup(root.communityId,
root.name, root.name,
root.logoImageData, 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 { } else {
Global.openPopup(transferOwnershipAlertPopup, { mode: TransferOwnershipAlertPopup.Mode.TransferOwnership }) Global.openPopup(transferOwnershipAlertPopup, { mode: TransferOwnershipAlertPopup.Mode.TransferOwnership })
} }

View File

@ -26,9 +26,9 @@ StatusDialog {
// Transaction related props: // Transaction related props:
property var token // Expected roles: accountAddress, key, chainId, name, artworkSource property var token // Expected roles: accountAddress, key, chainId, name, artworkSource
property var sendModalPopup
signal cancelClicked signal cancelClicked
signal transferOwnershipRequested(string tokenId, string senderAddress)
width: 640 // by design width: 640 // by design
padding: Theme.padding padding: Theme.padding
@ -109,13 +109,9 @@ StatusDialog {
onClicked: { onClicked: {
// Pre-populated dialog with the relevant Owner token info: // 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 store = WalletStores.RootStore.currentActivityFiltersStore
const uid = store.collectiblesList.getUidForData(token.key, token.tokenAddress, token.chainId); const uid = store.collectiblesList.getUidForData(token.key, token.tokenAddress, token.chainId);
root.sendModalPopup.preSelectedHoldingID = uid root.transferOwnershipRequested(uid, token.accountAddress)
root.sendModalPopup.preSelectedHoldingType = Constants.TokenType.ERC721
root.sendModalPopup.open()
close() close()
} }
} }

View File

@ -46,7 +46,6 @@ StatusSectionLayout {
required property var declinedMembers required property var declinedMembers
required property TransactionStore transactionStore required property TransactionStore transactionStore
property bool communitySettingsDisabled property bool communitySettingsDisabled
property var sendModalPopup
required property string enabledChainIds required property string enabledChainIds
@ -221,7 +220,6 @@ StatusSectionLayout {
pubsubTopic: root.community.pubsubTopic pubsubTopic: root.community.pubsubTopic
pubsubTopicKey: root.community.pubsubTopicKey pubsubTopicKey: root.community.pubsubTopicKey
sendModalPopup: root.sendModalPopup
ownerToken: tokensModelChangesTracker.ownerToken ownerToken: tokensModelChangesTracker.ownerToken
isPendingOwnershipRequest: root.isPendingOwnershipRequest isPendingOwnershipRequest: root.isPendingOwnershipRequest
@ -380,7 +378,6 @@ StatusSectionLayout {
communityName: root.community.name communityName: root.community.name
communityLogo: root.community.image communityLogo: root.community.image
communityColor: root.community.color communityColor: root.community.color
sendModalPopup: root.sendModalPopup
// User profile props // User profile props
isOwner: root.isOwner isOwner: root.isOwner

View File

@ -45,7 +45,6 @@ StatusSectionLayout {
property ProfileStores.ProfileSectionStore store property ProfileStores.ProfileSectionStore store
property AppLayoutsStores.RootStore globalStore property AppLayoutsStores.RootStore globalStore
property CommunitiesStore.CommunitiesStore communitiesStore property CommunitiesStore.CommunitiesStore communitiesStore
required property var sendModalPopup
property var systemPalette property var systemPalette
property var emojiPopup property var emojiPopup
property SharedStores.NetworkConnectionStore networkConnectionStore property SharedStores.NetworkConnectionStore networkConnectionStore
@ -259,10 +258,12 @@ StatusSectionLayout {
implicitHeight: parent.height implicitHeight: parent.height
ensUsernamesStore: root.store.ensUsernamesStore ensUsernamesStore: root.store.ensUsernamesStore
walletAssetsStore: root.walletAssetsStore walletAssetsStore: root.walletAssetsStore
sendModalPopup: root.sendModalPopup
contactsStore: root.store.contactsStore contactsStore: root.store.contactsStore
networkConnectionStore: root.networkConnectionStore networkConnectionStore: root.networkConnectionStore
profileContentWidth: d.contentWidth profileContentWidth: d.contentWidth
onConnectUsernameRequested: Global.connectUsernameRequested(ensName)
onRegisterUsernameRequested: Global.registerUsernameRequested(ensName)
onReleaseUsernameRequested: Global.releaseUsernameRequested(ensName, senderAddress, chainId)
} }
} }
@ -300,7 +301,6 @@ StatusSectionLayout {
myPublicKey: root.store.contactsStore.myPublicKey myPublicKey: root.store.contactsStore.myPublicKey
currencySymbol: root.sharedRootStore.currencyStore.currentCurrency currencySymbol: root.sharedRootStore.currencyStore.currentCurrency
emojiPopup: root.emojiPopup emojiPopup: root.emojiPopup
sendModalPopup: root.sendModalPopup
sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.wallet) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.wallet)
} }
onLoaded: root.store.backButtonName = "" onLoaded: root.store.backButtonName = ""

View File

@ -20,7 +20,7 @@ Item {
id: root id: root
property EnsUsernamesStore ensUsernamesStore property EnsUsernamesStore ensUsernamesStore
property string username: "" property string username: ""
property string chainId: "" property int chainId: -1
signal backBtnClicked() signal backBtnClicked()
signal releaseUsernameRequested(string senderAddress) signal releaseUsernameRequested(string senderAddress)

View File

@ -25,7 +25,7 @@ Item {
property int profileContentWidth property int profileContentWidth
signal addBtnClicked() signal addBtnClicked()
signal selectEns(string username, string chainId) signal selectEns(string username, int chainId)
Component.onCompleted: { Component.onCompleted: {
d.updateNumberOfPendingEnsUsernames() d.updateNumberOfPendingEnsUsernames()

View File

@ -24,9 +24,22 @@ Item {
property EnsUsernamesStore ensUsernamesStore property EnsUsernamesStore ensUsernamesStore
property string username: "" property string username: ""
required property var assetsModel
signal backBtnClicked() signal backBtnClicked()
signal registerUsername() signal registerUsername()
QtObject {
id: d
readonly property var sntToken: statusTokenEntry.item
readonly property SumAggregator aggregator: SumAggregator {
model: !!d.sntToken && !!d.sntToken.balances ? d.sntToken.balances: null
roleName: "balance"
}
property real sntBalance: !!sntToken && !!sntToken.decimals ? aggregator.value/(10 ** sntToken.decimals): 0
}
StatusBaseText { StatusBaseText {
id: sectionTitle id: sectionTitle
text: qsTr("ENS usernames") text: qsTr("ENS usernames")
@ -346,4 +359,11 @@ Item {
enabled: d.sntBalance >= 10 && termsAndConditionsCheckbox.checked enabled: d.sntBalance >= 10 && termsAndConditionsCheckbox.checked
onClicked: root.registerUsername(root.username) onClicked: root.registerUsername(root.username)
} }
ModelEntry {
id: statusTokenEntry
sourceModel: root.assetsModel
key: "tokensKey"
value: root.ensUsernamesStore.getStatusTokenKey()
}
} }

View File

@ -24,8 +24,6 @@ Item {
property EnsUsernamesStore ensUsernamesStore property EnsUsernamesStore ensUsernamesStore
property WalletAssetsStore walletAssetsStore property WalletAssetsStore walletAssetsStore
required property var sendModalPopup
property ContactsStore contactsStore property ContactsStore contactsStore
property SharedStores.NetworkConnectionStore networkConnectionStore property SharedStores.NetworkConnectionStore networkConnectionStore
@ -33,7 +31,7 @@ Item {
property bool showSearchScreen: false property bool showSearchScreen: false
property string addedUsername: "" property string addedUsername: ""
property string selectedUsername: "" property string selectedUsername: ""
property string selectedChainId: "" property int selectedChainId: -1
signal next(output: string) signal next(output: string)
signal back() signal back()
@ -43,6 +41,10 @@ Item {
signal goToWelcome(); signal goToWelcome();
signal goToList(); signal goToList();
signal connectUsernameRequested(string ensName)
signal registerUsernameRequested(string ensName)
signal releaseUsernameRequested(string ensName, string senderAddress, int chainId)
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
clip: true clip: true
@ -53,13 +55,6 @@ Item {
readonly property string registerENS: "RegisterENS" readonly property string registerENS: "RegisterENS"
readonly property string setPubKey: "SetPubKey" readonly property string setPubKey: "SetPubKey"
readonly property string releaseENS: "ReleaseENS" readonly property string releaseENS: "ReleaseENS"
readonly property var sntToken: ModelUtils.getByKey(ensView.walletAssetsStore.groupedAccountAssetsModel, "tokensKey", ensView.ensUsernamesStore.getStatusTokenKey())
readonly property SumAggregator aggregator: SumAggregator {
model: !!d.sntToken && !!d.sntToken.balances ? d.sntToken.balances: nil
roleName: "balance"
}
property real sntBalance: !!sntToken && !!sntToken.decimals ? aggregator.value/(10 ** sntToken.decimals): 0
} }
DSM.StateMachine { DSM.StateMachine {
@ -261,19 +256,7 @@ Item {
onConnectUsername: { onConnectUsername: {
ensView.selectedUsername = username ensView.selectedUsername = username
ensView.connectUsernameRequested(ensView.selectedUsername)
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()
} }
Connections { Connections {
@ -293,22 +276,11 @@ Item {
EnsTermsAndConditionsView { EnsTermsAndConditionsView {
ensUsernamesStore: ensView.ensUsernamesStore ensUsernamesStore: ensView.ensUsernamesStore
username: selectedUsername username: selectedUsername
assetsModel: ensView.walletAssetsStore.groupedAccountAssetsModel
onBackBtnClicked: back(); onBackBtnClicked: back();
onRegisterUsername: { onRegisterUsername: ensView.registerUsernameRequested(ensView.selectedUsername)
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()
}
Connections { Connections {
target: ensView.ensUsernamesStore.ensUsernamesModule target: ensView.ensUsernamesStore.ensUsernamesModule
@ -384,20 +356,7 @@ Item {
Global.openPopup(noAccountPopupComponent) Global.openPopup(noAccountPopupComponent)
return return
} }
ensView.releaseUsernameRequested(ensView.selectedUsername, senderAddress, ensView.selectedChainId)
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()
} }
Connections { Connections {

View File

@ -44,8 +44,6 @@ SettingsContentBase {
required property WalletAssetsStore assetsStore required property WalletAssetsStore assetsStore
required property CollectiblesStore collectiblesStore required property CollectiblesStore collectiblesStore
required property var sendModalPopup
readonly property int mainViewIndex: 0 readonly property int mainViewIndex: 0
readonly property int networksViewIndex: 1 readonly property int networksViewIndex: 1
readonly property int editNetworksViewIndex: 2 readonly property int editNetworksViewIndex: 2
@ -372,7 +370,10 @@ SettingsContentBase {
id: savedAddressesView id: savedAddressesView
contactsStore: root.rootStore.contactsStore contactsStore: root.rootStore.contactsStore
networkConnectionStore: root.networkConnectionStore networkConnectionStore: root.networkConnectionStore
sendModal: root.sendModalPopup
onSendToAddressRequested: {
Global.sendToSavedAddressRequested(address)
}
} }
Component { Component {

View File

@ -12,11 +12,13 @@ ColumnLayout {
property ContactsStore contactsStore property ContactsStore contactsStore
property SharedStores.NetworkConnectionStore networkConnectionStore property SharedStores.NetworkConnectionStore networkConnectionStore
property var sendModal
signal sendToAddressRequested(string address)
SavedAddresses { SavedAddresses {
sendModal: root.sendModal
contactsStore: root.contactsStore contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore networkConnectionStore: root.networkConnectionStore
onSendToAddressRequested: root.sendToAddressRequested(address)
} }
} }

View File

@ -37,7 +37,6 @@ Item {
required property TransactionStore transactionStore required property TransactionStore transactionStore
property var emojiPopup: null property var emojiPopup: null
property var sendModalPopup
property SharedStores.NetworkConnectionStore networkConnectionStore property SharedStores.NetworkConnectionStore networkConnectionStore
property bool appMainVisible property bool appMainVisible
@ -211,13 +210,16 @@ Item {
store: root.store store: root.store
contactsStore: root.contactsStore contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore networkConnectionStore: root.networkConnectionStore
sendModal: root.sendModalPopup
networkFilter.visible: false networkFilter.visible: false
headerButton.text: qsTr("Add new address") headerButton.text: qsTr("Add new address")
headerButton.onClicked: { headerButton.onClicked: {
Global.openAddEditSavedAddressesPopup({}) Global.openAddEditSavedAddressesPopup({})
} }
onSendToAddressRequested: {
Global.sendToSavedAddressRequested(address)
}
} }
} }
@ -228,7 +230,6 @@ Item {
store: root.store store: root.store
contactsStore: root.contactsStore contactsStore: root.contactsStore
communitiesStore: root.communitiesStore communitiesStore: root.communitiesStore
sendModal: root.sendModalPopup
networkConnectionStore: root.networkConnectionStore networkConnectionStore: root.networkConnectionStore
swapEnabled: root.swapEnabled swapEnabled: root.swapEnabled
@ -331,40 +332,33 @@ Item {
hasFloatingButtons: true hasFloatingButtons: true
}) })
onLaunchSendModal: (fromAddress) => { onLaunchSendModal: (fromAddress) => {
if(isCommunityOwnershipTransfer) { if(isCommunityOwnershipTransfer) {
const tokenItem = walletStore.currentViewedCollectible const tokenItem = walletStore.currentViewedCollectible
const ownership = StatusQUtils.ModelUtils.get(tokenItem.ownership, 0) const ownership = StatusQUtils.ModelUtils.get(tokenItem.ownership, 0)
Global.openTransferOwnershipPopup(tokenItem.communityId, Global.openTransferOwnershipPopup(tokenItem.communityId,
footer.communityName, footer.communityName,
tokenItem.communityImage, tokenItem.communityImage,
{ {
key: tokenItem.tokenId, key: tokenItem.tokenId,
privilegesLevel: tokenItem.communityPrivilegesLevel, privilegesLevel: tokenItem.communityPrivilegesLevel,
chainId: tokenItem.chainId, chainId: tokenItem.chainId,
name: tokenItem.name, name: tokenItem.name,
artworkSource: tokenItem.artworkSource, artworkSource: tokenItem.artworkSource,
accountAddress: fromAddress, accountAddress: fromAddress,
tokenAddress: tokenItem.contractAddress tokenAddress: tokenItem.contractAddress
}, })
root.sendModalPopup) return
return }
}
// Common send modal popup: // Common send modal popup:
root.sendModalPopup.preSelectedAccountAddress = fromAddress Global.sendTokenRequested(fromAddress,
root.sendModalPopup.preSelectedSendType = Constants.SendType.Transfer walletStore.currentViewedHoldingTokensKey,
root.sendModalPopup.preSelectedHoldingID = walletStore.currentViewedHoldingTokensKey walletStore.currentViewedHoldingType)
root.sendModalPopup.preSelectedHoldingType = walletStore.currentViewedHoldingType }
root.sendModalPopup.onlyAssets = false
root.sendModalPopup.open()
}
onLaunchBridgeModal: { onLaunchBridgeModal: {
root.sendModalPopup.preSelectedSendType = Constants.SendType.Bridge Global.bridgeTokenRequested(walletStore.currentViewedHoldingID,
root.sendModalPopup.preSelectedHoldingID = walletStore.currentViewedHoldingID walletStore.currentViewedHoldingType)
root.sendModalPopup.preSelectedHoldingType = walletStore.currentViewedHoldingType
root.sendModalPopup.onlyAssets = true
root.sendModalPopup.open()
} }
onLaunchSwapModal: { onLaunchSwapModal: {
d.swapFormData.fromTokensKey = "" d.swapFormData.fromTokensKey = ""

View File

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

View File

@ -14,6 +14,7 @@ import AppLayouts.Wallet.stores 1.0 as WalletStore
import utils 1.0 import utils 1.0
import shared.views 1.0 import shared.views 1.0
import shared.popups.send 1.0
import shared.stores 1.0 as SharedStores import shared.stores 1.0 as SharedStores
import "../controls" import "../controls"
@ -24,7 +25,8 @@ StatusModal {
property SharedStores.NetworkConnectionStore networkConnectionStore property SharedStores.NetworkConnectionStore networkConnectionStore
property ProfileStores.ContactsStore contactsStore property ProfileStores.ContactsStore contactsStore
property var sendModalPopup
signal sendToAddressRequested(string address)
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
hasCloseButton: false hasCloseButton: false
@ -162,8 +164,8 @@ StatusModal {
root.close() root.close()
} }
onOpenSendModal: { onOpenSendModal: {
root.close() root.sendToAddressRequested(recipient)
root.sendModalPopup.open(recipient) root.close()
} }
} }
@ -240,8 +242,8 @@ StatusModal {
icon.name: "send" icon.name: "send"
enabled: root.networkConnectionStore.sendBuyBridgeEnabled enabled: root.networkConnectionStore.sendBuyBridgeEnabled
onClicked: { onClicked: {
root.sendToAddressRequested(d.visibleAddress)
root.close() root.close()
root.sendModalPopup.open(d.visibleAddress)
} }
} }

View File

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

View File

@ -309,13 +309,8 @@ RightTabBaseView {
swapVisible: root.swapEnabled swapVisible: root.swapEnabled
onSendRequested: { onSendRequested: {
const modal = root.sendModal Global.sendTokenRequested(RootStore.overview.mixedcaseAddress.toLowerCase(),
key, Constants.TokenType.ERC20)
modal.preSelectedSendType = Constants.SendType.Transfer
modal.preSelectedHoldingID = key
modal.preSelectedHoldingType = Constants.TokenType.ERC20
modal.onlyAssets = true
modal.open()
} }
onSwapRequested: root.launchSwapModal(key) onSwapRequested: root.launchSwapModal(key)
@ -415,33 +410,27 @@ RightTabBaseView {
stack.currentIndex = 1 stack.currentIndex = 1
} }
onSendRequested: (symbol, tokenType, fromAddress) => { onSendRequested: (symbol, tokenType, fromAddress) => {
const collectible = ModelUtils.getByKey(controller.sourceModel, "symbol", symbol) const collectible = ModelUtils.getByKey(controller.sourceModel, "symbol", symbol)
if (!!collectible && collectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.Owner) { if (!!collectible && collectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.Owner) {
Global.openTransferOwnershipPopup(collectible.communityId, Global.openTransferOwnershipPopup(collectible.communityId,
collectible.communityName, collectible.communityName,
collectible.communityImage, collectible.communityImage,
{ {
key: collectible.tokenId, key: collectible.tokenId,
privilegesLevel: collectible.communityPrivilegesLevel, privilegesLevel: collectible.communityPrivilegesLevel,
chainId: collectible.chainId, chainId: collectible.chainId,
name: collectible.name, name: collectible.name,
artworkSource: collectible.communityImage, artworkSource: collectible.communityImage,
accountAddress: fromAddress, accountAddress: fromAddress,
tokenAddress: collectible.contractAddress tokenAddress: collectible.contractAddress
}, })
root.sendModal) return
return }
}
Global.sendTokenRequested(fromAddress ,
root.sendModal.preSelectedAccountAddress = fromAddress symbol,
root.sendModal.preSelectedHoldingID = symbol tokenType)
root.sendModal.preSelectedHoldingType = tokenType }
root.sendModal.preSelectedSendType = tokenType === Constants.TokenType.ERC721 ?
Constants.SendType.ERC721Transfer:
Constants.SendType.ERC1155Transfer
root.sendModal.onlyAssets = false
root.sendModal.open()
}
onReceiveRequested: (symbol) => root.launchShareAddressModal() onReceiveRequested: (symbol) => root.launchShareAddressModal()
onSwitchToCommunityRequested: (communityId) => Global.switchToCommunity(communityId) onSwitchToCommunityRequested: (communityId) => Global.switchToCommunity(communityId)
onManageTokensRequested: Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.wallet, onManageTokensRequested: Global.changeAppSectionBySectionType(Constants.appSection.profile, Constants.settingsSubsection.wallet,

View File

@ -20,10 +20,11 @@ import "../controls"
ColumnLayout { ColumnLayout {
id: root id: root
property var sendModal
property ProfileStores.ContactsStore contactsStore property ProfileStores.ContactsStore contactsStore
property SharedStores.NetworkConnectionStore networkConnectionStore property SharedStores.NetworkConnectionStore networkConnectionStore
signal sendToAddressRequested(string address)
QtObject { QtObject {
id: d id: d
@ -149,7 +150,7 @@ ColumnLayout {
colorId: model.colorId colorId: model.colorId
networkConnectionStore: root.networkConnectionStore networkConnectionStore: root.networkConnectionStore
areTestNetworksEnabled: RootStore.areTestNetworksEnabled areTestNetworksEnabled: RootStore.areTestNetworksEnabled
onOpenSendModal: root.sendModal.open(recipient); onOpenSendModal: root.sendToAddressRequested(recipient)
states: [ states: [
State { State {

View File

@ -3,13 +3,16 @@ import QtQuick 2.13
RightTabBaseView { RightTabBaseView {
id: root id: root
signal sendToAddressRequested(string address)
SavedAddresses { SavedAddresses {
objectName: "savedAddressesArea" objectName: "savedAddressesArea"
width: root.width width: root.width
height: root.height - header.height height: root.height - header.height
sendModal: root.sendModal
contactsStore: root.contactsStore contactsStore: root.contactsStore
networkConnectionStore: root.networkConnectionStore networkConnectionStore: root.networkConnectionStore
onSendToAddressRequested: root.sendToAddressRequested(address)
} }
} }

View File

@ -119,8 +119,6 @@ Item {
rootChatStore: appMain.rootChatStore rootChatStore: appMain.rootChatStore
communityTokensStore: appMain.communityTokensStore communityTokensStore: appMain.communityTokensStore
profileStore: appMain.profileStore profileStore: appMain.profileStore
sendModalPopup: sendModal
} }
Connections { Connections {
@ -615,6 +613,24 @@ Item {
} }
} }
SendModalHandler {
popupParent: appMain
loginType: appMain.rootStore.loginType
transactionStore: appMain.transactionStore
walletCollectiblesStore: appMain.walletCollectiblesStore
// for ens flows
ensRegisteredAddress: appMain.rootStore.profileSectionStore.ensUsernamesStore.getEnsRegisteredAddress()
myPublicKey: appMain.rootStore.contactStore.myPublicKey
getStatusTokenKey: function() {
return appMain.rootStore.profileSectionStore.ensUsernamesStore.getStatusTokenKey()
}
// for sticker flows
stickersMarketAddress: appMain.rootChatStore.stickersStore.getStickersMarketAddress()
stickersNetworkId: appMain.rootChatStore.appNetworkId
}
Connections { Connections {
id: globalConns id: globalConns
target: Global target: Global
@ -683,10 +699,6 @@ Item {
} }
} }
function onOpenSendModal(address: string) {
sendModal.open(address)
}
function onSwitchToCommunity(communityId: string) { function onSwitchToCommunity(communityId: string) {
appMain.communitiesStore.setActiveCommunity(communityId) appMain.communitiesStore.setActiveCommunity(communityId)
} }
@ -828,10 +840,8 @@ Item {
active: appMain.rootStore.mainModuleInst.sectionsLoaded active: appMain.rootStore.mainModuleInst.sectionsLoaded
sourceComponent: StatusStickersPopup { sourceComponent: StatusStickersPopup {
store: appMain.rootChatStore store: appMain.rootChatStore
walletAssetsStore: appMain.walletAssetsStore
sendModalPopup: sendModal
isWalletEnabled: appMain.profileStore.isWalletEnabled isWalletEnabled: appMain.profileStore.isWalletEnabled
onBuyClicked: Global.buyStickerPackRequested(packId, price)
} }
} }
@ -1611,7 +1621,6 @@ Item {
communitiesStore: appMain.communitiesStore communitiesStore: appMain.communitiesStore
transactionStore: appMain.transactionStore transactionStore: appMain.transactionStore
emojiPopup: statusEmojiPopup.item emojiPopup: statusEmojiPopup.item
sendModalPopup: sendModal
networkConnectionStore: appMain.networkConnectionStore networkConnectionStore: appMain.networkConnectionStore
appMainVisible: appMain.visible appMainVisible: appMain.visible
swapEnabled: featureFlagsStore.swapEnabled swapEnabled: featureFlagsStore.swapEnabled
@ -1636,7 +1645,6 @@ Item {
store: appMain.rootStore.profileSectionStore store: appMain.rootStore.profileSectionStore
globalStore: appMain.rootStore globalStore: appMain.rootStore
communitiesStore: appMain.communitiesStore communitiesStore: appMain.communitiesStore
sendModalPopup: sendModal
systemPalette: appMain.sysPalette systemPalette: appMain.sysPalette
emojiPopup: statusEmojiPopup.item emojiPopup: statusEmojiPopup.item
networkConnectionStore: appMain.networkConnectionStore networkConnectionStore: appMain.networkConnectionStore
@ -1719,7 +1727,6 @@ Item {
} }
} }
sendModalPopup: sendModal
emojiPopup: statusEmojiPopup.item emojiPopup: statusEmojiPopup.item
stickersPopup: statusStickersPopupLoader.item stickersPopup: statusStickersPopupLoader.item
sectionItemModel: model sectionItemModel: model
@ -1819,104 +1826,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 { Action {
shortcut: "Ctrl+1" shortcut: "Ctrl+1"
onTriggered: { onTriggered: {
@ -2346,8 +2255,10 @@ Item {
sourceComponent: WalletPopups.SavedAddressActivityPopup { sourceComponent: WalletPopups.SavedAddressActivityPopup {
networkConnectionStore: appMain.networkConnectionStore networkConnectionStore: appMain.networkConnectionStore
contactsStore: appMain.rootStore.contactStore contactsStore: appMain.rootStore.contactStore
sendModalPopup: sendModal
onSendToAddressRequested: {
Global.sendToSavedAddressRequested(address)
}
onClosed: { onClosed: {
savedAddressActivity.close() savedAddressActivity.close()
} }

View File

@ -349,8 +349,8 @@ QtObject {
openPopup(importControlNodePopup, { community }) openPopup(importControlNodePopup, { community })
} }
function openTransferOwnershipPopup(communityId, communityName, communityLogo, token, sendModalPopup) { function openTransferOwnershipPopup(communityId, communityName, communityLogo, token) {
openPopup(transferOwnershipPopup, { communityId, communityName, communityLogo, token, sendModalPopup }) openPopup(transferOwnershipPopup, { communityId, communityName, communityLogo, token })
} }
function openConfirmExternalLinkPopup(link, domain) { function openConfirmExternalLinkPopup(link, domain) {
@ -1043,6 +1043,9 @@ QtObject {
Component { Component {
id: transferOwnershipPopup id: transferOwnershipPopup
TransferOwnershipPopup { TransferOwnershipPopup {
onTransferOwnershipRequested: {
Global.transferOwnershipRequested(tokenId, senderAddress)
}
onClosed: destroy() onClosed: destroy()
} }
}, },

View File

@ -0,0 +1,166 @@
import QtQuick 2.15
import StatusQ.Core 0.1
import StatusQ.Core.Utils 0.1 as SQUtils
import AppLayouts.Wallet.stores 1.0 as WalletStores
import shared.popups.send 1.0
import shared.stores.send 1.0
import utils 1.0
QtObject {
id: root
required property var popupParent
required property int loginType
required property TransactionStore transactionStore
required property WalletStores.CollectiblesStore walletCollectiblesStore
// for ens flows
required property string myPublicKey
required property string ensRegisteredAddress
// TODO: This should probably be a property and not a function. Needs changes on backend side
property var getStatusTokenKey: function() {}
// for sticker flows
required property string stickersMarketAddress
required property string stickersNetworkId
Component.onCompleted: {
Global.launchSendRequested.connect(openSend)
Global.connectUsernameRequested.connect(connectUsernameRequested)
Global.registerUsernameRequested.connect(registerUsernameRequested)
Global.releaseUsernameRequested.connect(releaseUsernameRequested)
Global.buyStickerPackRequested.connect(buyStickerPackRequested)
Global.transferOwnershipRequested.connect(transferOwnershipRequested)
Global.sendViaPersonalChatRequested.connect(sendToRecipient)
Global.sendToAccountViaProfileShowcaseRequested.connect(sendToRecipient)
Global.sendToSavedAddressRequested.connect(sendToRecipient)
Global.bridgeTokenRequested.connect(bridgeTokenRequested)
Global.sendTokenRequested.connect(sendTokenRequested)
}
function openSend(params = {}) {
let sendModalInst = sendModalComponent.createObject(popupParent, params)
if (sendModalInst.opened) {
return
}
sendModalInst.open()
}
function connectUsernameRequested(ensName) {
let params = {
preSelectedSendType: Constants.SendType.ENSSetPubKey,
preSelectedHoldingID: Constants.ethToken ,
preSelectedHoldingType: Constants.TokenType.Native,
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0),
preSelectedRecipient: root.ensRegisteredAddress,
interactive: false,
publicKey: root.myPublicKey,
ensName: ensName
}
openSend(params)
}
function registerUsernameRequested(ensName) {
let params = {
preSelectedSendType: Constants.SendType.ENSRegister,
preSelectedHoldingID: root.getStatusTokenKey(),
preSelectedHoldingType: Constants.TokenType.ERC20,
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(10),
preSelectedRecipient: root.ensRegisteredAddress,
interactive: false,
publicKey: root.myPublicKey,
ensName: ensName
}
openSend(params)
}
function releaseUsernameRequested(ensName, senderAddress, chainId) {
let params = {
preSelectedSendType: Constants.SendType.ENSRelease,
preSelectedAccountAddress: senderAddress,
preSelectedHoldingID: Constants.ethToken ,
preSelectedHoldingType: Constants.TokenType.Native,
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(0),
preSelectedChainId: chainId,
preSelectedRecipient: root.ensRegisteredAddress,
interactive: false,
publicKey: root.myPublicKey,
ensName: ensName
}
openSend(params)
}
function buyStickerPackRequested(packId, price) {
let params = {
preSelectedSendType: Constants.SendType.StickersBuy,
preSelectedHoldingID: root.getStatusTokenKey(),
preSelectedHoldingType: Constants.TokenType.ERC20,
preDefinedAmountToSend: LocaleUtils.numberToLocaleString(price),
preSelectedChainId: root.stickersNetworkId,
preSelectedRecipient: root.stickersMarketAddress,
interactive: false,
stickersPackId: packId
}
openSend(params)
}
function transferOwnershipRequested(tokenId, senderAddress) {
let params = {
preSelectedSendType: Constants.SendType.ERC721Transfer,
preSelectedAccountAddress: senderAddress,
preSelectedHoldingID: tokenId,
preSelectedHoldingType: Constants.TokenType.ERC721,
}
openSend(params)
}
function sendToRecipient(recipientAddress) {
let params = {
preSelectedRecipient: recipientAddress
}
openSend(params)
}
function bridgeTokenRequested(tokenId, tokenType) {
let params = {
preSelectedSendType: Constants.SendType.Bridge,
preSelectedHoldingID: tokenId ,
preSelectedHoldingType: tokenType,
onlyAssets: true
}
openSend(params)
}
function sendTokenRequested(senderAddress, tokenId, tokenType) {
let sendType = Constants.SendType.Transfer
if (tokenType === Constants.TokenType.ERC721) {
sendType = Constants.SendType.ERC721Transfer
} else if(tokenType === Constants.TokenType.ERC1155) {
sendType = Constants.SendType.ERC1155Transfer
}
let params = {
preSelectedSendType: sendType,
preSelectedAccountAddress: senderAddress,
preSelectedHoldingID: tokenId ,
preSelectedHoldingType: tokenType,
}
openSend(params)
}
readonly property Component sendModalComponent: Component {
SendModal {
loginType: root.loginType
store: root.transactionStore
collectiblesStore: root.walletCollectiblesStore
showCustomRoutingMode: !production
onClosed: destroy()
}
}
}

View File

@ -34,9 +34,6 @@ QtObject {
required property SharedStores.CommunityTokensStore communityTokensStore required property SharedStores.CommunityTokensStore communityTokensStore
required property ProfileStore profileStore required property ProfileStore profileStore
// Properties:
required property var sendModalPopup
// Utils: // Utils:
readonly property string viewOptimismExplorerText: qsTr("View on Optimism Explorer") readonly property string viewOptimismExplorerText: qsTr("View on Optimism Explorer")
readonly property string checkmarkCircleAssetName: "checkmark-circle" readonly property string checkmarkCircleAssetName: "checkmark-circle"
@ -241,7 +238,7 @@ QtObject {
Global.openFinaliseOwnershipPopup(actionData) Global.openFinaliseOwnershipPopup(actionData)
return return
case ToastsManager.ActionType.OpenSendModalPopup: case ToastsManager.ActionType.OpenSendModalPopup:
root.sendModalPopup.open() Global.launchSendRequested()
return return
case ToastsManager.ActionType.ViewTransactionDetails: case ToastsManager.ActionType.ViewTransactionDetails:
if(actionData) { if(actionData) {

View File

@ -3,3 +3,4 @@ SplashScreen 1.0 SplashScreen.qml
Popups 1.0 Popups.qml Popups 1.0 Popups.qml
StatusTrayIcon 1.0 StatusTrayIcon.qml StatusTrayIcon 1.0 StatusTrayIcon.qml
DropAreaPanel 1.0 panels/DropAreaPanel.qml DropAreaPanel 1.0 panels/DropAreaPanel.qml
SendModalHandler 1.0 SendModalHandler.qml

View File

@ -183,6 +183,20 @@ StatusDialog {
d.routerErrorDetails = "" d.routerErrorDetails = ""
debounceRecalculateRoutesAndFees() 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")
case Constants.SendType.ENSRelease:
return qsTr("Release username")
default: return qsTr("Send")
}
}
} }
LeftJoinModel { LeftJoinModel {
@ -372,7 +386,7 @@ StatusDialog {
objectName: "modalHeader" objectName: "modalHeader"
Layout.maximumWidth: contentWidth Layout.maximumWidth: contentWidth
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
text: d.isBridgeTx ? qsTr("Bridge") : qsTr("Send") text: d.getTitleText()
} }
TokenSelector { TokenSelector {

View File

@ -26,8 +26,6 @@ Item {
property ChatStores.RootStore store property ChatStores.RootStore store
property var stickerPacks: ChatStores.StickerPackData {} property var stickerPacks: ChatStores.StickerPackData {}
required property WalletAssetsStore walletAssetsStore
required property var sendModalPopup
property string packId property string packId
property bool marketVisible property bool marketVisible
property bool isWalletEnabled property bool isWalletEnabled
@ -37,27 +35,7 @@ Item {
signal installClicked(var stickers, string packId, int index) signal installClicked(var stickers, string packId, int index)
signal cancelClicked(string packId) signal cancelClicked(string packId)
signal updateClicked(string packId) signal updateClicked(string packId)
signal buyClicked(string packId) signal buyClicked(string packId, int price)
QtObject {
id: d
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()
}
}
StatusGridView { StatusGridView {
id: availableStickerPacks id: availableStickerPacks
@ -174,10 +152,7 @@ Item {
onUninstallClicked: root.uninstallClicked(packId) onUninstallClicked: root.uninstallClicked(packId)
onCancelClicked: root.cancelClicked(packId) onCancelClicked: root.cancelClicked(packId)
onUpdateClicked: root.updateClicked(packId) onUpdateClicked: root.updateClicked(packId)
onBuyClicked: { onBuyClicked: root.buyClicked(packId, price)
d.runSendModal(price, packId)
root.buyClicked(packId)
}
} }
} }
@ -207,10 +182,7 @@ Item {
onUninstallClicked: root.uninstallClicked(packId) onUninstallClicked: root.uninstallClicked(packId)
onCancelClicked: root.cancelClicked(packId) onCancelClicked: root.cancelClicked(packId)
onUpdateClicked: root.updateClicked(packId) onUpdateClicked: root.updateClicked(packId)
onBuyClicked: { onBuyClicked: root.buyClicked(packId, price)
d.runSendModal(price, packId)
root.buyClicked(packId)
}
} }
} }
} }

View File

@ -5,6 +5,7 @@ import QtGraphicalEffects 1.15
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Core.Utils 0.1 as SQUtils import StatusQ.Core.Utils 0.1 as SQUtils
import StatusQ.Core.Theme 0.1
import utils 1.0 import utils 1.0
import shared 1.0 import shared 1.0
@ -16,17 +17,14 @@ import shared.stores.send 1.0
//TODO remove this dependency! //TODO remove this dependency!
import AppLayouts.Chat.stores 1.0 as ChatStores import AppLayouts.Chat.stores 1.0 as ChatStores
import AppLayouts.Wallet.stores 1.0
// TODO: replace with StatusModal // TODO: replace with StatusModal
ModalPopup { ModalPopup {
id: stickerPackDetailsPopup id: root
property string packId property string packId
property ChatStores.RootStore store property ChatStores.RootStore store
required property WalletAssetsStore walletAssetsStore
required property var sendModalPopup
property string thumbnail: "" property string thumbnail: ""
property string name: "" property string name: ""
property string author: "" property string author: ""
@ -35,7 +33,7 @@ ModalPopup {
property bool bought: false property bool bought: false
property bool pending: false property bool pending: false
property var stickers property var stickers
signal buyClicked(string packId) signal buyClicked()
onAboutToShow: { onAboutToShow: {
stickersModule.getInstalledStickerPacks() stickersModule.getInstalledStickerPacks()
@ -71,7 +69,7 @@ ModalPopup {
model: stickers model: stickers
anchors.fill: parent anchors.fill: parent
anchors.topMargin: Theme.padding anchors.topMargin: Theme.padding
packId: stickerPackDetailsPopup.packId packId: root.packId
} }
footer: StatusStickerButton { footer: StatusStickerButton {
@ -85,29 +83,14 @@ ModalPopup {
tooltip.text: store.networkConnectionStore.stickersNetworkUnavailableText tooltip.text: store.networkConnectionStore.stickersNetworkUnavailableText
onInstallClicked: { onInstallClicked: {
stickersModule.install(packId) stickersModule.install(packId)
stickerPackDetailsPopup.close() root.close()
} }
onUninstallClicked: { onUninstallClicked: {
stickersModule.uninstall(packId); stickersModule.uninstall(packId);
stickerPackDetailsPopup.close(); root.close();
} }
onCancelClicked: function(){} onCancelClicked: function(){}
onUpdateClicked: function(){} onUpdateClicked: function(){}
onBuyClicked: { onBuyClicked: root.buyClicked()
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()
stickerPackDetailsPopup.buyClicked(stickerPackDetailsPopup.packId)
}
} }
} }

View File

@ -13,18 +13,16 @@ import StatusQ.Controls 0.1
import StatusQ.Components 0.1 import StatusQ.Components 0.1
//TODO improve this! //TODO improve this!
import AppLayouts.Chat.stores 1.0 as ChatStores import AppLayouts.Chat.stores 1.0 as ChatStores
import AppLayouts.Wallet.stores 1.0
Popup { Popup {
id: root id: root
property ChatStores.RootStore store property ChatStores.RootStore store
required property WalletAssetsStore walletAssetsStore
required property var sendModalPopup
property alias isWalletEnabled: stickerMarket.isWalletEnabled property alias isWalletEnabled: stickerMarket.isWalletEnabled
signal stickerSelected(string hashId, string packId, string url) signal stickerSelected(string hashId, string packId, string url)
signal buyClicked(string packId, string price)
QtObject { QtObject {
id: d id: d
@ -102,8 +100,6 @@ Popup {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
store: root.store store: root.store
walletAssetsStore: root.walletAssetsStore
sendModalPopup: root.sendModalPopup
stickerPacks: d.stickerPackList stickerPacks: d.stickerPackList
packId: stickerPackListView.selectedPackId packId: stickerPackListView.selectedPackId
marketVisible: d.stickerPacksLoaded && d.online marketVisible: d.stickerPacksLoaded && d.online
@ -121,6 +117,7 @@ Popup {
footerContent.visible = true footerContent.visible = true
stickersContainer.visible = true stickersContainer.visible = true
} }
onBuyClicked: root.buyClicked(packId, price)
Connections { Connections {
target: root.store.stickersModuleInst target: root.store.stickersModuleInst

View File

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

View File

@ -541,6 +541,9 @@ Pane {
onCloseRequested: root.closeRequested() onCloseRequested: root.closeRequested()
onCopyToClipboard: ClipboardUtils.setText(text) onCopyToClipboard: ClipboardUtils.setText(text)
onSendToAccountRequested: {
Global.sendToAccountViaProfileShowcaseRequested(recipientAddress)
}
} }
} }
} }

View File

@ -10,6 +10,7 @@ import shared.popups 1.0
import shared.views.chat 1.0 import shared.views.chat 1.0
import shared.controls.chat 1.0 import shared.controls.chat 1.0
import shared.stores 1.0 as SharedStores import shared.stores 1.0 as SharedStores
import shared.popups.send 1.0
import StatusQ 0.1 import StatusQ 0.1
import StatusQ.Core 0.1 import StatusQ.Core 0.1
@ -240,6 +241,7 @@ Loader {
} }
signal openStickerPackPopup(string stickerPackId) signal openStickerPackPopup(string stickerPackId)
signal sendViaPersonalChatRequested(string recipientAddress)
z: (typeof chatLogView === "undefined") ? 1 : (chatLogView.count - index) z: (typeof chatLogView === "undefined") ? 1 : (chatLogView.count - index)
@ -759,7 +761,7 @@ Loader {
onLinkActivated: { onLinkActivated: {
if (link.startsWith(Constants.sendViaChatPrefix)) { if (link.startsWith(Constants.sendViaChatPrefix)) {
const addressOrEns = link.replace(Constants.sendViaChatPrefix, ""); const addressOrEns = link.replace(Constants.sendViaChatPrefix, "");
Global.openSendModal(addressOrEns) root.sendViaPersonalChatRequested(addressOrEns)
return return
} }
if (link.startsWith('//')) { if (link.startsWith('//')) {

View File

@ -25,6 +25,7 @@ Item {
property alias cellHeight: accountsView.cellHeight property alias cellHeight: accountsView.cellHeight
signal copyToClipboard(string text) signal copyToClipboard(string text)
signal sendToAccountRequested(string recipientAddress)
StatusBaseText { StatusBaseText {
anchors.centerIn: parent anchors.centerIn: parent
@ -68,9 +69,7 @@ Item {
icon.name: "send" icon.name: "send"
icon.color: !hovered ? Theme.palette.baseColor1 : Theme.palette.directColor1 icon.color: !hovered ? Theme.palette.baseColor1 : Theme.palette.directColor1
enabled: root.sendToAccountEnabled enabled: root.sendToAccountEnabled
onClicked: { onClicked: root.sendToAccountRequested(model.address)
Global.openSendModal(model.address)
}
onHoveredChanged: accountInfoDelegate.highlight = hovered onHoveredChanged: accountInfoDelegate.highlight = hovered
} }
StatusFlatRoundButton { StatusFlatRoundButton {

View File

@ -41,6 +41,7 @@ Control {
signal closeRequested() signal closeRequested()
signal copyToClipboard(string text) signal copyToClipboard(string text)
signal sendToAccountRequested(string recipientAddress)
horizontalPadding: readOnly ? 20 : 40 // smaller in settings/preview horizontalPadding: readOnly ? 20 : 40 // smaller in settings/preview
topPadding: Theme.bigPadding topPadding: Theme.bigPadding
@ -155,6 +156,7 @@ Control {
cellHeight: d.delegateHeightM cellHeight: d.delegateHeightM
onCopyToClipboard: root.copyToClipboard(text) onCopyToClipboard: root.copyToClipboard(text)
onSendToAccountRequested: root.sendToAccountRequested(recipientAddress)
} }
ProfileShowcaseCollectiblesView { ProfileShowcaseCollectiblesView {

View File

@ -50,8 +50,7 @@ QtObject {
signal openTransferOwnershipPopup(string communityId, signal openTransferOwnershipPopup(string communityId,
string communityName, string communityName,
string communityLogo, string communityLogo,
var token, var token)
var sendModalPopup)
signal openFinaliseOwnershipPopup(string communityId) signal openFinaliseOwnershipPopup(string communityId)
signal openDeclineOwnershipPopup(string communityId, string communityName) signal openDeclineOwnershipPopup(string communityId, string communityName)
signal openFirstTokenReceivedPopup(string communityId, signal openFirstTokenReceivedPopup(string communityId,
@ -72,7 +71,6 @@ QtObject {
signal setNthEnabledSectionActive(int nthSection) signal setNthEnabledSectionActive(int nthSection)
signal appSectionBySectionTypeChanged(int sectionType, int subsection, int subSubsection, var data) signal appSectionBySectionTypeChanged(int sectionType, int subsection, int subSubsection, var data)
signal openSendModal(string address)
signal switchToCommunity(string communityId) signal switchToCommunity(string communityId)
signal switchToCommunitySettings(string communityId) signal switchToCommunitySettings(string communityId)
signal switchToCommunityChannelsView(string communityId) signal switchToCommunityChannelsView(string communityId)
@ -108,6 +106,19 @@ QtObject {
signal openSavedAddressActivityPopup(var params) signal openSavedAddressActivityPopup(var params)
signal openCommunityMemberMessagesPopupRequested(var store, var chatCommunitySectionModule, var memberPubKey, var displayName) signal openCommunityMemberMessagesPopupRequested(var store, var chatCommunitySectionModule, var memberPubKey, var displayName)
// Intent based launch send modal signals
signal launchSendRequested()
signal connectUsernameRequested(string ensName)
signal registerUsernameRequested(string ensName)
signal releaseUsernameRequested(string ensName, string senderAddress, int chainId)
signal buyStickerPackRequested(string packId, int price)
signal transferOwnershipRequested(string tokenId, string senderAddress)
signal sendViaPersonalChatRequested(string recipientAddress)
signal sendToAccountViaProfileShowcaseRequested(string recipientAddress)
signal sendToSavedAddressRequested(string address)
signal bridgeTokenRequested(string tokenId, int tokenType)
signal sendTokenRequested(string senderAddress, string tokenId, int tokenType)
function openProfilePopup(publicKey, parentPopup, cb) { function openProfilePopup(publicKey, parentPopup, cb) {
root.openProfilePopupRequested(publicKey, parentPopup, cb) root.openProfilePopupRequested(publicKey, parentPopup, cb)
} }