mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Revert bad RxJava conversion that prevented tracking data to be updated in UI
This commit is contained in:
parent
efbefabb01
commit
2c9f8bb9ce
1 changed files with 13 additions and 8 deletions
|
@ -15,6 +15,8 @@ import eu.kanade.tachiyomi.util.system.toast
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.awaitAll
|
import kotlinx.coroutines.awaitAll
|
||||||
|
import rx.Subscription
|
||||||
|
import rx.android.schedulers.AndroidSchedulers
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
|
||||||
|
@ -31,7 +33,7 @@ class TrackPresenter(
|
||||||
|
|
||||||
private val loggedServices by lazy { trackManager.services.filter { it.isLogged } }
|
private val loggedServices by lazy { trackManager.services.filter { it.isLogged } }
|
||||||
|
|
||||||
private var trackJob: Job? = null
|
private var trackSubscription: Subscription? = null
|
||||||
private var searchJob: Job? = null
|
private var searchJob: Job? = null
|
||||||
private var refreshJob: Job? = null
|
private var refreshJob: Job? = null
|
||||||
|
|
||||||
|
@ -41,14 +43,17 @@ class TrackPresenter(
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fetchTrackings() {
|
private fun fetchTrackings() {
|
||||||
trackJob?.cancel()
|
trackSubscription?.let { remove(it) }
|
||||||
trackJob = launchIO {
|
trackSubscription = db.getTracks(manga)
|
||||||
val tracks = db.getTracks(manga).await()
|
.asRxObservable()
|
||||||
trackList = loggedServices.map { service ->
|
.map { tracks ->
|
||||||
TrackItem(tracks.find { it.sync_id == service.id }, service)
|
loggedServices.map { service ->
|
||||||
|
TrackItem(tracks.find { it.sync_id == service.id }, service)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
view?.onNextTrackings(trackList)
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
}
|
.doOnNext { trackList = it }
|
||||||
|
.subscribeLatestCache(TrackController::onNextTrackings)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun refresh() {
|
fun refresh() {
|
||||||
|
|
Loading…
Reference in a new issue