Skip to content

Commit

Permalink
Merge branch 'feature/pre-release' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmcl committed Jul 30, 2024
2 parents c889c74 + a6fcec5 commit 6f545c3
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"location" : "https://github.com/kukai-wallet/kukai-core-swift",
"state" : {
"branch" : "develop",
"revision" : "2935cd7930f1ca7a32bdacbfb26ef832d56d1f91"
"revision" : "ce9be84d54254ac954b36b4258481d83af0de496"
}
},
{
Expand Down
16 changes: 16 additions & 0 deletions Kukai Mobile/Modules/Account/AccountViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import UIKit
import KukaiCoreSwift
import Combine

class AccountViewController: UIViewController, UITableViewDelegate, EstimatedTotalCellDelegate {
Expand Down Expand Up @@ -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
Expand Down
9 changes: 1 addition & 8 deletions Kukai Mobile/Modules/Account/AccountViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,34 @@
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="Balance" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="n3k-p2-Iuk">
<rect key="frame" x="16" y="24" width="288" height="14"/>
<rect key="frame" x="16" y="24" width="283" height="14"/>
<fontDescription key="fontDescription" name="Figtree-Bold" family="Figtree" pointSize="12"/>
<color key="textColor" name="Txt10"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="Delegated" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P0a-eF-wJZ">
<rect key="frame" x="320" y="24" width="57" height="14"/>
<rect key="frame" x="315" y="24" width="62" height="14"/>
<fontDescription key="fontDescription" name="Figtree-Bold" family="Figtree" pointSize="12"/>
<color key="textColor" name="Txt10"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" verticalCompressionResistancePriority="752" text="&lt;balance&gt;" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mYK-bA-h7Q">
<rect key="frame" x="48" y="42" width="256" height="21"/>
<rect key="frame" x="48" y="42" width="251" height="21"/>
<fontDescription key="fontDescription" name="Figtree-Bold" family="Figtree" pointSize="18"/>
<color key="textColor" name="Txt2"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="&lt;value&gt;" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M0S-MN-rKw">
<rect key="frame" x="48" y="63" width="256" height="19"/>
<rect key="frame" x="48" y="63" width="251" height="19"/>
<fontDescription key="fontDescription" name="Figtree-SemiBold" family="Figtree" pointSize="12"/>
<color key="textColor" name="Txt10"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" semanticContentAttribute="forceRightToLeft" horizontalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" contentHorizontalAlignment="trailing" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="SJw-6f-S0R" customClass="CustomisableButton" customModule="Kukai_Mobile" customModuleProvider="target">
<rect key="frame" x="320" y="42" width="57" height="29"/>
<rect key="frame" x="313" y="42" width="62" height="17"/>
<fontDescription key="fontDescription" name="Figtree-SemiBold" family="Figtree" pointSize="14"/>
<color key="tintColor" name="BGB4"/>
<inset key="contentEdgeInsets" minX="2" minY="0.0" maxX="0.0" maxY="0.0"/>
<state key="normal" title="&lt;baker&gt;">
<color key="titleColor" name="Txt6"/>
</state>
Expand Down Expand Up @@ -86,7 +87,7 @@
<constraint firstItem="BWT-yR-fDJ" firstAttribute="top" secondItem="n3k-p2-Iuk" secondAttribute="bottom" constant="4" id="8Ei-01-OYa"/>
<constraint firstItem="mYK-bA-h7Q" firstAttribute="trailing" secondItem="n3k-p2-Iuk" secondAttribute="trailing" id="Cfk-pe-7cE"/>
<constraint firstItem="SJw-6f-S0R" firstAttribute="top" secondItem="mYK-bA-h7Q" secondAttribute="top" id="DZd-Rd-rlg"/>
<constraint firstItem="SJw-6f-S0R" firstAttribute="leading" secondItem="P0a-eF-wJZ" secondAttribute="leading" id="ERl-QW-XLT"/>
<constraint firstItem="SJw-6f-S0R" firstAttribute="leading" secondItem="P0a-eF-wJZ" secondAttribute="leading" constant="-2" id="ERl-QW-XLT"/>
<constraint firstItem="M0S-MN-rKw" firstAttribute="leading" secondItem="mYK-bA-h7Q" secondAttribute="leading" id="Efg-GQ-v16"/>
<constraint firstItem="n3k-p2-Iuk" firstAttribute="top" secondItem="6Vq-rB-jAg" secondAttribute="top" constant="24" id="FZT-N3-iyM"/>
<constraint firstItem="P0a-eF-wJZ" firstAttribute="top" secondItem="n3k-p2-Iuk" secondAttribute="top" id="GsX-lA-U8D"/>
Expand Down Expand Up @@ -114,7 +115,7 @@
</objects>
<designables>
<designable name="SJw-6f-S0R">
<size key="intrinsicContentSize" width="53" height="29"/>
<size key="intrinsicContentSize" width="62" height="17"/>
</designable>
</designables>
<resources>
Expand Down
Loading

0 comments on commit 6f545c3

Please sign in to comment.