mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Don't query db twice
This commit is contained in:
		| @@ -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; | ||||
|  | ||||
|   | ||||
| @@ -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))); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user