Slide 70
Slide 70 text
void postComment(UserContent parent, String comment) {
api.postComment(parent.id(), comment)
.map(response -> ProgressState.POSTED)
.onErrorReturnItem(ProgressState.FAILED)
.startWith(ProgressState.IN_FLIGHT)
.subscribe(progressState -> {
database.createOrUpdateComment(
comment,
progressState
);
});
}
Never make the user wait