Store manga sources in database #426

This commit is contained in:
Koitharu
2023-07-24 15:47:52 +03:00
parent 03b92c4898
commit 376cee1859
22 changed files with 478 additions and 311 deletions

View File

@@ -52,6 +52,7 @@ import org.koitharu.kotatsu.core.util.ext.takeMostFrequent
import org.koitharu.kotatsu.core.util.ext.toBitmapOrNull
import org.koitharu.kotatsu.core.util.ext.trySetForeground
import org.koitharu.kotatsu.details.ui.DetailsActivity
import org.koitharu.kotatsu.explore.data.MangaSourcesRepository
import org.koitharu.kotatsu.favourites.domain.FavouritesRepository
import org.koitharu.kotatsu.history.data.HistoryRepository
import org.koitharu.kotatsu.parsers.model.Manga
@@ -79,6 +80,7 @@ class SuggestionsWorker @AssistedInject constructor(
private val favouritesRepository: FavouritesRepository,
private val appSettings: AppSettings,
private val mangaRepositoryFactory: MangaRepository.Factory,
private val sourcesRepository: MangaSourcesRepository,
) : CoroutineWorker(appContext, params) {
override suspend fun doWork(): Result {
@@ -128,7 +130,7 @@ class SuggestionsWorker @AssistedInject constructor(
historyRepository.getList(0, 20) +
favouritesRepository.getLastManga(20)
).distinctById()
val sources = appSettings.getMangaSources(includeHidden = false)
val sources = sourcesRepository.getEnabledSources()
if (seed.isEmpty() || sources.isEmpty()) {
return 0
}