Albirew/tachiyomi
Archivé
1
0
Bifurcation 0

Don't query db twice

Cette révision appartient à :
inorichi 2015-10-18 01:59:21 +02:00
Parent a52e33b628
révision c6df23b1aa
2 fichiers modifiés avec 2 ajouts et 6 suppressions

Voir le fichier

@ -10,7 +10,6 @@ import eu.kanade.mangafeed.data.tables.MangasTable;
@StorIOSQLiteType(table = MangasTable.TABLE)
public class Manga {
@Nullable
@StorIOSQLiteColumn(name = MangasTable.COLUMN_ID, key = true)
public Long id;

Voir le fichier

@ -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)));