mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-20 07:51:14 +01:00
Cleanup Library presenter (#8284)
* yeet observable + minor cleanup * move [getTracksFlow] to domain * Lint * Review changes Co-Authored-By: Andreas <6576096+ghostbear@users.noreply.github.com> * Review Changes 2 * Stuff * Rename + Rebase * Lint Co-authored-by: Andreas <6576096+ghostbear@users.noreply.github.com>
This commit is contained in:
@@ -19,10 +19,6 @@ class GetTracks(
|
||||
}
|
||||
}
|
||||
|
||||
fun subscribe(): Flow<List<Track>> {
|
||||
return trackRepository.getTracksAsFlow()
|
||||
}
|
||||
|
||||
fun subscribe(mangaId: Long): Flow<List<Track>> {
|
||||
return trackRepository.getTracksByMangaIdAsFlow(mangaId)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package eu.kanade.domain.track.interactor
|
||||
|
||||
import eu.kanade.domain.track.repository.TrackRepository
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
class GetTracksPerManga(
|
||||
private val trackRepository: TrackRepository,
|
||||
) {
|
||||
|
||||
fun subscribe(): Flow<Map<Long, List<Long>>> {
|
||||
return trackRepository.getTracksAsFlow().map { tracks ->
|
||||
tracks
|
||||
.groupBy { it.mangaId }
|
||||
.mapValues { entry ->
|
||||
entry.value.map { it.syncId }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user