mirror of
https://github.com/lil-org/tokenary.git
synced 2024-12-04 05:05:10 +03:00
Select only one account for each network
This commit is contained in:
parent
3ad698c842
commit
b2dae33adc
@ -554,13 +554,18 @@ extension AccountsListViewController: NSTableViewDelegate {
|
||||
if accountSelectionConfiguration != nil {
|
||||
let specificWalletAccount = SpecificWalletAccount(walletId: wallet.id, account: account)
|
||||
let wasSelected = selectedAccounts.contains(specificWalletAccount)
|
||||
(tableView.rowView(atRow: row, makeIfNecessary: false) as? AccountCellView)?.setSelected(!wasSelected)
|
||||
|
||||
if !wasSelected, let toDeselect = selectedAccounts.first(where: { $0.account.coin == account.coin }) {
|
||||
selectedAccounts.remove(toDeselect)
|
||||
}
|
||||
|
||||
if wasSelected {
|
||||
selectedAccounts.remove(specificWalletAccount)
|
||||
} else {
|
||||
selectedAccounts.insert(specificWalletAccount)
|
||||
}
|
||||
// TODO: select only one account for each network
|
||||
|
||||
tableView.reloadData()
|
||||
return false
|
||||
} else {
|
||||
showMenuOnCellSelection(row: row)
|
||||
|
@ -26,7 +26,7 @@ class AccountCellView: NSTableRowView {
|
||||
setSelected(isSelected)
|
||||
}
|
||||
|
||||
func setSelected(_ selected: Bool) {
|
||||
private func setSelected(_ selected: Bool) {
|
||||
layer?.backgroundColor = (selected ? NSColor.selectedContentBackgroundColor : NSColor.clear).cgColor
|
||||
addressTextField.textColor = selected ? NSColor.selectedMenuItemTextColor : NSColor.labelColor
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user