chore(SendModal): Use accountAddress to preselect the account instead of account model item
Updating the SendModal to receive an accountAddress to preselect the account instead of the account item model to squash: Fix account selection. by address
This commit is contained in:
parent
663fd91425
commit
7926d1f748
|
@ -197,7 +197,7 @@ SplitView {
|
|||
closePolicy: Popup.NoAutoClose
|
||||
onlyAssets: loader.onlyAssets
|
||||
store: txStore
|
||||
preSelectedAccount: loader.preSelectedAccount
|
||||
preSelectedAccountAddress: loader.preSelectedAccount.address
|
||||
preDefinedAmountToSend: loader.preDefinedAmountToSend
|
||||
preSelectedRecipient: loader.preSelectedRecipient
|
||||
preSelectedSendType: loader.preSelectedSendType
|
||||
|
|
|
@ -441,7 +441,7 @@ StatusSectionLayout {
|
|||
y: (Math.abs(browserHeader.mapFromGlobal(headerPoint).y) +
|
||||
browserHeader.anchors.topMargin + Style.current.halfPadding)
|
||||
onSendTriggered: {
|
||||
sendTransactionModal.preSelectedAccount = selectedAccount
|
||||
sendTransactionModal.preSelectedAccountAddress = selectedAccount.address
|
||||
sendTransactionModal.open()
|
||||
}
|
||||
onReload: {
|
||||
|
|
|
@ -761,7 +761,6 @@ StackView {
|
|||
root.communityName,
|
||||
root.communityLogo,
|
||||
tokenViewPage.token,
|
||||
root.accounts,
|
||||
root.sendModalPopup)
|
||||
|
||||
// helper properties to pass data through popups
|
||||
|
|
|
@ -47,7 +47,6 @@ StackLayout {
|
|||
property bool isControlNode: false
|
||||
property int loginType: Constants.LoginType.Password
|
||||
property bool communitySettingsDisabled
|
||||
property var accounts // Wallet accounts model. Expected roles: address, name, color, emoji, walletType
|
||||
property var ownerToken: null
|
||||
|
||||
property string overviewChartData: ""
|
||||
|
@ -137,7 +136,6 @@ StackLayout {
|
|||
root.name,
|
||||
root.logoImageData,
|
||||
root.ownerToken,
|
||||
root.accounts,
|
||||
root.sendModalPopup)
|
||||
} else {
|
||||
Global.openPopup(transferOwnershipAlertPopup, { mode: TransferOwnershipAlertPopup.Mode.TransferOwnership })
|
||||
|
|
|
@ -27,7 +27,6 @@ StatusDialog {
|
|||
|
||||
// Transaction related props:
|
||||
property var token // Expected roles: accountAddress, key, chainId, name, artworkSource
|
||||
property var accounts
|
||||
property var sendModalPopup
|
||||
|
||||
signal cancelClicked
|
||||
|
@ -112,7 +111,7 @@ StatusDialog {
|
|||
onClicked: {
|
||||
// Pre-populated dialog with the relevant Owner token info:
|
||||
root.sendModalPopup.preSelectedSendType = Constants.SendType.ERC721Transfer
|
||||
root.sendModalPopup.preSelectedAccount = ModelUtils.getByKey(root.accounts, "address", token.accountAddress)
|
||||
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
|
||||
|
|
|
@ -198,7 +198,6 @@ StatusSectionLayout {
|
|||
|
||||
sendModalPopup: root.sendModalPopup
|
||||
ownerToken: tokensModelChangesTracker.ownerToken
|
||||
accounts: root.walletAccountsModel
|
||||
|
||||
isPendingOwnershipRequest: root.isPendingOwnershipRequest
|
||||
|
||||
|
|
|
@ -300,20 +300,21 @@ Item {
|
|||
})
|
||||
onLaunchSendModal: {
|
||||
if(isCommunityOwnershipTransfer) {
|
||||
let tokenItem = walletStore.currentViewedCollectible
|
||||
Global.openTransferOwnershipPopup(walletStore.currentViewedCollectible.communityId,
|
||||
const tokenItem = walletStore.currentViewedCollectible
|
||||
const ownership = StatusQUtils.ModelUtils.get(tokenItem.ownership, 0)
|
||||
|
||||
Global.openTransferOwnershipPopup(tokenItem.communityId,
|
||||
tokenItem.communityName,
|
||||
tokenItem.communityImage,
|
||||
{
|
||||
"key": walletStore.currentViewedHoldingID,
|
||||
"key": tokenItem.tokenId,
|
||||
"privilegesLevel": tokenItem.communityPrivilegesLevel,
|
||||
"chainId": tokenItem.chainId,
|
||||
"name": tokenItem.name,
|
||||
"artworkSource": tokenItem.artworkSource,
|
||||
"accountAddress": leftTab.currentAddress,
|
||||
"accountAddress": ownership.accountAddress,
|
||||
"tokenAddress": tokenItem.contractAddress
|
||||
},
|
||||
walletStore.accounts,
|
||||
root.sendModalPopup)
|
||||
} else {
|
||||
// Common send modal popup:
|
||||
|
|
|
@ -782,7 +782,7 @@ Item {
|
|||
tx.isNFT,
|
||||
tx.amount)
|
||||
|
||||
root.sendModal.preSelectedAccount = req.preSelectedAccount
|
||||
root.sendModal.preSelectedAccountAddress = req.preSelectedAccount.address
|
||||
root.sendModal.preSelectedRecipient = req.preSelectedRecipient
|
||||
root.sendModal.preSelectedRecipientType = req.preSelectedRecipientType
|
||||
root.sendModal.preSelectedHoldingID = req.preSelectedHoldingID
|
||||
|
|
|
@ -1511,7 +1511,7 @@ Item {
|
|||
this.active = false
|
||||
}
|
||||
|
||||
property var preSelectedAccount
|
||||
property string preSelectedAccountAddress
|
||||
property var preSelectedRecipient
|
||||
property int preSelectedRecipientType
|
||||
property string preSelectedHoldingID
|
||||
|
@ -1533,14 +1533,14 @@ Item {
|
|||
sendModal.preSelectedSendType = Constants.SendType.Unknown
|
||||
sendModal.preSelectedHoldingID = ""
|
||||
sendModal.preSelectedHoldingType = Constants.TokenType.Unknown
|
||||
sendModal.preSelectedAccount = undefined
|
||||
sendModal.preSelectedAccountAddress = ""
|
||||
sendModal.preSelectedRecipient = undefined
|
||||
sendModal.preDefinedAmountToSend = ""
|
||||
}
|
||||
}
|
||||
onLoaded: {
|
||||
if (!!sendModal.preSelectedAccount) {
|
||||
item.preSelectedAccount = sendModal.preSelectedAccount
|
||||
if (!!sendModal.preSelectedAccountAddress) {
|
||||
item.preSelectedAccountAddress = sendModal.preSelectedAccountAddress
|
||||
}
|
||||
if (!!sendModal.preSelectedRecipient) {
|
||||
item.preSelectedRecipient = sendModal.preSelectedRecipient
|
||||
|
|
|
@ -345,8 +345,8 @@ QtObject {
|
|||
openPopup(importControlNodePopup, { community })
|
||||
}
|
||||
|
||||
function openTransferOwnershipPopup(communityId, communityName, communityLogo, token, accounts, sendModalPopup) {
|
||||
openPopup(transferOwnershipPopup, { communityId, communityName, communityLogo, token, accounts, sendModalPopup })
|
||||
function openTransferOwnershipPopup(communityId, communityName, communityLogo, token, sendModalPopup) {
|
||||
openPopup(transferOwnershipPopup, { communityId, communityName, communityLogo, token, sendModalPopup })
|
||||
}
|
||||
|
||||
function openConfirmExternalLinkPopup(link, domain) {
|
||||
|
|
|
@ -33,7 +33,7 @@ import "./views"
|
|||
StatusDialog {
|
||||
id: popup
|
||||
|
||||
property var preSelectedAccount: selectedAccount
|
||||
property string preSelectedAccountAddress: store.selectedSenderAccountAddress
|
||||
|
||||
// Recipient properties definition
|
||||
property alias preSelectedRecipient: recipientInputLoader.selectedRecipient
|
||||
|
@ -64,7 +64,7 @@ StatusDialog {
|
|||
}
|
||||
|
||||
// In case selected address is incorrect take first account from the list
|
||||
readonly property var selectedAccount: selectedSenderAccountEntry.item ?? SQUtils.ModelUtils.get(store.accounts, 0)
|
||||
readonly property alias selectedAccount: selectedSenderAccountEntry.item
|
||||
|
||||
property var sendTransaction: function() {
|
||||
d.isPendingTx = true
|
||||
|
@ -72,7 +72,7 @@ StatusDialog {
|
|||
}
|
||||
|
||||
property var recalculateRoutesAndFees: Backpressure.debounce(popup, 600, function() {
|
||||
if(!!popup.preSelectedAccount && !!holdingSelector.selectedItem
|
||||
if(!!popup.selectedAccount && !!popup.selectedAccount.address && !!holdingSelector.selectedItem
|
||||
&& recipientInputLoader.ready && (amountToSend.ready || d.isCollectiblesTransfer)) {
|
||||
popup.isLoading = true
|
||||
popup.store.suggestedRoutes(d.isCollectiblesTransfer ? "1" : amountToSend.amount)
|
||||
|
@ -215,8 +215,8 @@ StatusDialog {
|
|||
holdingSelector.selectedItem = entry
|
||||
} else {
|
||||
const entry = SQUtils.ModelUtils.getByKey(
|
||||
popup.store.collectiblesModel,
|
||||
"uid", popup.preSelectedHoldingID)
|
||||
popup.collectiblesStore.allCollectiblesModel,
|
||||
"symbol", popup.preSelectedHoldingID)
|
||||
|
||||
d.selectedHoldingType = entry.tokenType
|
||||
d.selectedHolding = entry
|
||||
|
@ -275,7 +275,7 @@ StatusDialog {
|
|||
}
|
||||
]
|
||||
}
|
||||
selectedAddress: !!popup.preSelectedAccount && !!popup.preSelectedAccount.address ? popup.preSelectedAccount.address : ""
|
||||
selectedAddress: popup.preSelectedAccountAddress
|
||||
onCurrentAccountAddressChanged: {
|
||||
store.setSenderAccount(currentAccountAddress)
|
||||
|
||||
|
@ -348,7 +348,7 @@ StatusDialog {
|
|||
|
||||
flatNetworksModel: popup.store.flatNetworksModel
|
||||
currentCurrency: popup.store.currencyStore.currentCurrency
|
||||
accountAddress: popup.preSelectedAccount ? popup.preSelectedAccount.address : ""
|
||||
accountAddress: popup.selectedAccount.address
|
||||
showCommunityAssets: popup.store.tokensStore.showCommunityAssetsInSend
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@ StatusDialog {
|
|||
active: !d.isBridgeTx
|
||||
|
||||
sourceComponent: CollectiblesSelectionAdaptor {
|
||||
accountKey: popup.preSelectedAccount ? popup.preSelectedAccount.address : ""
|
||||
accountKey: popup.selectedAccount.address
|
||||
|
||||
collectiblesModel: SortFilterProxyModel {
|
||||
sourceModel: collectiblesStore ? collectiblesStore.jointCollectiblesBySymbolModel : null
|
||||
|
@ -568,14 +568,14 @@ StatusDialog {
|
|||
}
|
||||
|
||||
// Only request transactions history update if visually needed:
|
||||
onRecentRecipientsTabSelected: popup.store.updateRecentRecipientsActivity(popup.preSelectedAccount)
|
||||
onRecentRecipientsTabSelected: popup.store.updateRecentRecipientsActivity(popup.selectedAccount.address)
|
||||
|
||||
Connections {
|
||||
target: popup
|
||||
function onPreSelectedAccountChanged() {
|
||||
function onSelectedAccountChanged() {
|
||||
// Only request transactions history update if visually needed:
|
||||
if(recipientsPanel.recentRecipientsTabVisible) {
|
||||
popup.store.updateRecentRecipientsActivity(popup.preSelectedAccount)
|
||||
popup.store.updateRecentRecipientsActivity(popup.selectedAccount.address)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,9 +184,9 @@ QtObject {
|
|||
return currencyStore.formatCurrencyAmountFromBigInt(balance, symbol, decimals, options)
|
||||
}
|
||||
|
||||
function updateRecentRecipientsActivity(walletAccount) {
|
||||
if(walletAccount && walletAccount.address) {
|
||||
_tmpActivityController1.setFilterAddressesJson(JSON.stringify([walletAccount.address]),
|
||||
function updateRecentRecipientsActivity(accountAddress) {
|
||||
if(!!accountAddress) {
|
||||
_tmpActivityController1.setFilterAddressesJson(JSON.stringify([accountAddress]),
|
||||
false)
|
||||
}
|
||||
_tmpActivityController1.updateFilter()
|
||||
|
|
|
@ -64,7 +64,6 @@ QtObject {
|
|||
string communityName,
|
||||
string communityLogo,
|
||||
var token,
|
||||
var accounts,
|
||||
var sendModalPopup)
|
||||
signal openFinaliseOwnershipPopup(string communityId)
|
||||
signal openDeclineOwnershipPopup(string communityId, string communityName)
|
||||
|
|
Loading…
Reference in New Issue