|
@ -60,9 +60,9 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
if let _action = action { |
|
|
if let _action = action { |
|
|
switch _action { |
|
|
switch _action { |
|
|
case .calculate: |
|
|
case .calculate: |
|
|
self.continueButton.setTitle("calculate_text".localized(), for: .normal) |
|
|
|
|
|
|
|
|
continueButton.setTitle("calculate_text".localized(), for: .normal) |
|
|
case ._continue: |
|
|
case ._continue: |
|
|
self.continueButton.setTitle("continue_text".localized(), for: .normal) |
|
|
|
|
|
|
|
|
continueButton.setTitle("continue_text".localized(), for: .normal) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -70,7 +70,7 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
|
|
|
|
|
|
private var currencyInfoViewModel: [SendMoneyExchangeRateCurrencyViewModel]? { |
|
|
private var currencyInfoViewModel: [SendMoneyExchangeRateCurrencyViewModel]? { |
|
|
didSet { |
|
|
didSet { |
|
|
self.selectedCurrencyViewModel = self.currencyInfoViewModel?.first |
|
|
|
|
|
|
|
|
selectedCurrencyViewModel = currencyInfoViewModel?.first |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -83,10 +83,8 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
let serviceCharge = exchangeRateModel?.transferFee ?? "0.00" |
|
|
let serviceCharge = exchangeRateModel?.transferFee ?? "0.00" |
|
|
let transferFee = serviceCharge != "0.00" ? "-\(serviceCharge)" : "\(serviceCharge)" |
|
|
let transferFee = serviceCharge != "0.00" ? "-\(serviceCharge)" : "\(serviceCharge)" |
|
|
|
|
|
|
|
|
self.transferFeeInfoLabel.text = transferFee + " (" + "transfer_fee_included_text".localized() + ")" |
|
|
|
|
|
|
|
|
|
|
|
let exchangeRate = exchangeRateModel?.exchangeRate ?? "" |
|
|
|
|
|
exchangeRateLabel.text = exchangeRate + " (" + "current_exchange_rate_text".localized() + ")" |
|
|
|
|
|
|
|
|
transferFeeInfoLabel.text = "\(transferFee) (\("transfer_fee_included_text".localized()))" |
|
|
|
|
|
exchangeRateLabel.text = "\(exchangeRateModel?.exchangeRate ?? "") (\("current_exchange_rate_text".localized()))" |
|
|
|
|
|
|
|
|
setCoupon() |
|
|
setCoupon() |
|
|
|
|
|
|
|
@ -110,24 +108,24 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private var coupons: [Coupon]? { |
|
|
|
|
|
didSet { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private var coupons: [Coupon]? |
|
|
private var calcBy = "" |
|
|
private var calcBy = "" |
|
|
|
|
|
|
|
|
private var currencies: [String]? { |
|
|
private var currencies: [String]? { |
|
|
didSet { |
|
|
didSet { |
|
|
let models: [SendMoneyExchangeRateCurrencyViewModel] = |
|
|
let models: [SendMoneyExchangeRateCurrencyViewModel] = |
|
|
(currencies ?? []).map { |
|
|
|
|
|
|
|
|
(currencies ?? []).map {[weak self] in |
|
|
|
|
|
guard let `self` = self else { |
|
|
|
|
|
return SendMoneyExchangeRateCurrencyViewModel() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
let viewmodel = SendMoneyExchangeRateCurrencyViewModel() |
|
|
let viewmodel = SendMoneyExchangeRateCurrencyViewModel() |
|
|
viewmodel.countryCode = self.reciepient?.countryCode ?? "" |
|
|
viewmodel.countryCode = self.reciepient?.countryCode ?? "" |
|
|
viewmodel.currency = $0 |
|
|
viewmodel.currency = $0 |
|
|
return viewmodel |
|
|
return viewmodel |
|
|
} |
|
|
} |
|
|
self.currencyInfoViewModel = models |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
currencyInfoViewModel = models |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -172,6 +170,7 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
action = .calculate |
|
|
action = .calculate |
|
|
|
|
|
|
|
|
senderTextField.becomeFirstResponder() |
|
|
senderTextField.becomeFirstResponder() |
|
|
|
|
|
senderTextField.delegate = self |
|
|
|
|
|
|
|
|
calcBy = "c" |
|
|
calcBy = "c" |
|
|
[backgroundViewCountryLabel1, backgroundViewCountryLabel2].forEach { $0?.layer.cornerRadius = 5 } |
|
|
[backgroundViewCountryLabel1, backgroundViewCountryLabel2].forEach { $0?.layer.cornerRadius = 5 } |
|
@ -182,19 +181,8 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
configureLanguage() |
|
|
configureLanguage() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// senderTextField.inputView?.keyboardToolbar.doneBarButton.title = "Calculate" |
|
|
|
|
|
// senderTextField.inputView?.keyboardToolbar.doneBarButton.setTarget(self, action: #selector(calculateRate(_:))) |
|
|
|
|
|
// reciepientTextField.inputView?.keyboardToolbar.doneBarButton.title = "Calculate" |
|
|
|
|
|
// reciepientTextField.inputView?.keyboardToolbar.doneBarButton.setTarget(self, action: #selector(calculateRate(_:))) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
// @objc private func calculateRate(_ sender: Any){ |
|
|
|
|
|
// print("calcuate!") |
|
|
|
|
|
//// sender.resignFirstResponder() |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private func configureLanguage() { |
|
|
private func configureLanguage() { |
|
|
youSendTitleLabel.text = "you_send_text".localized() |
|
|
youSendTitleLabel.text = "you_send_text".localized() |
|
|
recipientGetsTitleLabel.text = "recepient_gets_text".localized() |
|
|
recipientGetsTitleLabel.text = "recepient_gets_text".localized() |
|
@ -234,7 +222,7 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
|
|
|
|
|
|
private func currencySelected(models: [SendMoneyExchangeRateCurrencyViewModel?]) { |
|
|
private func currencySelected(models: [SendMoneyExchangeRateCurrencyViewModel?]) { |
|
|
if let model = models.first { |
|
|
if let model = models.first { |
|
|
self.selectedCurrencyViewModel = model |
|
|
|
|
|
|
|
|
selectedCurrencyViewModel = model |
|
|
calcBy.lowercased() == "c" ? (reciepientTextField.text = "") : (senderTextField.text = "") |
|
|
calcBy.lowercased() == "c" ? (reciepientTextField.text = "") : (senderTextField.text = "") |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -247,8 +235,10 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
transferFeeInfoLabel.alpha = 0 |
|
|
transferFeeInfoLabel.alpha = 0 |
|
|
exchangeInfoStackView.isHidden = true |
|
|
exchangeInfoStackView.isHidden = true |
|
|
exchangeInfoStackView.alpha = 0 |
|
|
exchangeInfoStackView.alpha = 0 |
|
|
|
|
|
|
|
|
let dropDownImage = #imageLiteral(resourceName: "dropdown_white").withRenderingMode(UIImageRenderingMode.alwaysTemplate) |
|
|
let dropDownImage = #imageLiteral(resourceName: "dropdown_white").withRenderingMode(UIImageRenderingMode.alwaysTemplate) |
|
|
let image = dropDownImage |
|
|
let image = dropDownImage |
|
|
|
|
|
|
|
|
dropDownImageView.image = image |
|
|
dropDownImageView.image = image |
|
|
dropDownImageView.tintColor = UIColor.white |
|
|
dropDownImageView.tintColor = UIColor.white |
|
|
setCountryFlag(countryCode: reciepient?.countryCode ?? "") |
|
|
setCountryFlag(countryCode: reciepient?.countryCode ?? "") |
|
@ -327,7 +317,6 @@ class SendMoneyExchangeRateViewController: UIViewController { |
|
|
calculateExchangeRate(senderAmount: senderAmount, reciepientAmount: reciepientAmount, calcBy: calcBy) |
|
|
calculateExchangeRate(senderAmount: senderAmount, reciepientAmount: reciepientAmount, calcBy: calcBy) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private func goToVerification() { |
|
|
private func goToVerification() { |
|
|
exchangeRateModel?.calcBy = calcBy |
|
|
exchangeRateModel?.calcBy = calcBy |
|
|
exchangeRateModel?.reciepientCurrency = selectedCurrencyViewModel?.currency ?? "" |
|
|
exchangeRateModel?.reciepientCurrency = selectedCurrencyViewModel?.currency ?? "" |
|
@ -397,3 +386,15 @@ extension SendMoneyExchangeRateViewController { |
|
|
self.viewWillAppear(true) |
|
|
self.viewWillAppear(true) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// MARK: - UITextFieldDelegate |
|
|
|
|
|
extension SendMoneyExchangeRateViewController: UITextFieldDelegate { |
|
|
|
|
|
func textFieldDidEndEditing(_ textField: UITextField) { |
|
|
|
|
|
switch textField { |
|
|
|
|
|
case senderTextField: |
|
|
|
|
|
calculate() |
|
|
|
|
|
default: |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |