Merge pull request #1537 from AlphaWallet/preserve-value-when-switching-between-crypto-native-and-fiat-amounts

Preserve value when switching between crypto native and fiat amounts
pull/1541/head
James Sangalli 5 years ago committed by GitHub
commit 3c963655a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      AlphaWallet/UI/Views/AmountTextField.swift

@ -141,11 +141,10 @@ class AmountTextField: UIControl {
@objc func fiatAction(button: UIButton) {
guard cryptoToDollarRate != nil else { return }
let swappedPair = currentPair.swapPair()
//New pair for future calculation we should swap pair each time we press fiat button.
currentPair = swappedPair
let oldAlternateAmount = convertToAlternateAmount()
currentPair = currentPair.swapPair()
updateFiatButtonTitle()
textField.text = nil
textField.text = oldAlternateAmount
computeAlternateAmount()
activateAmountView()
delegate?.changeType(in: self)

Loading…
Cancel
Save