Add presenter subscriptions to the subscription list when using custom subscribe methods

This commit is contained in:
len
2016-04-10 04:32:43 +02:00
parent e28f69cddf
commit 2fa5d0cbaf
7 changed files with 70 additions and 54 deletions
@@ -49,8 +49,8 @@ class MangaPresenter : BasePresenter<MangaActivity>() {
// Prepare a subject to communicate the chapters and info presenters for the chapter count.
SharedData.put(ChapterCountEvent())
add(Observable.just(manga)
.subscribeLatestCache({ view, manga -> view.onSetManga(manga) }))
Observable.just(manga)
.subscribeLatestCache({ view, manga -> view.onSetManga(manga) })
}
override fun onDestroy() {
@@ -69,8 +69,8 @@ class ChaptersPresenter : BasePresenter<ChaptersFragment>() {
{ view, error -> Timber.e(error.cause, error.message) })
manga = SharedData.get(MangaEvent::class.java)?.manga ?: return
add(Observable.just(manga)
.subscribeLatestCache({ view, manga -> view.onNextManga(manga) }))
Observable.just(manga)
.subscribeLatestCache({ view, manga -> view.onNextManga(manga) })
source = sourceManager.get(manga.source)!!
start(DB_CHAPTERS)
@@ -79,9 +79,9 @@ class MangaInfoPresenter : BasePresenter<MangaInfoFragment>() {
// Update chapter count
SharedData.get(ChapterCountEvent::class.java)?.let {
add(it.observable
it.observable
.observeOn(AndroidSchedulers.mainThread())
.subscribeLatestCache({ view, count -> view.setChapterCount(count) }))
.subscribeLatestCache({ view, count -> view.setChapterCount(count) })
}
}