Hide section footer and fiat button if we do not have price.

pull/2/head
Oleg Gordiichuk 7 years ago committed by Michael Scoff
parent 544f843321
commit 51007baa1f
  1. 12
      Trust/Transfer/ViewControllers/SendViewController.swift

@ -105,7 +105,8 @@ class SendViewController: FormViewController {
fiatButton.translatesAutoresizingMaskIntoConstraints = false
fiatButton.setTitle(currentPair.right, for: .normal)
fiatButton.addTarget(self, action: #selector(fiatAction), for: .touchUpInside)
fiatButton.isHidden = isFiatViewHidden()
let amountRightView = UIStackView(arrangedSubviews: [
fiatButton,
])
@ -116,7 +117,7 @@ class SendViewController: FormViewController {
amountRightView.axis = .horizontal
form = Section()
+++ Section(header: "", footer: "~ \(String(self.pairValue)) " + "\(currentPair.right)")
+++ Section(header: "", footer: isFiatViewHidden() ? "" : "~ \(String(self.pairValue)) " + "\(currentPair.right)")
<<< AppFormAppearance.textFieldFloat(tag: Values.address) {
$0.add(rule: EthereumAddressRule())
$0.validationOptions = .validatesOnDemand
@ -274,6 +275,13 @@ class SendViewController: FormViewController {
}
self.updatePriceSection()
}
private func isFiatViewHidden() -> Bool {
guard let rates = storage.tickers, let currentTokenInfo = rates[viewModel.symbol], let _ = Double(currentTokenInfo.price) else {
return true
}
return false
}
}
extension SendViewController: QRCodeReaderDelegate {

Loading…
Cancel
Save