|
|
@ -74,7 +74,7 @@ class NewRegisterStep1Presenter: ViewModelType { |
|
|
|
let isSetPersonalInformation: Driver<Bool> |
|
|
|
let isSetPrimaryInformation: Driver<Bool> |
|
|
|
let isSetPictureInformation: Driver<Bool> |
|
|
|
|
|
|
|
let storePrimarySuccess: Driver<Bool> |
|
|
|
let storedSuccess: Driver<String> |
|
|
|
} |
|
|
|
|
|
|
@ -88,6 +88,7 @@ class NewRegisterStep1Presenter: ViewModelType { |
|
|
|
private var storedPersonalInfo = PublishSubject<PersonalInformation?>() |
|
|
|
private var storedPrimaryInfo = PublishSubject<PrimaryInformation?>() |
|
|
|
private var storedPictureInformation = PublishSubject<PictureInformation?>() |
|
|
|
private let storedPrimarySuccess = PublishSubject<String?>() |
|
|
|
private let storedSuccess = PublishSubject<String>() |
|
|
|
|
|
|
|
func transform(input: Input) -> Output { |
|
|
@ -183,6 +184,10 @@ class NewRegisterStep1Presenter: ViewModelType { |
|
|
|
.combineLatest(input.isValidPictures, storedPictureInformation.asDriverOnErrorJustComplete()) |
|
|
|
.map {$0 && $1 != nil} |
|
|
|
|
|
|
|
let storePrimarySuccess = Driver |
|
|
|
.combineLatest(input.isValidPrimaryInfo, storedPrimarySuccess.asDriverOnErrorJustComplete()) |
|
|
|
.map {$0 && $1 != nil} |
|
|
|
|
|
|
|
input.viewWillAppear.drive(onNext: { [weak self] in |
|
|
|
self?.progressLinker.onNext(true) |
|
|
|
self?.interactor?.fetchInformation() |
|
|
@ -298,6 +303,7 @@ class NewRegisterStep1Presenter: ViewModelType { |
|
|
|
isSetPersonalInformation: isSetPersonalInformation, |
|
|
|
isSetPrimaryInformation: isSetPrimaryInformation, |
|
|
|
isSetPictureInformation: isSetPictureInformation, |
|
|
|
storePrimarySuccess: storePrimarySuccess, |
|
|
|
storedSuccess: storedSuccess.asDriverOnErrorJustComplete() |
|
|
|
) |
|
|
|
} |
|
|
@ -308,7 +314,6 @@ extension NewRegisterStep1Presenter: NewRegisterStep1InteractorOutput { |
|
|
|
func setModel(with model: KYCInformation) { |
|
|
|
progressLinker.onNext(false) |
|
|
|
self.model.onNext(model) |
|
|
|
|
|
|
|
guard let personalInformation = model.personalInformation, !personalInformation.isHasEmptyValue() else { |
|
|
|
storedPersonalInfo.onNext(nil) |
|
|
|
return |
|
|
@ -334,12 +339,15 @@ extension NewRegisterStep1Presenter: NewRegisterStep1InteractorOutput { |
|
|
|
progressLinker.onNext(false) |
|
|
|
|
|
|
|
guard let storedModel = storedModel, let type = Step(rawValue: storedModel.type) else { return } |
|
|
|
|
|
|
|
switch type { |
|
|
|
case .innerStep1: |
|
|
|
storedPersonalInfo.onNext(storedModel.personalInformation) |
|
|
|
case .innerStep2: |
|
|
|
storedPrimaryInfo.onNext(storedModel.primaryInformation) |
|
|
|
storedPrimarySuccess.onNext(message) |
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { |
|
|
|
self.storedPrimarySuccess.onNext(nil) |
|
|
|
} |
|
|
|
case .innerStep3: |
|
|
|
storedPictureInformation.onNext(storedModel.pictures) |
|
|
|
storedSuccess.onNext(message) |
|
|
|