Browse Source

add occupation v2

pull/1/head
InKwon James Kim 5 years ago
parent
commit
fabb4afc8f
  1. 41
      GME Remit/Modules/RegisterModules/UserAuthentication/NewRegisterStep1/User Interface/Presenter/NewRegisterStep1Presenter.swift
  2. 1
      GME Remit/Modules/RegisterModules/UserAuthentication/NewRegisterStep1/User Interface/View/NewRegisterStep1ViewController.swift
  3. 10
      GME Remit/Utilities/CustomUI/ValidationTextField.swift

41
GME Remit/Modules/RegisterModules/UserAuthentication/NewRegisterStep1/User Interface/Presenter/NewRegisterStep1Presenter.swift

@ -30,6 +30,7 @@ class NewRegisterStep1Presenter: ViewModelType {
let email: Driver<String>
let city: Driver<KeyValue?>
let address: Driver<String>
let occupation: Driver<KeyValue?>
let isValidPersonalInfo: Driver<Bool>
let personalInfoSave: Driver<Void>
let editingPersonalInfo: Driver<Void>
@ -92,24 +93,30 @@ class NewRegisterStep1Presenter: ViewModelType {
func transform(input: Input) -> Output {
let newPersonalInfo = Driver.combineLatest(
input.isValidPersonalInfo,
input.name,
input.gender,
input.dob,
input.email,
input.city,
input.address,
model.map {$0.personalInformation?.nativeCountry}.asDriverOnErrorJustComplete()
Driver.combineLatest(
input.name,
input.gender,
input.dob,
input.email,
input.city,
input.address,
input.occupation,
model.map {$0.personalInformation?.nativeCountry}.asDriverOnErrorJustComplete()
).map {(name, gender, dob, email, city, address, occupation, nativeCountry) -> PersonalInformation in
return PersonalInformation(
fullName: name,
gender: gender?.id,
dob: dob,
email: email,
city: city?.id,
address: address,
occupation: occupation?.id,
nativeCountry: nativeCountry
)
}
)
.map { (isValid, name, gender, dob, email, city, address, nativeCountry) -> PersonalInformation? in
return isValid ? PersonalInformation(
fullName: name,
gender: gender?.id,
dob: dob,
email: email,
city: city?.id,
address: address,
nativeCountry: nativeCountry
) : nil
.map { (isValid, info) -> PersonalInformation? in
return isValid ? info : nil
}
let newPrimaryInfo = Driver.combineLatest(

1
GME Remit/Modules/RegisterModules/UserAuthentication/NewRegisterStep1/User Interface/View/NewRegisterStep1ViewController.swift

@ -503,6 +503,7 @@ extension NewRegisterStep1ViewController {
email: emailTextField.rx.text.orEmpty.asDriverOnErrorJustComplete(),
city: cityTextField.selectedItem.map {$0 as? KeyValue}.asDriverOnErrorJustComplete(),
address: addressTextField.rx.text.orEmpty.asDriverOnErrorJustComplete(),
occupation: occupationTextField.selectedItem.map {$0 as? KeyValue}.asDriverOnErrorJustComplete(),
isValidPersonalInfo: isValidPersonalInfo.asDriverOnErrorJustComplete(),
personalInfoSave: personalSaveButton.rx.tap.asDriverOnErrorJustComplete(),

10
GME Remit/Utilities/CustomUI/ValidationTextField.swift

@ -249,18 +249,18 @@ import RxSwift
@objc private func editingDidBegin() {
switch type {
case .dropdown:
guard let parentVC = parentContainerViewController(), let item = dropwDownItems else {
keyboardToolbar.isHidden = true
guard let parentVC = parentContainerViewController() else {
return
}
keyboardToolbar.isHidden = true
tablePresenterWireframe.openWith(
delegate: self,
model: item,
model: dropwDownItems,
source: parentVC
)
default: ()
default:
keyboardToolbar.isHidden = false
}
}

Loading…
Cancel
Save