mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 20:19:05 +01:00
Convert Source tab to use Compose (#6987)
* Use Compose in Source tab * Replace hashCode with key function * Add ability to turn off pins moving on top of source list * Changes from review comments
This commit is contained in:
13
app/src/main/java/eu/kanade/data/source/SourceMapper.kt
Normal file
13
app/src/main/java/eu/kanade/data/source/SourceMapper.kt
Normal file
@@ -0,0 +1,13 @@
|
||||
package eu.kanade.data.source
|
||||
|
||||
import eu.kanade.domain.source.model.Source
|
||||
import eu.kanade.tachiyomi.source.CatalogueSource
|
||||
|
||||
val sourceMapper: (CatalogueSource) -> Source = { source ->
|
||||
Source(
|
||||
source.id,
|
||||
source.lang,
|
||||
source.name,
|
||||
source.supportsLatest
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package eu.kanade.data.source
|
||||
|
||||
import eu.kanade.domain.source.model.Source
|
||||
import eu.kanade.domain.source.repository.SourceRepository
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
|
||||
class SourceRepositoryImpl(
|
||||
private val sourceManager: SourceManager
|
||||
) : SourceRepository {
|
||||
|
||||
override fun getSources(): Flow<List<Source>> {
|
||||
return sourceManager.catalogueSources.map { sources ->
|
||||
sources.map(sourceMapper)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user