diff --git a/GMERemittance/Extension/CALayerExtension.swift b/GMERemittance/Extension/CALayerExtension.swift
index f80c5e1b..27f5b3fe 100644
--- a/GMERemittance/Extension/CALayerExtension.swift
+++ b/GMERemittance/Extension/CALayerExtension.swift
@@ -10,10 +10,10 @@ import Foundation
extension CALayer {
- func addShadow(with color: UIColor) {
+ func addShadow(with color: UIColor, shadowRadius:CGFloat = 2, shadowOpacity: Float = 0.37) {
self.shadowOffset = .zero
- self.shadowOpacity = 0.37
- self.shadowRadius = 2
+ self.shadowOpacity = shadowOpacity
+ self.shadowRadius = shadowRadius
self.shadowColor = color.cgColor
self.masksToBounds = false
}
diff --git a/GMERemittance/Library/CountryWithFlagPicker/CountryPickerViewController.swift b/GMERemittance/Library/CountryWithFlagPicker/CountryPickerViewController.swift
index bc9f05bc..4f183fe8 100644
--- a/GMERemittance/Library/CountryWithFlagPicker/CountryPickerViewController.swift
+++ b/GMERemittance/Library/CountryWithFlagPicker/CountryPickerViewController.swift
@@ -17,6 +17,7 @@ enum PickerTitle: String {
case bank = "Bank"
case branch = "Branch"
case currency = "Currency"
+ case occupation = "Occupation"
}
class CountryPickerViewController: UIViewController {
diff --git a/GMERemittance/Module/New Group/kycForm1/Application Logic/Interactor/kycForm1Interactor.swift b/GMERemittance/Module/New Group/kycForm1/Application Logic/Interactor/kycForm1Interactor.swift
index a68237c6..258becb5 100644
--- a/GMERemittance/Module/New Group/kycForm1/Application Logic/Interactor/kycForm1Interactor.swift
+++ b/GMERemittance/Module/New Group/kycForm1/Application Logic/Interactor/kycForm1Interactor.swift
@@ -58,4 +58,8 @@ extension KycForm1Interactor: KycForm1InteractorInput {
self.output?.show(errorsDick: result)
}
+
+ func viewIsReady() {
+
+ }
}
diff --git a/GMERemittance/Module/New Group/kycForm1/Application Logic/Interactor/kycForm1InteractorIO.swift b/GMERemittance/Module/New Group/kycForm1/Application Logic/Interactor/kycForm1InteractorIO.swift
index a79834d9..f60395f6 100644
--- a/GMERemittance/Module/New Group/kycForm1/Application Logic/Interactor/kycForm1InteractorIO.swift
+++ b/GMERemittance/Module/New Group/kycForm1/Application Logic/Interactor/kycForm1InteractorIO.swift
@@ -8,6 +8,7 @@
protocol KycForm1InteractorInput: class {
func validate(model: kycForm1Model)
+ func viewIsReady()
}
protocol KycForm1InteractorOutput: class {
diff --git a/GMERemittance/Module/New Group/kycForm1/Application Logic/Service/kycForm1ServiceType.swift b/GMERemittance/Module/New Group/kycForm1/Application Logic/Service/kycForm1ServiceType.swift
index 1d8b0079..69f6fc1e 100644
--- a/GMERemittance/Module/New Group/kycForm1/Application Logic/Service/kycForm1ServiceType.swift
+++ b/GMERemittance/Module/New Group/kycForm1/Application Logic/Service/kycForm1ServiceType.swift
@@ -12,3 +12,25 @@ protocol KycForm1ServiceType: class {
}
+
+
+protocol FetchKycInformation: ApiServiceType {
+ func fetch(success: @escaping (SendMoneyModel?) -> (), failure: @escaping (Error) -> () )
+}
+
+extension FetchKycInformation {
+ func fetch(success: @escaping (SendMoneyModel?) -> (), failure: @escaping (Error) -> () ) {
+ let url = baseUrl + "mobile/loadform/receiver"
+ auth.request(method: .get, url: url, params: nil, success: { (response: SendMoneyInformationContainer) in
+ if (response.errorCode ?? "") == "1" {
+ let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""])
+ failure(error)
+ }else {
+ let model = response.data
+ success(model)
+ }
+ }) { (error) in
+ failure(error)
+ }
+ }
+}
diff --git a/GMERemittance/Module/New Group/kycForm1/Module Interface/kycForm1ModuleInterface.swift b/GMERemittance/Module/New Group/kycForm1/Module Interface/kycForm1ModuleInterface.swift
index 4e2b4c03..0f70f310 100644
--- a/GMERemittance/Module/New Group/kycForm1/Module Interface/kycForm1ModuleInterface.swift
+++ b/GMERemittance/Module/New Group/kycForm1/Module Interface/kycForm1ModuleInterface.swift
@@ -8,4 +8,5 @@
protocol KycForm1ModuleInterface: class {
func validate(model: kycForm1Model)
+ func viewIsReady()
}
diff --git a/GMERemittance/Module/New Group/kycForm1/User Interface/Presenter/kycForm1Presenter.swift b/GMERemittance/Module/New Group/kycForm1/User Interface/Presenter/kycForm1Presenter.swift
index c0237a33..d6aca6bc 100644
--- a/GMERemittance/Module/New Group/kycForm1/User Interface/Presenter/kycForm1Presenter.swift
+++ b/GMERemittance/Module/New Group/kycForm1/User Interface/Presenter/kycForm1Presenter.swift
@@ -33,4 +33,8 @@ extension KycForm1Presenter: KycForm1InteractorOutput {
func show(errorsDick: (doesNotSucks: Bool, errorsDick: [String : String])) {
self.view?.show(result: errorsDick)
}
+
+ func viewIsReady() {
+ self.interactor?.viewIsReady()
+ }
}
diff --git a/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1.storyboard b/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1.storyboard
index b8b6cd93..7d0e46d8 100644
--- a/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1.storyboard
+++ b/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1.storyboard
@@ -26,7 +26,7 @@
-
+
diff --git a/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift b/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift
index 1139ff49..3b323569 100644
--- a/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift
+++ b/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift
@@ -23,6 +23,11 @@ class kycForm1Model {
var occupation = ""
}
+class Occupation {
+ var title: String?
+ var id: String?
+}
+
struct KycForm1FieldKeys {
static let firstName = "firstName"
static let middleName = "middleName"
@@ -42,6 +47,7 @@ class KycForm1ViewController: UIViewController {
struct Constants {
static let segmentBackgroundViewColor = UIColor.init(hex: "E7EDF2")
static let stateRedColor = UIColor.init(hex: "#EC1C24")
+ static let clearColor = UIColor.clear
static let male = "Male"
static let female = "Female"
static let other = "Other"
@@ -89,11 +95,28 @@ class KycForm1ViewController: UIViewController {
var errorLabels: [UILabel] = []
var textfields: [UITextField] = []
var delegate: KYCForm1Delegate?
+ var countries: [SendMoneyCountryViewModel]?
+ var occupations: [Occupation]?
+
+ var selectedCountry: SendMoneyCountryViewModel? {
+ didSet {
+ self.countryTextField.text = selectedCountry?.name
+ }
+ }
+
+ var selectedOccupation: Occupation? {
+ didSet {
+ self.occupationTextField.text = selectedOccupation?.title
+ }
+ }
+
// MARK: VC's Life cycle
override func viewDidLoad() {
super.viewDidLoad()
self.setup()
+ presenter?.viewIsReady()
+
}
// MARK: IBActions
@@ -151,35 +174,7 @@ class KycForm1ViewController: UIViewController {
dateFormatter.dateFormat = "yyyy-MM-dd"
self.dobTextField.text = dateFormatter.string(from: sender.date)
}
-
-
- private func showGenderPicker() {
-
- let alertcontroller = UIAlertController.init(title: "Gender", message: nil, preferredStyle: .actionSheet)
- alertcontroller.view.tintColor = UIColor.init(hex: "#7b7a7a")
- let maleAction = UIAlertAction(title: Constants.male, style: .default, handler: { _ in
- self.genderTextField.text = Constants.male
- })
-
- let femaleAction = UIAlertAction(title: Constants.female, style: .default, handler: { _ in
- self.genderTextField.text = Constants.female
- })
-
- let otherAction = UIAlertAction(title: Constants.other, style: .default, handler: { _ in
- self.genderTextField.text = Constants.other
- })
-
-
- let cancelAction = UIAlertAction(title: Constants.cancelTitleString, style: .cancel, handler: nil)
-
- alertcontroller.addAction(maleAction)
- alertcontroller.addAction(femaleAction)
- alertcontroller.addAction(otherAction)
- alertcontroller.addAction(cancelAction)
- self.present(alertcontroller, animated: true, completion: nil)
- }
-
private func validate() {
self.presenter?.validate(model: self.kycModel)
}
@@ -232,7 +227,8 @@ class KycForm1ViewController: UIViewController {
private func showBorder(textfield :UITextField?) {
guard let textfield = textfield else {return}
textfield.layer.borderColor = Constants.stateRedColor.cgColor
- textfield.layer.borderWidth = 1
+ textfield.layer.borderWidth = 0.3
+ textfield.layer.addShadow(with: Constants.stateRedColor)
}
private func show( error: String, label: UILabel?) {
@@ -270,6 +266,7 @@ extension KycForm1ViewController: IndicatorInfoProvider {
extension KycForm1ViewController: UITextFieldDelegate {
func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
+ textField.layer.addShadow(with: Constants.clearColor)
switch textField {
case genderTextField:
self.genderErrorLabel.isHidden = true
@@ -279,6 +276,7 @@ extension KycForm1ViewController: UITextFieldDelegate {
case nativeCountryTextField:
self.nativeCountryErrorLabel.isHidden = true
nativeCountryTextField.layer.borderWidth = 0
+ self.showCountryPickerview()
return false
case provinceTextField:
self.provinceErrorLabel.isHidden = true
@@ -287,6 +285,8 @@ extension KycForm1ViewController: UITextFieldDelegate {
case occupationTextField:
self.occupationErrorLabel.isHidden = true
occupationTextField.layer.borderWidth = 0
+
+ self.showOccupationPickerView()
return false
default:
return true
@@ -295,6 +295,7 @@ extension KycForm1ViewController: UITextFieldDelegate {
func textFieldDidBeginEditing(_ textField: UITextField) {
+ textField.layer.addShadow(with: Constants.clearColor)
switch textField {
case firstNameTextField:
self.firstNameErrorLabel.isHidden = true
@@ -336,3 +337,64 @@ extension KycForm1ViewController: UITextFieldDelegate {
}
+extension KycForm1ViewController {
+ private func showCountryPickerview() {
+ let viewcontroller = UIStoryboard.init(name: "CountryPicker", bundle: nil).instantiateViewController(withIdentifier: "CountryPickerViewController") as! CountryPickerViewController
+ viewcontroller.data = self.countries ?? []
+ viewcontroller.doneAction = self.countrySelected
+ viewcontroller.defaultSelectedData = [self.selectedCountry]
+ viewcontroller.type = PickerTitle.country
+ self.present(viewcontroller, animated: true, completion: nil)
+ }
+
+
+ func countrySelected(models: [SendMoneyCountryViewModel]) {
+ self.selectedCountry = models.first
+ }
+
+
+ private func showGenderPicker() {
+ let alertcontroller = UIAlertController.init(title: "Gender", message: nil, preferredStyle: .actionSheet)
+ alertcontroller.view.tintColor = UIColor.init(hex: "#7b7a7a")
+ let maleAction = UIAlertAction(title: Constants.male, style: .default, handler: { _ in
+ self.genderTextField.text = Constants.male
+ })
+
+ let femaleAction = UIAlertAction(title: Constants.female, style: .default, handler: { _ in
+ self.genderTextField.text = Constants.female
+ })
+
+ let otherAction = UIAlertAction(title: Constants.other, style: .default, handler: { _ in
+ self.genderTextField.text = Constants.other
+ })
+
+
+ let cancelAction = UIAlertAction(title: Constants.cancelTitleString, style: .cancel, handler: nil)
+
+ alertcontroller.addAction(maleAction)
+ alertcontroller.addAction(femaleAction)
+ alertcontroller.addAction(otherAction)
+ alertcontroller.addAction(cancelAction)
+ self.present(alertcontroller, animated: true, completion: nil)
+ }
+
+ private func showOccupationPickerView() {
+ let viewcontroller = self.getPickerViewController()
+ let occupations = self.occupations ?? []
+ let names = occupations.compactMap({$0.title})
+ viewcontroller.data = names
+ viewcontroller.type = PickerTitle.occupation
+ viewcontroller.doneAction = self.occupationSelected
+ self.present(viewcontroller, animated: true, completion: nil)
+ }
+
+ private func getPickerViewController()-> ItemsPickerViewController {
+ return UIStoryboard.init(name: "ItemsPicker", bundle: nil).instantiateViewController(withIdentifier: "ItemsPickerViewController") as! ItemsPickerViewController
+ }
+
+ func occupationSelected(occupations: [String]) {
+ let _occupation = self.occupations?.filter({($0.title ?? "") == (occupations.first ?? "") }).first
+ self.selectedOccupation = _occupation
+ }
+}
+