diff --git a/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 9a0f5567..48c8b884 100644 --- a/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Kukai Mobile.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -70,7 +70,7 @@ "location" : "https://github.com/kukai-wallet/kukai-core-swift", "state" : { "branch" : "develop", - "revision" : "2935cd7930f1ca7a32bdacbfb26ef832d56d1f91" + "revision" : "ce9be84d54254ac954b36b4258481d83af0de496" } }, { diff --git a/Kukai Mobile/Modules/Account/AccountViewController.swift b/Kukai Mobile/Modules/Account/AccountViewController.swift index 087e9cbc..c14d9cb8 100644 --- a/Kukai Mobile/Modules/Account/AccountViewController.swift +++ b/Kukai Mobile/Modules/Account/AccountViewController.swift @@ -6,6 +6,7 @@ // import UIKit +import KukaiCoreSwift import Combine class AccountViewController: UIViewController, UITableViewDelegate, EstimatedTotalCellDelegate { @@ -85,6 +86,21 @@ class AccountViewController: UIViewController, UITableViewDelegate, EstimatedTot } } + func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { + guard let token = viewModel.token(atIndexPath: indexPath), let c = cell as? TokenBalanceCell else { + return + } + + if token.isXTZ() { + c.iconView.image = UIImage.tezosToken().resizedImage(size: CGSize(width: 50, height: 50)) + } else { + c.iconView.backgroundColor = .colorNamed("BG4") + MediaProxyService.load(url: token.thumbnailURL, to: c.iconView, withCacheType: .permanent, fallback: UIImage.unknownToken()) { res in + c.iconView.backgroundColor = .white + } + } + } + func tableView(_ tableView: UITableView, didEndDisplaying cell: UITableViewCell, forRowAt indexPath: IndexPath) { guard let cell = cell as? UITableViewCellImageDownloading else { return diff --git a/Kukai Mobile/Modules/Account/AccountViewModel.swift b/Kukai Mobile/Modules/Account/AccountViewModel.swift index 664138ad..d28090b7 100644 --- a/Kukai Mobile/Modules/Account/AccountViewModel.swift +++ b/Kukai Mobile/Modules/Account/AccountViewModel.swift @@ -118,7 +118,6 @@ class AccountViewModel: ViewModel, UITableViewDiffableDataSourceHandler { return cell } else if let amount = item as? XTZAmount, let cell = tableView.dequeueReusableCell(withIdentifier: "TokenBalanceCell", for: indexPath) as? TokenBalanceCell { - cell.iconView.image = UIImage.tezosToken().resizedImage(size: CGSize(width: 50, height: 50)) cell.symbolLabel.text = "XTZ" cell.balanceLabel.text = DependencyManager.shared.coinGeckoService.formatLargeTokenDisplay(amount.toNormalisedDecimal() ?? 0, decimalPlaces: amount.decimalPlaces) cell.favCorner.isHidden = false @@ -136,12 +135,6 @@ class AccountViewModel: ViewModel, UITableViewDiffableDataSourceHandler { } cell.favCorner.isHidden = !token.isFavourite - - cell.iconView.backgroundColor = .colorNamed("BG4") - MediaProxyService.load(url: token.thumbnailURL, to: cell.iconView, withCacheType: .permanent, fallback: UIImage.unknownToken()) { res in - cell.iconView.backgroundColor = .white - } - cell.symbolLabel.text = symbol cell.balanceLabel.text = DependencyManager.shared.coinGeckoService.formatLargeTokenDisplay(token.balance.toNormalisedDecimal() ?? 0, decimalPlaces: token.decimalPlaces) // cell.setPriceChange(value: Decimal(Int.random(in: -100..<100))) // Will be re-added when we have the actual values @@ -364,7 +357,7 @@ class AccountViewModel: ViewModel, UITableViewDiffableDataSourceHandler { let obj = dataSource?.itemIdentifier(for: atIndexPath) if obj is XTZAmount { - let account = DependencyManager.shared.balanceService.account + let account = DependencyManager.shared.balanceService.account return Token.xtz(withAmount: account.xtzBalance, stakedAmount: account.xtzStakedBalance, unstakedAmount: account.xtzUnstakedBalance) } else if obj is Token { diff --git a/Kukai Mobile/Modules/Account/Cells/TokenDetailsBalanceAndBakerCell_baker.xib b/Kukai Mobile/Modules/Account/Cells/TokenDetailsBalanceAndBakerCell_baker.xib index ed16dca0..7d7b351d 100644 --- a/Kukai Mobile/Modules/Account/Cells/TokenDetailsBalanceAndBakerCell_baker.xib +++ b/Kukai Mobile/Modules/Account/Cells/TokenDetailsBalanceAndBakerCell_baker.xib @@ -26,33 +26,34 @@