Fix: Don't show ETH info in send screen for non-eth/ticket tokens

pull/244/head
Hwee-Boon Yar 7 years ago
parent 6c06a272ba
commit d8c405e335
  1. 1
      Trust/Transfer/ViewControllers/SendViewController.swift
  2. 1
      Trust/Transfer/ViewModels/SendHeaderViewViewModel.swift
  3. 12
      Trust/Transfer/Views/SendHeaderView.swift

@ -233,6 +233,7 @@ class SendViewController: UIViewController {
view.backgroundColor = viewModel.backgroundColor view.backgroundColor = viewModel.backgroundColor
headerViewModel.showAlternativeAmount = viewModel.showAlternativeAmount
header.configure(viewModel: headerViewModel) header.configure(viewModel: headerViewModel)
targetAddressTextField.textColor = viewModel.textFieldTextColor targetAddressTextField.textColor = viewModel.textFieldTextColor

@ -7,6 +7,7 @@ struct SendHeaderViewViewModel {
var ticker: CoinTicker? = nil var ticker: CoinTicker? = nil
var currencyAmount: String? = nil var currencyAmount: String? = nil
var currencyAmountWithoutSymbol: Double? = nil var currencyAmountWithoutSymbol: Double? = nil
var showAlternativeAmount = false
var issuer: String { var issuer: String {
return "" return ""

@ -8,6 +8,8 @@ class SendHeaderView: UIView {
let issuerLabel = UILabel() let issuerLabel = UILabel()
let middleBorder = UIView() let middleBorder = UIView()
var footerStackView: UIStackView?
let valuePercentageChangeValueLabel = UILabel() let valuePercentageChangeValueLabel = UILabel()
let valuePercentageChangePeriodLabel = UILabel() let valuePercentageChangePeriodLabel = UILabel()
let valueChangeLabel = UILabel() let valueChangeLabel = UILabel()
@ -36,19 +38,19 @@ class SendHeaderView: UIView {
let footerNamesStack = [valuePercentageChangePeriodLabel, valueChangeNameLabel, valueNameLabel].asStackView(distribution: .fillEqually, spacing: 15) let footerNamesStack = [valuePercentageChangePeriodLabel, valueChangeNameLabel, valueNameLabel].asStackView(distribution: .fillEqually, spacing: 15)
let footerStackView = [ footerStackView = [
middleBorder,
.spacer(height: 14), .spacer(height: 14),
footerValuesStack, footerValuesStack,
footerNamesStack, footerNamesStack,
].asStackView(axis: .vertical, perpendicularContentHuggingPriority: .defaultLow) ].asStackView(axis: .vertical, perpendicularContentHuggingPriority: .defaultLow)
footerStackView.translatesAutoresizingMaskIntoConstraints = false footerStackView?.translatesAutoresizingMaskIntoConstraints = false
let stackView = [ let stackView = [
titleLabel, titleLabel,
bottomRowStack, bottomRowStack,
.spacer(height: 7), .spacer(height: 7),
footerStackView, middleBorder,
footerStackView!,
].asStackView(axis: .vertical) ].asStackView(axis: .vertical)
stackView.translatesAutoresizingMaskIntoConstraints = false stackView.translatesAutoresizingMaskIntoConstraints = false
background.addSubview(stackView) background.addSubview(stackView)
@ -117,5 +119,7 @@ class SendHeaderView: UIView {
valueLabel.textColor = viewModel.textColor valueLabel.textColor = viewModel.textColor
valueLabel.font = viewModel.textValueFont valueLabel.font = viewModel.textValueFont
valueLabel.text = viewModel.value valueLabel.text = viewModel.value
footerStackView?.isHidden = !viewModel.showAlternativeAmount
} }
} }

Loading…
Cancel
Save