Update usages

This commit is contained in:
Jobobby04 2023-10-01 15:56:07 -04:00
parent 68fdd471ac
commit 32a938e6d4
4 changed files with 12 additions and 16 deletions

View File

@ -26,9 +26,7 @@ import kotlinx.coroutines.flow.receiveAsFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import tachiyomi.core.util.lang.awaitSingle
import tachiyomi.core.util.lang.launchIO
import tachiyomi.core.util.lang.launchNonCancellable
import tachiyomi.core.util.lang.withIOContext
@ -224,14 +222,14 @@ open class FeedScreenModel(
if (itemUI.source != null) {
withContext(coroutineDispatcher) {
if (itemUI.savedSearch == null) {
itemUI.source.fetchLatestUpdates(1)
itemUI.source.getLatestUpdates(1)
} else {
itemUI.source.fetchSearchManga(
itemUI.source.getSearchManga(
1,
itemUI.savedSearch.query.orEmpty(),
getFilterList(itemUI.savedSearch, itemUI.source),
)
}.awaitSingle()
}
}.mangas
} else {
emptyList()

View File

@ -154,14 +154,14 @@ open class SourceFeedScreenModel(
val page = try {
withContext(coroutineDispatcher) {
when (sourceFeed) {
is SourceFeedUI.Browse -> source.fetchPopularManga(1)
is SourceFeedUI.Latest -> source.fetchLatestUpdates(1)
is SourceFeedUI.SourceSavedSearch -> source.fetchSearchManga(
is SourceFeedUI.Browse -> source.getPopularManga(1)
is SourceFeedUI.Latest -> source.getLatestUpdates(1)
is SourceFeedUI.SourceSavedSearch -> source.getSearchManga(
page = 1,
query = sourceFeed.savedSearch.query.orEmpty(),
filters = getFilterList(sourceFeed.savedSearch, source),
)
}.awaitSingle()
}
}.mangas
} catch (e: Exception) {
emptyList()

View File

@ -8,7 +8,6 @@ import info.debatty.java.stringsimilarity.NormalizedLevenshtein
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.supervisorScope
import tachiyomi.core.util.lang.awaitSingle
import tachiyomi.domain.manga.model.Manga
import java.util.Locale
@ -31,7 +30,7 @@ class SmartSearchEngine(
query
}
val searchResults = source.fetchSearchManga(1, builtQuery, FilterList()).awaitSingle()
val searchResults = source.getSearchManga(1, builtQuery, FilterList())
searchResults.mangas.map {
val cleanedMangaTitle = cleanSmartSearchTitle(it.originalTitle)
@ -54,7 +53,7 @@ class SmartSearchEngine(
} else {
title
}
val searchResults = source.fetchSearchManga(1, searchQuery, FilterList()).awaitSingle()
val searchResults = source.getSearchManga(1, searchQuery, FilterList())
if (searchResults.mangas.size == 1) {
return@supervisorScope listOf(SearchEntry(searchResults.mangas.first(), 0.0))

View File

@ -6,7 +6,6 @@ import eu.kanade.tachiyomi.source.model.MangasPage
import eu.kanade.tachiyomi.source.model.MetadataMangasPage
import eu.kanade.tachiyomi.source.model.SManga
import exh.metadata.metadata.RaisedSearchMetadata
import tachiyomi.core.util.lang.awaitSingle
abstract class EHentaiPagingSource(override val source: CatalogueSource) : SourcePagingSource(source) {
@ -28,18 +27,18 @@ abstract class EHentaiPagingSource(override val source: CatalogueSource) : Sourc
class EHentaiSearchPagingSource(source: CatalogueSource, val query: String, val filters: FilterList) : EHentaiPagingSource(source) {
override suspend fun requestNextPage(currentPage: Int): MangasPage {
return source.fetchSearchManga(currentPage, query, filters).awaitSingle()
return source.getSearchManga(currentPage, query, filters)
}
}
class EHentaiPopularPagingSource(source: CatalogueSource) : EHentaiPagingSource(source) {
override suspend fun requestNextPage(currentPage: Int): MangasPage {
return source.fetchPopularManga(currentPage).awaitSingle()
return source.getPopularManga(currentPage)
}
}
class EHentaiLatestPagingSource(source: CatalogueSource) : EHentaiPagingSource(source) {
override suspend fun requestNextPage(currentPage: Int): MangasPage {
return source.fetchLatestUpdates(currentPage).awaitSingle()
return source.getLatestUpdates(currentPage)
}
}