|
|
@ -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( |
|
|
|