use of com.kickstarter.libs.utils.ObjectUtils in project android-oss by kickstarter.
the class ProjectIntentMapper method project.
/**
* Returns an observable of projects retrieved from intent data. May hit the API if the intent only contains a project
* param rather than a parceled project.
*/
@NonNull
public static Observable<Project> project(@NonNull final Intent intent, @NonNull final ApiClientType client) {
final Project intentProject = projectFromIntent(intent);
final Observable<Project> projectFromParceledProject = intentProject == null ? Observable.empty() : Observable.just(intentProject).flatMap(client::fetchProject).startWith(intentProject).retry(3);
final Observable<Project> projectFromParceledParam = Observable.just(paramFromIntent(intent)).filter(ObjectUtils::isNotNull).flatMap(client::fetchProject).retry(3);
return projectFromParceledProject.mergeWith(projectFromParceledParam).compose(Transformers.neverError());
}
Aggregations