Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[trello.com/c/ciHCs1De]: fix not updating row height after balance change #634

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions Adamant/Modules/Wallets/WalletViewControllerBase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class WalletViewControllerBase: FormViewController, WalletViewController {

// MARK: Balance
let balanceRow = BalanceRow { [weak self] in
$0.cell.accessoryType = .disclosureIndicator
$0.tag = BaseRows.balance.tag
$0.cell.titleLabel.text = BaseRows.balance.localized

Expand All @@ -134,29 +135,13 @@ class WalletViewControllerBase: FormViewController, WalletViewController {
alert: self?.service?.core.wallet?.notifications,
isBalanceInitialized: self?.service?.core.wallet?.isBalanceInitialized ?? false
)

let height = $0.value?.fiat != nil ? BalanceTableViewCell.fullHeight : BalanceTableViewCell.compactHeight

$0.cell.height = { height }
}.cellUpdate { [weak self] (cell, row) in
let symbol = self?.service?.core.tokenSymbol ?? ""

row.value = self?.balanceRowValueFor(
balance: self?.service?.core.wallet?.balance ?? 0,
symbol: symbol,
alert: self?.service?.core.wallet?.notifications,
isBalanceInitialized: self?.service?.core.wallet?.isBalanceInitialized ?? false
)

let height = row.value?.fiat != nil ? BalanceTableViewCell.fullHeight : BalanceTableViewCell.compactHeight

cell.height = { height }
cell.titleLabel.text = BaseRows.balance.localized
ChrisBenua marked this conversation as resolved.
Show resolved Hide resolved

let row = $0
$0.cell.height = { row.value?.fiat != nil ? BalanceTableViewCell.fullHeight : BalanceTableViewCell.compactHeight }
}

balanceRow.cell.selectionStyle = .gray
balanceRow.cellUpdate { (cell, _) in
cell.accessoryType = .disclosureIndicator
cell.titleLabel.text = BaseRows.balance.localized
ChrisBenua marked this conversation as resolved.
Show resolved Hide resolved
}.onCellSelection { [weak self] (_, _) in
guard
Expand Down Expand Up @@ -488,6 +473,7 @@ private extension WalletViewControllerBase {
isBalanceInitialized: wallet.isBalanceInitialized
)
row.updateCell()
row.reload()
}

func makeNodesList() -> UIViewController {
Expand Down