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) }
.map { tracks ->
val dbTracks = tracks.map { it.toDbTrack() }
loggedServices.map { service ->
TrackItem(dbTracks.find { it.sync_id.toLong() == service.id }, service)
}
loggedServices
// 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 ->
_trackList = trackItems