Skip to content

Commit

Permalink
Present Billing Address's country as a modal if there's no Navigation…
Browse files Browse the repository at this point in the history
…Controller
  • Loading branch information
Andrei Solovev committed Jul 5, 2023
1 parent f2ac8a8 commit 766277a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions OmiseSDK/CreditCardFormViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,23 @@ public class CreditCardFormViewController: UIViewController, PaymentChooserUI, P
vc.viewModel?.onSelectCountry = { [weak self] country in
guard let self = self else { return }
self.countryInputView.text = country.name
self.navigationController?.popToViewController(self, animated: true)

if let nc = self.navigationController {
nc.popToViewController(self, animated: true)
} else {
self.dismiss(animated: true)
}

self.addressStackView.isHiddenInStackView = !self.viewModel.isAddressFieldsVisible
self.updateSubmitButtonState()

}
navigationController?.pushViewController(vc, animated: true)

if let nc = navigationController {
nc.pushViewController(vc, animated: true)
} else {
present(vc, animated: true)
}
}

private func setupAddressFields() {
Expand Down

0 comments on commit 766277a

Please sign in to comment.