From d8c405e3356e53986372e7a176cdf8684606efcb Mon Sep 17 00:00:00 2001 From: Hwee-Boon Yar Date: Sat, 28 Apr 2018 23:37:19 +0800 Subject: [PATCH] Fix: Don't show ETH info in send screen for non-eth/ticket tokens --- .../ViewControllers/SendViewController.swift | 1 + .../ViewModels/SendHeaderViewViewModel.swift | 1 + Trust/Transfer/Views/SendHeaderView.swift | 12 ++++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Trust/Transfer/ViewControllers/SendViewController.swift b/Trust/Transfer/ViewControllers/SendViewController.swift index 55ea550a5..4d8872ac7 100644 --- a/Trust/Transfer/ViewControllers/SendViewController.swift +++ b/Trust/Transfer/ViewControllers/SendViewController.swift @@ -233,6 +233,7 @@ class SendViewController: UIViewController { view.backgroundColor = viewModel.backgroundColor + headerViewModel.showAlternativeAmount = viewModel.showAlternativeAmount header.configure(viewModel: headerViewModel) targetAddressTextField.textColor = viewModel.textFieldTextColor diff --git a/Trust/Transfer/ViewModels/SendHeaderViewViewModel.swift b/Trust/Transfer/ViewModels/SendHeaderViewViewModel.swift index 1fd42c7d5..259228d2e 100644 --- a/Trust/Transfer/ViewModels/SendHeaderViewViewModel.swift +++ b/Trust/Transfer/ViewModels/SendHeaderViewViewModel.swift @@ -7,6 +7,7 @@ struct SendHeaderViewViewModel { var ticker: CoinTicker? = nil var currencyAmount: String? = nil var currencyAmountWithoutSymbol: Double? = nil + var showAlternativeAmount = false var issuer: String { return "" diff --git a/Trust/Transfer/Views/SendHeaderView.swift b/Trust/Transfer/Views/SendHeaderView.swift index 2d09bd6e2..17717d207 100644 --- a/Trust/Transfer/Views/SendHeaderView.swift +++ b/Trust/Transfer/Views/SendHeaderView.swift @@ -8,6 +8,8 @@ class SendHeaderView: UIView { let issuerLabel = UILabel() let middleBorder = UIView() + + var footerStackView: UIStackView? let valuePercentageChangeValueLabel = UILabel() let valuePercentageChangePeriodLabel = UILabel() let valueChangeLabel = UILabel() @@ -36,19 +38,19 @@ class SendHeaderView: UIView { let footerNamesStack = [valuePercentageChangePeriodLabel, valueChangeNameLabel, valueNameLabel].asStackView(distribution: .fillEqually, spacing: 15) - let footerStackView = [ - middleBorder, + footerStackView = [ .spacer(height: 14), footerValuesStack, footerNamesStack, ].asStackView(axis: .vertical, perpendicularContentHuggingPriority: .defaultLow) - footerStackView.translatesAutoresizingMaskIntoConstraints = false + footerStackView?.translatesAutoresizingMaskIntoConstraints = false let stackView = [ titleLabel, bottomRowStack, .spacer(height: 7), - footerStackView, + middleBorder, + footerStackView!, ].asStackView(axis: .vertical) stackView.translatesAutoresizingMaskIntoConstraints = false background.addSubview(stackView) @@ -117,5 +119,7 @@ class SendHeaderView: UIView { valueLabel.textColor = viewModel.textColor valueLabel.font = viewModel.textValueFont valueLabel.text = viewModel.value + + footerStackView?.isHidden = !viewModel.showAlternativeAmount } }