我想根据第一个被观察对象(validatePassword)的返回结果来判断要不要去创建第二个(updatePassword)
??
apiService.validatePassword(validateBody)
.flatMap(validateResult -> {
if (validateResult.isSuccess()) {
return apiService.updatePassword(updateBody);
} else {
//在这里能不能把流断了,去更新ui
//应该怎么return ? }
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::handleUpdatePswResult);
这样??好像也不行
apiService.validatePassword(validateBody)
.filter(ValidatePswResponse::isSuccess)
.flatMap(validateResult -> {
return apiService.updatePassword(updateBody);
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::handleUpdatePswResult);
怎么写呢?能不能一步到位
就没看明白你的意思,什么叫流断了,你往下也没有代码了呀。