fix(shared addresses) wallet address selection broken
compare the addresses to share in a case insensitive manner Fixes #12152
This commit is contained in:
parent
720f6884b8
commit
20182b0d75
|
@ -62,12 +62,13 @@ SplitView {
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding on selectedAirdropAddress {
|
Binding on selectedAirdropAddress {
|
||||||
value: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881"
|
value: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884"
|
||||||
when: ctrlEditMode.checked
|
when: ctrlEditMode.checked
|
||||||
}
|
}
|
||||||
|
|
||||||
onShareSelectedAddressesClicked: logs.logEvent("::shareSelectedAddressesClicked", ["airdropAddress", "sharedAddresses"], arguments)
|
onShareSelectedAddressesClicked: logs.logEvent("::shareSelectedAddressesClicked", ["airdropAddress", "sharedAddresses"], arguments)
|
||||||
onSaveSelectedAddressesClicked: logs.logEvent("::saveSelectedAddressesClicked", ["airdropAddress", "sharedAddresses"], arguments)
|
onSaveSelectedAddressesClicked: logs.logEvent("::saveSelectedAddressesClicked", ["airdropAddress", "sharedAddresses"], arguments)
|
||||||
|
onSharedAddressesChanged: logs.logEvent("::sharedAddressesChanged", ["airdropAddress", "sharedAddresses"], arguments)
|
||||||
onClosed: destroy()
|
onClosed: destroy()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ StatusListView {
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
font.pixelSize: Theme.tertiaryTextFontSize
|
font.pixelSize: Theme.tertiaryTextFontSize
|
||||||
text: LocaleUtils.currencyAmountToLocaleString(enabledNetworkBalance)
|
text: LocaleUtils.currencyAmountToLocaleString(model.enabledNetworkBalance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ StatusListView {
|
||||||
icon.color: hovered ? Theme.palette.primaryColor3 :
|
icon.color: hovered ? Theme.palette.primaryColor3 :
|
||||||
checked ? Theme.palette.primaryColor1 : disabledTextColor
|
checked ? Theme.palette.primaryColor1 : disabledTextColor
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: listItem.address === root.selectedAirdropAddress
|
checked: listItem.address === root.selectedAirdropAddress.toLowerCase()
|
||||||
enabled: shareAddressCheckbox.checked && root.selectedSharedAddresses.length > 1 // last cannot be unchecked
|
enabled: shareAddressCheckbox.checked && root.selectedSharedAddresses.length > 1 // last cannot be unchecked
|
||||||
visible: shareAddressCheckbox.checked
|
visible: shareAddressCheckbox.checked
|
||||||
opacity: enabled ? 1.0 : 0.3
|
opacity: enabled ? 1.0 : 0.3
|
||||||
|
@ -123,11 +123,11 @@ StatusListView {
|
||||||
ButtonGroup.group: d.addressesGroup
|
ButtonGroup.group: d.addressesGroup
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: root.selectedSharedAddresses.includes(listItem.address)
|
checked: root.selectedSharedAddresses.some((address) => address.toLowerCase() === listItem.address )
|
||||||
enabled: !(root.selectedSharedAddresses.length === 1 && checked) // last cannot be unchecked
|
enabled: !(root.selectedSharedAddresses.length === 1 && checked) // last cannot be unchecked
|
||||||
onToggled: {
|
onToggled: {
|
||||||
// handle selected addresses
|
// handle selected addresses
|
||||||
const index = root.selectedSharedAddresses.indexOf(listItem.address)
|
const index = root.selectedSharedAddresses.findIndex((address) => address.toLowerCase() === listItem.address)
|
||||||
const selectedSharedAddressesCopy = Object.assign([], root.selectedSharedAddresses) // deep copy
|
const selectedSharedAddressesCopy = Object.assign([], root.selectedSharedAddresses) // deep copy
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
selectedSharedAddressesCopy.push(listItem.address)
|
selectedSharedAddressesCopy.push(listItem.address)
|
||||||
|
@ -137,7 +137,7 @@ StatusListView {
|
||||||
root.selectedSharedAddresses = selectedSharedAddressesCopy
|
root.selectedSharedAddresses = selectedSharedAddressesCopy
|
||||||
|
|
||||||
// switch to next available airdrop address when unchecking
|
// switch to next available airdrop address when unchecking
|
||||||
if (!checked && listItem.address === root.selectedAirdropAddress) {
|
if (!checked && listItem.address === root.selectedAirdropAddress.toLowerCase()) {
|
||||||
d.selectFirstAvailableAirdropAddress()
|
d.selectFirstAvailableAirdropAddress()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue