Don't query db twice

This commit is contained in:
inorichi
2015-10-18 01:59:21 +02:00
parent a52e33b628
commit c6df23b1aa
2 changed files with 2 additions and 6 deletions
@@ -36,12 +36,9 @@ public class MangaInfoPresenter extends BasePresenter<MangaInfoFragment> {
private void getMangaInfo() {
if (mangaInfoSubscription != null)
return;
remove(mangaInfoSubscription);
add(mangaInfoSubscription = db.getManga(manga.id)
.subscribeOn(Schedulers.io())
.take(1)
.flatMap(Observable::from)
add(mangaInfoSubscription = Observable.just(manga)
.observeOn(AndroidSchedulers.mainThread())
.compose(deliverLatestCache())
.subscribe(split(MangaInfoFragment::setMangaInfo)));