Update parsers and fix some deprecations
This commit is contained in:
@@ -35,7 +35,7 @@ class ExploreRepository @Inject constructor(
|
||||
val details = runCatchingCancellable {
|
||||
mangaRepositoryFactory.create(manga.source).getDetails(manga)
|
||||
}.getOrNull() ?: continue
|
||||
if ((settings.isSuggestionsExcludeNsfw && details.isNsfw) || details in tagsBlacklist) {
|
||||
if ((settings.isSuggestionsExcludeNsfw && details.isNsfw()) || details in tagsBlacklist) {
|
||||
continue
|
||||
}
|
||||
return details
|
||||
@@ -55,7 +55,7 @@ class ExploreRepository @Inject constructor(
|
||||
val details = runCatchingCancellable {
|
||||
mangaRepositoryFactory.create(manga.source).getDetails(manga)
|
||||
}.getOrNull() ?: continue
|
||||
if ((skipNsfw && details.isNsfw) || details in tagsBlacklist) {
|
||||
if ((skipNsfw && details.isNsfw()) || details in tagsBlacklist) {
|
||||
continue
|
||||
}
|
||||
return details
|
||||
@@ -80,7 +80,7 @@ class ExploreRepository @Inject constructor(
|
||||
filter = MangaListFilter(tags = setOfNotNull(tag)),
|
||||
).asArrayList()
|
||||
if (settings.isSuggestionsExcludeNsfw) {
|
||||
list.removeAll { it.isNsfw }
|
||||
list.removeAll { it.isNsfw() }
|
||||
}
|
||||
if (blacklist.isNotEmpty()) {
|
||||
list.removeAll { manga -> manga in blacklist }
|
||||
|
||||
@@ -10,6 +10,7 @@ import kotlinx.coroutines.flow.filter
|
||||
import kotlinx.coroutines.flow.onStart
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import kotlinx.coroutines.plus
|
||||
import org.koitharu.kotatsu.core.model.isNsfw
|
||||
import org.koitharu.kotatsu.core.parser.MangaDataRepository
|
||||
import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||
import org.koitharu.kotatsu.core.prefs.ListMode
|
||||
@@ -45,7 +46,7 @@ abstract class MangaListViewModel(
|
||||
abstract fun onRetry()
|
||||
|
||||
protected fun List<Manga>.skipNsfwIfNeeded() = if (settings.isNsfwContentDisabled) {
|
||||
filterNot { it.isNsfw }
|
||||
filterNot { it.isNsfw() }
|
||||
} else {
|
||||
this
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runInterruptible
|
||||
import org.koitharu.kotatsu.core.model.LocalMangaSource
|
||||
import org.koitharu.kotatsu.core.model.isLocal
|
||||
import org.koitharu.kotatsu.core.model.isNsfw
|
||||
import org.koitharu.kotatsu.core.parser.MangaRepository
|
||||
import org.koitharu.kotatsu.core.prefs.AppSettings
|
||||
import org.koitharu.kotatsu.core.util.AlphanumComparator
|
||||
@@ -94,7 +95,7 @@ class LocalMangaRepository @Inject constructor(
|
||||
}
|
||||
val list = getRawList()
|
||||
if (settings.isNsfwContentDisabled) {
|
||||
list.removeAll { it.manga.isNsfw }
|
||||
list.removeAll { it.manga.isNsfw() }
|
||||
}
|
||||
if (filter != null) {
|
||||
val query = filter.query
|
||||
@@ -109,7 +110,7 @@ class LocalMangaRepository @Inject constructor(
|
||||
}
|
||||
filter.contentRating.singleOrNull()?.let { contentRating ->
|
||||
val isNsfw = contentRating == ContentRating.ADULT
|
||||
list.retainAll { it.manga.isNsfw == isNsfw }
|
||||
list.retainAll { it.manga.isNsfw() == isNsfw }
|
||||
}
|
||||
if (!query.isNullOrEmpty() && order == SortOrder.RELEVANCE) {
|
||||
list.sortBy { it.manga.title.levenshteinDistance(query) }
|
||||
|
||||
@@ -76,7 +76,7 @@ class SearchV2Helper @AssistedInject constructor(
|
||||
|
||||
private fun MutableList<Manga>.postFilter(query: String, kind: SearchKind) {
|
||||
if (settings.isNsfwContentDisabled) {
|
||||
removeAll { it.isNsfw }
|
||||
removeAll { it.isNsfw() }
|
||||
}
|
||||
when (kind) {
|
||||
SearchKind.TITLE -> retainAll { m ->
|
||||
|
||||
@@ -229,7 +229,7 @@ class SuggestionsWorker @AssistedInject constructor(
|
||||
if (details.rating > 0 && details.rating < RATING_MIN) {
|
||||
continue
|
||||
}
|
||||
if (details.isNsfw && (appSettings.isSuggestionsExcludeNsfw || appSettings.isNsfwContentDisabled)) {
|
||||
if (details.isNsfw() && (appSettings.isSuggestionsExcludeNsfw || appSettings.isNsfwContentDisabled)) {
|
||||
continue
|
||||
}
|
||||
if (details in tagsBlacklist) {
|
||||
@@ -277,7 +277,7 @@ class SuggestionsWorker @AssistedInject constructor(
|
||||
filter = MangaListFilter(tags = setOfNotNull(tag)),
|
||||
).asArrayList()
|
||||
if (appSettings.isSuggestionsExcludeNsfw) {
|
||||
list.removeAll { it.isNsfw }
|
||||
list.removeAll { it.isNsfw() }
|
||||
}
|
||||
if (blacklist.isNotEmpty()) {
|
||||
list.removeAll { manga -> manga in blacklist }
|
||||
|
||||
Reference in New Issue
Block a user