Skip to content

Commit

Permalink
[trello.com/c/Q5t2dsq4] fix: update the wallet visibility status in t…
Browse files Browse the repository at this point in the history
…he search mode
  • Loading branch information
StanislavDevIOS committed Jun 12, 2023
1 parent 6ec4234 commit 0ca7474
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class VisibleWalletsTableViewCell: UITableViewCell {
set { checkmarkRowView.balance = newValue }
}

var unicId: String?

required override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
setupView()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ extension VisibleWalletsViewController: UITableViewDataSource, UITableViewDelega
cell.balance = wallet.wallet?.balance
cell.delegate = self
cell.isChecked = !isInvisible(wallet)
cell.unicId = wallet.tokenUnicID

return cell
}
Expand Down Expand Up @@ -292,11 +293,16 @@ extension VisibleWalletsViewController: UITableViewDataSource, UITableViewDelega

// MARK: - AdamantVisibleWalletsCellDelegate
extension VisibleWalletsViewController: AdamantVisibleWalletsCellDelegate {
func delegateCell(_ cell: VisibleWalletsTableViewCell, didChangeCheckedStateTo state: Bool) {
guard let indexPath = tableView.indexPath(for: cell) else {
return
}
let wallet = wallets[indexPath.row]
func delegateCell(
_ cell: VisibleWalletsTableViewCell,
didChangeCheckedStateTo state: Bool
) {
let wallet = wallets.first(where: {
$0.tokenUnicID == cell.unicId
})

guard let wallet = wallet else { return }

if !isInvisible(wallet) {
visibleWalletsService.addToInvisibleWallets(wallet)
} else {
Expand Down

0 comments on commit 0ca7474

Please sign in to comment.