MangaPresenter: Filter unsupported track service from available service list (#8286)

This commit is contained in:
Ivan Iskandar 2022-10-25 20:34:05 +07:00 committed by GitHub
parent 15f7e53e4f
commit 82b552ac9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -861,9 +861,11 @@ class MangaPresenter(
.catch { logcat(LogPriority.ERROR, it) } .catch { logcat(LogPriority.ERROR, it) }
.map { tracks -> .map { tracks ->
val dbTracks = tracks.map { it.toDbTrack() } val dbTracks = tracks.map { it.toDbTrack() }
loggedServices.map { service -> loggedServices
TrackItem(dbTracks.find { it.sync_id.toLong() == service.id }, service) // Map to TrackItem
} .map { service -> TrackItem(dbTracks.find { it.sync_id.toLong() == service.id }, service) }
// Show only if the service supports this manga's source
.filter { (it.service as? EnhancedTrackService)?.accept(source!!) ?: true }
} }
.collectLatest { trackItems -> .collectLatest { trackItems ->
_trackList = trackItems _trackList = trackItems