fix manga track services showing up in anime

This commit is contained in:
jmir1 2022-06-09 02:24:14 +02:00
parent 00659d7c09
commit 4f5ac26420
7 changed files with 12 additions and 10 deletions

View file

@ -40,4 +40,8 @@ class TrackManager(context: Context) {
fun getService(id: Int) = services.find { it.id == id }
fun hasLoggedServices() = services.any { it.isLogged }
fun hasLoggedMangaServices() = services.any { it.isLogged && it !is AnimeTrackService }
fun hasLoggedAnimeServices() = services.any { it.isLogged && it !is MangaTrackService }
}

View file

@ -55,7 +55,6 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.saver.Image
import eu.kanade.tachiyomi.data.saver.Location
import eu.kanade.tachiyomi.data.track.EnhancedTrackService
import eu.kanade.tachiyomi.data.track.MangaTrackService
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.data.track.TrackService
import eu.kanade.tachiyomi.data.track.model.AnimeTrackSearch
@ -614,7 +613,6 @@ class AnimeController :
if (source != null) {
presenter.trackList
.map { it.service }
.filterNot { it is MangaTrackService }
.filterIsInstance<EnhancedTrackService>()
.filter { it.accept(source!!) }
.forEach { service ->

View file

@ -26,6 +26,7 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.saver.Image
import eu.kanade.tachiyomi.data.saver.ImageSaver
import eu.kanade.tachiyomi.data.track.EnhancedTrackService
import eu.kanade.tachiyomi.data.track.MangaTrackService
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.data.track.TrackService
import eu.kanade.tachiyomi.ui.anime.episode.EpisodeItem
@ -114,7 +115,7 @@ class AnimePresenter(
private var _trackList: List<TrackItem> = emptyList()
val trackList get() = _trackList
private val loggedServices by lazy { trackManager.services.filter { it.isLogged } }
private val loggedServices by lazy { trackManager.services.filter { it.isLogged && it !is MangaTrackService } }
private val imageSaver: ImageSaver by injectLazy()
@ -191,7 +192,7 @@ class AnimePresenter(
}
private fun getTrackingObservable(): Observable<Int> {
if (!trackManager.hasLoggedServices()) {
if (!trackManager.hasLoggedAnimeServices()) {
return Observable.just(0)
}

View file

@ -107,7 +107,7 @@ class AnimeInfoHeaderAdapter(
}
with(binding.btnTracking) {
if (trackManager.hasLoggedServices()) {
if (trackManager.hasLoggedAnimeServices()) {
isVisible = true
if (trackCount > 0) {

View file

@ -46,7 +46,6 @@ import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.saver.Image
import eu.kanade.tachiyomi.data.saver.Location
import eu.kanade.tachiyomi.data.track.AnimeTrackService
import eu.kanade.tachiyomi.data.track.EnhancedTrackService
import eu.kanade.tachiyomi.data.track.TrackService
import eu.kanade.tachiyomi.data.track.model.TrackSearch
@ -575,7 +574,6 @@ class MangaController :
if (source != null) {
presenter.trackList
.map { it.service }
.filterNot { it is AnimeTrackService }
.filterIsInstance<EnhancedTrackService>()
.filter { it.accept(source!!) }
.forEach { service ->

View file

@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.saver.Image
import eu.kanade.tachiyomi.data.saver.ImageSaver
import eu.kanade.tachiyomi.data.track.AnimeTrackService
import eu.kanade.tachiyomi.data.track.EnhancedTrackService
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.data.track.TrackService
@ -102,7 +103,7 @@ class MangaPresenter(
private var _trackList: List<TrackItem> = emptyList()
val trackList get() = _trackList
private val loggedServices by lazy { trackManager.services.filter { it.isLogged } }
private val loggedServices by lazy { trackManager.services.filter { it.isLogged && it !is AnimeTrackService } }
private val imageSaver: ImageSaver by injectLazy()
@ -181,7 +182,7 @@ class MangaPresenter(
}
private fun getTrackingObservable(): Observable<Int> {
if (!trackManager.hasLoggedServices()) {
if (!trackManager.hasLoggedMangaServices()) {
return Observable.just(0)
}

View file

@ -107,7 +107,7 @@ class MangaInfoHeaderAdapter(
}
with(binding.btnTracking) {
if (trackManager.hasLoggedServices()) {
if (trackManager.hasLoggedMangaServices()) {
isVisible = true
if (trackCount > 0) {