SY linting
This commit is contained in:
parent
d58dda10d4
commit
3562816e89
@ -32,7 +32,9 @@ abstract class SourcePagingSource(
|
||||
// SY -->
|
||||
val metadata = if (mangasPage is MetadataMangasPage) {
|
||||
mangasPage.mangasMetadata
|
||||
} else emptyList()
|
||||
} else {
|
||||
emptyList()
|
||||
}
|
||||
// SY <--
|
||||
|
||||
return LoadResult.Page(
|
||||
|
@ -181,7 +181,9 @@ class SyncChaptersWithSource(
|
||||
updatedToAdd = updatedToAdd.map {
|
||||
if (it !in reAdded) {
|
||||
it.copy(lastPageRead = max)
|
||||
} else it
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,9 @@ class GetFlatMetadataById(
|
||||
val titles = mangaMetadataRepository.getTitlesById(id)
|
||||
|
||||
FlatMetadata(meta, tags, titles)
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
logcat(LogPriority.ERROR, e)
|
||||
null
|
||||
@ -34,7 +36,9 @@ class GetFlatMetadataById(
|
||||
) { meta, tags, titles ->
|
||||
if (meta != null) {
|
||||
FlatMetadata(meta, tags, titles)
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,9 @@ class GetSortTag(private val preferences: PreferencesHelper) {
|
||||
val index = it.indexOf('|')
|
||||
if (index != -1) {
|
||||
(it.substring(0, index).toIntOrNull() ?: return@mapNotNull null) to it.substring(index + 1)
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
.sortedBy { it.first }.map { it.second }
|
||||
}
|
||||
|
@ -38,7 +38,9 @@ class UpdateManga(
|
||||
val title = if (remoteManga.title.isNotBlank() && localManga.ogTitle != remoteManga.title) {
|
||||
downloadManager.renameMangaDir(localManga.ogTitle, remoteManga.title, localManga.source)
|
||||
remoteManga.title
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
// SY <--
|
||||
|
||||
val coverLastModified =
|
||||
|
@ -43,7 +43,9 @@ data class Manga(
|
||||
// SY -->
|
||||
private val customMangaInfo = if (favorite) {
|
||||
customMangaManager.getManga(this)
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
val title: String
|
||||
get() = customMangaInfo?.title ?: ogTitle
|
||||
|
@ -20,7 +20,9 @@ class RenameSourceCategory(
|
||||
val index = it.indexOf('|')
|
||||
if (index != -1 && it.substring(index + 1) == categoryOld) {
|
||||
it.substring(0, index + 1) + categoryNew
|
||||
} else it
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
.toSet(),
|
||||
)
|
||||
|
@ -317,7 +317,9 @@ private infix fun String.plusRepo(extension: Extension): String {
|
||||
} else {
|
||||
"$this • "
|
||||
} + context.getString(R.string.repo_source)
|
||||
} else this
|
||||
} else {
|
||||
this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,9 @@ fun SourceHeader(
|
||||
Text(
|
||||
text = if (!isCategory) {
|
||||
LocaleHelper.getSourceDisplayName(language, context)
|
||||
} else language,
|
||||
} else {
|
||||
language
|
||||
},
|
||||
modifier = modifier
|
||||
.padding(horizontal = horizontalPadding, vertical = 8.dp),
|
||||
style = MaterialTheme.typography.header,
|
||||
|
@ -124,7 +124,9 @@ fun BrowseSourceEHentaiListItem(
|
||||
resources.getQuantityString(R.plurals.browse_language_and_pages, pageCount, pageCount, locale.toLanguageTag().uppercase())
|
||||
} else if (pageCount != null) {
|
||||
resources.getQuantityString(R.plurals.num_pages, pageCount, pageCount)
|
||||
} else locale?.toLanguageTag()?.uppercase().orEmpty()
|
||||
} else {
|
||||
locale?.toLanguageTag()?.uppercase().orEmpty()
|
||||
}
|
||||
}
|
||||
}
|
||||
val datePosted by produceState("", metadata) {
|
||||
@ -237,7 +239,9 @@ fun BrowseSourceEHentaiListItem(
|
||||
Card(
|
||||
colors = if (color != null) {
|
||||
CardDefaults.cardColors(Color(color))
|
||||
} else CardDefaults.cardColors(),
|
||||
} else {
|
||||
CardDefaults.cardColors()
|
||||
},
|
||||
) {
|
||||
Text(
|
||||
text = if (res != null) {
|
||||
|
@ -132,7 +132,9 @@ fun BrowseSourceRegularToolbar(
|
||||
icon = Icons.Outlined.Settings,
|
||||
onClick = onSettingsClick,
|
||||
)
|
||||
} else null,
|
||||
} else {
|
||||
null
|
||||
},
|
||||
// SY <--
|
||||
),
|
||||
)
|
||||
|
@ -137,5 +137,5 @@ fun LibraryGridCover(
|
||||
|
||||
enum class PlayButtonPosition(val alignment: Alignment) {
|
||||
Top(Alignment.TopEnd),
|
||||
Bottom(Alignment.BottomEnd)
|
||||
Bottom(Alignment.BottomEnd),
|
||||
}
|
||||
|
@ -70,7 +70,9 @@ value class SearchMetadataChips(
|
||||
EHentaiSearchMetadata.TAG_TYPE_LIGHT -> 1
|
||||
else -> null
|
||||
}
|
||||
} else null,
|
||||
} else {
|
||||
null
|
||||
},
|
||||
)
|
||||
}
|
||||
.groupBy { it.namespace.orEmpty() },
|
||||
@ -86,7 +88,9 @@ value class SearchMetadataChips(
|
||||
it.namespace.orEmpty()
|
||||
},
|
||||
)
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -331,7 +331,9 @@ class Downloader(
|
||||
|
||||
val dataSaver = if (preferences.dataSaverDownloader().get()) {
|
||||
DataSaver(download.source, preferences)
|
||||
} else DataSaver.NoOp
|
||||
} else {
|
||||
DataSaver.NoOp
|
||||
}
|
||||
|
||||
pageListObservable
|
||||
.doOnNext { _ ->
|
||||
|
@ -142,7 +142,7 @@ class LibraryUpdateService(
|
||||
// SY -->
|
||||
SYNC_FOLLOWS, // MangaDex specific, pull mangadex manga in reading, rereading
|
||||
|
||||
PUSH_FAVORITES // MangaDex specific, push mangadex manga to mangadex
|
||||
PUSH_FAVORITES, // MangaDex specific, push mangadex manga to mangadex
|
||||
// SY <--
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,7 @@ object PreferenceValues {
|
||||
enum class GroupLibraryMode {
|
||||
GLOBAL,
|
||||
ALL_BUT_UNGROUPED,
|
||||
ALL
|
||||
ALL,
|
||||
}
|
||||
// SY <--
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ enum class TrackStatus(val int: Int, @StringRes val res: Int) {
|
||||
PAUSED(4, R.string.on_hold),
|
||||
COMPLETED(5, R.string.completed),
|
||||
DROPPED(6, R.string.dropped),
|
||||
OTHER(7, R.string.not_tracked);
|
||||
OTHER(7, R.string.not_tracked),
|
||||
;
|
||||
|
||||
companion object {
|
||||
fun parseTrackerStatus(tracker: Long, statusLong: Long): TrackStatus? {
|
||||
|
@ -100,7 +100,9 @@ class MdList(private val context: Context, id: Long) : TrackService(id) {
|
||||
if (it.status == FollowStatus.UNFOLLOWED.int) {
|
||||
it.status = if (hasReadChapters) {
|
||||
FollowStatus.READING.int
|
||||
} else FollowStatus.PLAN_TO_READ.int
|
||||
} else {
|
||||
FollowStatus.PLAN_TO_READ.int
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
@ -122,8 +122,12 @@ class SourceManager(
|
||||
val matched = factories.find { sourceQName.startsWith(it) }
|
||||
if (matched != null) {
|
||||
DELEGATED_SOURCES[matched]
|
||||
} else DELEGATED_SOURCES[sourceQName]
|
||||
} else null
|
||||
} else {
|
||||
DELEGATED_SOURCES[sourceQName]
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
val newSource = if (this is HttpSource && delegate != null) {
|
||||
xLogD("Delegating source: %s -> %s!", sourceQName, delegate.newSourceClass.qualifiedName)
|
||||
val enhancedSource = EnhancedHttpSource(
|
||||
@ -139,12 +143,16 @@ class SourceManager(
|
||||
delegate.factory,
|
||||
)
|
||||
enhancedSource
|
||||
} else this
|
||||
} else {
|
||||
this
|
||||
}
|
||||
|
||||
return if (id in BlacklistedSources.BLACKLISTED_EXT_SOURCES) {
|
||||
xLogD("Removing blacklisted source: (id: %s, name: %s, lang: %s)!", id, name, (this as? CatalogueSource)?.lang)
|
||||
null
|
||||
} else newSource
|
||||
} else {
|
||||
newSource
|
||||
}
|
||||
// EXH <--
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,6 @@ interface LoginSource : Source {
|
||||
enum class AuthSupport {
|
||||
NOT_SUPPORTED,
|
||||
SUPPORTED,
|
||||
REQUIRED
|
||||
REQUIRED,
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,9 @@ interface MetadataSource<M : RaisedSearchMetadata, I> : CatalogueSource {
|
||||
val metadata = if (mangaId != null) {
|
||||
val flatMetadata = getFlatMetadataById.await(mangaId)
|
||||
flatMetadata?.raise(metaClass) ?: newMetaInstance()
|
||||
} else newMetaInstance()
|
||||
} else {
|
||||
newMetaInstance()
|
||||
}
|
||||
|
||||
parseIntoMetadata(metadata, input)
|
||||
if (mangaId != null) {
|
||||
|
@ -267,7 +267,9 @@ class EHentai(
|
||||
return if (text != null) {
|
||||
val date = MetadataUtil.EX_DATE_FORMAT.parse(text)
|
||||
date?.time
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun getRating(element: Element?): Double? {
|
||||
@ -279,9 +281,15 @@ class EHentai(
|
||||
if (matches[1] == 21) {
|
||||
rate--
|
||||
rate + 0.5
|
||||
} else rate.toDouble()
|
||||
} else null
|
||||
} else null
|
||||
} else {
|
||||
rate.toDouble()
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun getUploader(element: Element?): String? {
|
||||
@ -292,7 +300,9 @@ class EHentai(
|
||||
val pageCount = element?.text()?.trimOrNull()
|
||||
return if (pageCount != null) {
|
||||
PAGE_COUNT_REGEX.find(pageCount)?.value?.toIntOrNull()
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -333,7 +343,9 @@ class EHentai(
|
||||
),
|
||||
)
|
||||
url = EHentaiSearchMetadata.normalizeUrl(parentLink)
|
||||
} else break
|
||||
} else {
|
||||
break
|
||||
}
|
||||
} else {
|
||||
this@EHentai.xLogD("Parent cache hit: %s!", gid)
|
||||
url = EHentaiSearchMetadata.idAndTokenToUrl(
|
||||
@ -393,9 +405,11 @@ class EHentai(
|
||||
}
|
||||
}!!
|
||||
.doOnNext { pages ->
|
||||
if (pages.any { it.url == "https://$domain/img/509.gif" }) throw Exception(
|
||||
"Hit page limit",
|
||||
)
|
||||
if (pages.any { it.url == "https://$domain/img/509.gif" }) {
|
||||
throw Exception(
|
||||
"Hit page limit",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetchChapterPage(
|
||||
@ -440,7 +454,9 @@ class EHentai(
|
||||
private fun <T : MangasPage> Observable<T>.checkValid(): Observable<MangasPage> = map {
|
||||
if (exh && it.mangas.isEmpty() && preferences.igneousVal().get().equals("mystery", true)) {
|
||||
throw Exception("Invalid igneous cookie, try re-logging or finding a correct one to input in the login menu")
|
||||
} else it
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
|
||||
override fun fetchLatestUpdates(page: Int): Observable<MangasPage> {
|
||||
@ -479,7 +495,9 @@ class EHentai(
|
||||
|
||||
val regularPage = if (toplist == ToplistOption.NONE) {
|
||||
page
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
val request = exGet(uri.toString(), regularPage)
|
||||
|
||||
@ -517,7 +535,9 @@ class EHentai(
|
||||
return GET(
|
||||
if (page != null) {
|
||||
addParam(url, "page", (page - 1).toString())
|
||||
} else url,
|
||||
} else {
|
||||
url
|
||||
},
|
||||
if (additionalHeaders != null) {
|
||||
val headers = headers.newBuilder()
|
||||
additionalHeaders.toMultimap().forEach { (t, u) ->
|
||||
@ -526,7 +546,9 @@ class EHentai(
|
||||
}
|
||||
}
|
||||
headers.build()
|
||||
} else headers,
|
||||
} else {
|
||||
headers
|
||||
},
|
||||
).let {
|
||||
if (cacheControl == null) {
|
||||
it
|
||||
@ -555,7 +577,9 @@ class EHentai(
|
||||
manga.url = EHentaiSearchMetadata.normalizeUrl(newerGallery.attr("href"))
|
||||
client.newCall(mangaDetailsRequest(manga))
|
||||
.asObservableSuccess().map { it.asJsoup() }
|
||||
} else Observable.just(doc)
|
||||
} else {
|
||||
Observable.just(doc)
|
||||
}
|
||||
|
||||
pre.flatMap {
|
||||
@Suppress("DEPRECATION")
|
||||
@ -591,7 +615,9 @@ class EHentai(
|
||||
url = EHentaiSearchMetadata.normalizeUrl(newerGallery.attr("href")),
|
||||
)
|
||||
client.newCall(mangaDetailsRequest(sManga)).await().asJsoup()
|
||||
} else doc
|
||||
} else {
|
||||
doc
|
||||
}
|
||||
return parseToManga(manga, pre)
|
||||
} else {
|
||||
response.close()
|
||||
@ -646,7 +672,9 @@ class EHentai(
|
||||
// Parent is older variation of the gallery
|
||||
"parent" -> parent = if (!right.equals("None", true)) {
|
||||
rightElement.child(0).attr("href")
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
"visible" -> visible = right.nullIfBlank()
|
||||
"language" -> {
|
||||
language = right.removeSuffix(TR_SUFFIX).trimOrNull()
|
||||
@ -884,7 +912,8 @@ class EHentai(
|
||||
ALL_TIME("All time", 11),
|
||||
PAST_YEAR("Past year", 12),
|
||||
PAST_MONTH("Past month", 13),
|
||||
YESTERDAY("Yesterday", 15);
|
||||
YESTERDAY("Yesterday", 15),
|
||||
;
|
||||
|
||||
override fun toString(): String {
|
||||
return humanName
|
||||
@ -1034,12 +1063,16 @@ class EHentai(
|
||||
|
||||
// === URL IMPORT STUFF
|
||||
|
||||
override val matchingHosts: List<String> = if (exh) listOf(
|
||||
"exhentai.org",
|
||||
) else listOf(
|
||||
"g.e-hentai.org",
|
||||
"e-hentai.org",
|
||||
)
|
||||
override val matchingHosts: List<String> = if (exh) {
|
||||
listOf(
|
||||
"exhentai.org",
|
||||
)
|
||||
} else {
|
||||
listOf(
|
||||
"g.e-hentai.org",
|
||||
"e-hentai.org",
|
||||
)
|
||||
}
|
||||
|
||||
override suspend fun mapUrlToMangaUrl(uri: Uri): String? {
|
||||
return when (uri.pathSegments.firstOrNull()) {
|
||||
|
@ -252,7 +252,9 @@ class MangaDex(delegate: HttpSource, val context: Context) :
|
||||
return if (result) {
|
||||
mdList.saveCredentials(username, password)
|
||||
true
|
||||
} else false
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun logout(): Boolean {
|
||||
|
@ -117,9 +117,13 @@ class MergedSource : HttpSource() {
|
||||
"$source: ${chapter.scanlator}"
|
||||
},
|
||||
)
|
||||
} else chapter
|
||||
} else {
|
||||
chapter
|
||||
}
|
||||
}
|
||||
} else chapterList
|
||||
} else {
|
||||
chapterList
|
||||
}
|
||||
return if (dedupe) dedupeChapterList(mangaReferences, chapters) else chapters
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,9 @@ class Pururin(delegate: HttpSource, val context: Context) :
|
||||
val trimmedIdQuery = query.trim().removePrefix("id:")
|
||||
val newQuery = if (trimmedIdQuery.toIntOrNull() ?: -1 >= 0) {
|
||||
"$baseUrl/gallery/$trimmedIdQuery/-"
|
||||
} else query
|
||||
} else {
|
||||
query
|
||||
}
|
||||
|
||||
return urlImportFetchSearchManga(context, newQuery) {
|
||||
super.fetchSearchManga(page, query, filters)
|
||||
|
@ -40,13 +40,17 @@ class BrowseController : FullComposeController<BrowsePresenter>, RootController
|
||||
titleRes = R.string.browse,
|
||||
// SY -->
|
||||
tabs = (
|
||||
if (presenter.feedTabInFront) listOf(
|
||||
feedTab(router, presenter.feedPresenter),
|
||||
sourcesTab(router, presenter.sourcesPresenter),
|
||||
) else listOf(
|
||||
sourcesTab(router, presenter.sourcesPresenter),
|
||||
feedTab(router, presenter.feedPresenter),
|
||||
)
|
||||
if (presenter.feedTabInFront) {
|
||||
listOf(
|
||||
feedTab(router, presenter.feedPresenter),
|
||||
sourcesTab(router, presenter.sourcesPresenter),
|
||||
)
|
||||
} else {
|
||||
listOf(
|
||||
sourcesTab(router, presenter.sourcesPresenter),
|
||||
feedTab(router, presenter.feedPresenter),
|
||||
)
|
||||
}
|
||||
) + listOf(
|
||||
extensionsTab(router, presenter.extensionsPresenter),
|
||||
migrateSourcesTab(router, presenter.migrationSourcesPresenter),
|
||||
|
@ -290,7 +290,9 @@ open class FeedPresenter(
|
||||
}
|
||||
},
|
||||
)
|
||||
} else itemUI
|
||||
} else {
|
||||
itemUI
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -45,7 +45,9 @@ class MigrationBottomSheetDialog(private val activity: Activity, private val lis
|
||||
listener.startMigration(
|
||||
if (binding.useSmartSearch.isChecked && binding.extraSearchParamText.text.isNotBlank()) {
|
||||
binding.extraSearchParamText.toString()
|
||||
} else null,
|
||||
} else {
|
||||
null
|
||||
},
|
||||
)
|
||||
dismiss()
|
||||
}
|
||||
|
@ -106,7 +106,9 @@ class MigrationListPresenter(
|
||||
if (manga.source == MERGED_SOURCE_ID) {
|
||||
getMergedReferencesById.await(manga.id)
|
||||
.map { sourceManager.getOrStub(it.mangaSourceId) }
|
||||
} else null,
|
||||
} else {
|
||||
null
|
||||
},
|
||||
),
|
||||
parentContext = presenterScope.coroutineContext,
|
||||
getManga = ::getManga,
|
||||
@ -233,7 +235,9 @@ class MigrationListPresenter(
|
||||
}
|
||||
syncChaptersWithSource.await(chapters, localManga, source)
|
||||
localManga
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} catch (e: CancellationException) {
|
||||
// Ignore cancellations
|
||||
throw e
|
||||
|
@ -32,7 +32,7 @@ class SourcesController(bundle: Bundle? = null) : FullComposeController<SourcesP
|
||||
|
||||
enum class Mode {
|
||||
CATALOGUE,
|
||||
SMART_SEARCH
|
||||
SMART_SEARCH,
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -40,7 +40,9 @@ fun sourcesTab(
|
||||
onClick = { router?.pushController(SourceFilterController()) },
|
||||
),
|
||||
)
|
||||
} else emptyList(),
|
||||
} else {
|
||||
emptyList()
|
||||
},
|
||||
// SY <--
|
||||
content = {
|
||||
SourcesScreen(
|
||||
|
@ -139,7 +139,9 @@ open class SourceFeedPresenter(
|
||||
return listOfNotNull(
|
||||
if (source.supportsLatest) {
|
||||
SourceFeedUI.Latest(null)
|
||||
} else null,
|
||||
} else {
|
||||
null
|
||||
},
|
||||
SourceFeedUI.Browse(null),
|
||||
) + feedSavedSearch
|
||||
.map { SourceFeedUI.SourceSavedSearch(it, savedSearches[it.savedSearch]!!, null) }
|
||||
@ -244,7 +246,9 @@ open class SourceFeedPresenter(
|
||||
}
|
||||
},
|
||||
)
|
||||
} else itemUI
|
||||
} else {
|
||||
itemUI
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -46,7 +46,9 @@ data class TimeRange(private val startTime: Duration, private val endTime: Durat
|
||||
timeRange.substring(0, index).toDoubleOrNull()?.minutes ?: return null,
|
||||
timeRange.substring(index + 1).toDoubleOrNull()?.minutes ?: return null,
|
||||
)
|
||||
} else return null
|
||||
} else {
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -353,8 +353,11 @@ class LibraryPresenter(
|
||||
if (filterLewd == State.IGNORE.value) return@lewd true
|
||||
val isLewd = item.manga.isLewd()
|
||||
|
||||
return@lewd if (filterLewd == State.INCLUDE.value) isLewd
|
||||
else !isLewd
|
||||
return@lewd if (filterLewd == State.INCLUDE.value) {
|
||||
isLewd
|
||||
} else {
|
||||
!isLewd
|
||||
}
|
||||
}
|
||||
// SY <--
|
||||
|
||||
@ -412,7 +415,9 @@ class LibraryPresenter(
|
||||
getMergedMangaById.await(mergeMangaId)
|
||||
}.sumOf { downloadManager.getDownloadCount(it) }
|
||||
} ?: 0
|
||||
} else /* SY <-- */ downloadManager.getDownloadCount(item.manga.toDomainManga()!!)
|
||||
} else {
|
||||
/* SY <-- */ downloadManager.getDownloadCount(item.manga.toDomainManga()!!)
|
||||
}
|
||||
} else {
|
||||
// Unset download count if not enabled
|
||||
-1
|
||||
@ -758,8 +763,10 @@ class LibraryPresenter(
|
||||
getChapterByMangaId.await(manga.id).minByOrNull { it.sourceOrder }
|
||||
?.takeUnless { it.read }
|
||||
.let(::listOfNotNull)
|
||||
} else /* SY <-- */ getChapterByMangaId.await(manga.id)
|
||||
.filter { !it.read }
|
||||
} else {
|
||||
/* SY <-- */ getChapterByMangaId.await(manga.id)
|
||||
.filter { !it.read }
|
||||
}
|
||||
|
||||
downloadManager.downloadChapters(manga, chapters.map { it.toDbChapter() })
|
||||
}
|
||||
@ -852,7 +859,9 @@ class LibraryPresenter(
|
||||
val mergedSource = sources.firstOrNull { mergedManga.source == it.id } as? HttpSource ?: return@merge
|
||||
downloadManager.deleteManga(mergedManga, mergedSource)
|
||||
}
|
||||
} else downloadManager.deleteManga(manga.toDomainManga()!!, source)
|
||||
} else {
|
||||
downloadManager.deleteManga(manga.toDomainManga()!!, source)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -905,7 +914,9 @@ class LibraryPresenter(
|
||||
return produceState(initialValue = default, category, loadedManga, mangaCountVisibility, tabVisibility, groupType, context) {
|
||||
val title = if (tabVisibility.not()) {
|
||||
getCategoryName(context, category, groupType, categoryName)
|
||||
} else defaultTitle
|
||||
} else {
|
||||
defaultTitle
|
||||
}
|
||||
val count = when {
|
||||
category == null || mangaCountVisibility.not() -> null
|
||||
tabVisibility.not() -> loadedManga[category.id]?.size
|
||||
@ -966,7 +977,9 @@ class LibraryPresenter(
|
||||
val mangaWithMetaIds = getIdsOfFavoriteMangaWithMetadata.await()
|
||||
val tracks = if (loggedServices.isNotEmpty()) {
|
||||
getTracks.await(unfiltered.mapNotNull { it.manga.id }.distinct())
|
||||
} else emptyMap()
|
||||
} else {
|
||||
emptyMap()
|
||||
}
|
||||
val sources = unfiltered
|
||||
.distinctBy { it.manga.source }
|
||||
.mapNotNull { sourceManager.get(it.manga.source) }
|
||||
@ -1091,7 +1104,9 @@ class LibraryPresenter(
|
||||
val status = trackService.getStatus(it.status.toInt())
|
||||
val name = services[it.syncId]
|
||||
status.contains(constraint, true) || name?.contains(constraint, true) == true
|
||||
} else false
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1150,7 +1165,9 @@ class LibraryPresenter(
|
||||
fun getFirstUnread(manga: Manga): Chapter? {
|
||||
val chapters = if (manga.source == MERGED_SOURCE_ID) {
|
||||
(sourceManager.get(MERGED_SOURCE_ID) as MergedSource).getChaptersAsBlocking(manga.id)
|
||||
} else runBlocking { getChapterByMangaId.await(manga.id) }
|
||||
} else {
|
||||
runBlocking { getChapterByMangaId.await(manga.id) }
|
||||
}
|
||||
return if (manga.isEhBasedManga()) {
|
||||
val chapter = chapters.sortedBy { it.sourceOrder }.getOrNull(0)
|
||||
if (chapter?.read == false) chapter else null
|
||||
|
@ -231,7 +231,9 @@ class EditMangaDialog : DialogController {
|
||||
private fun ChipGroup.getTextStrings(): List<String> = children.mapNotNull {
|
||||
if (it is Chip && !it.text.toString().contains(context.getString(R.string.add_tag), ignoreCase = true)) {
|
||||
it.text.toString()
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}.toList()
|
||||
|
||||
private companion object {
|
||||
|
@ -284,7 +284,9 @@ class MangaPresenter(
|
||||
) { (manga, chapters), mergedChapters ->
|
||||
if (manga.source == MERGED_SOURCE_ID) {
|
||||
manga to mergedChapters
|
||||
} else manga to chapters
|
||||
} else {
|
||||
manga to chapters
|
||||
}
|
||||
}
|
||||
.onEach { (manga, chapters) ->
|
||||
if (chapters.isNotEmpty() && manga.isEhBasedManga() && DebugToggles.ENABLE_EXH_ROOT_REDIRECT.enabled) {
|
||||
@ -333,7 +335,9 @@ class MangaPresenter(
|
||||
references.map { it.mangaSourceId }.distinct()
|
||||
.map { sourceManager.getOrStub(it) },
|
||||
)
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
},
|
||||
) { state, mergedData ->
|
||||
state.copy(mergedData = mergedData)
|
||||
@ -420,7 +424,9 @@ class MangaPresenter(
|
||||
return if (flatMetadata != null) {
|
||||
val metaClass = source.getMainSource<MetadataSource<*, *>>()?.metaClass
|
||||
if (metaClass != null) flatMetadata.raise(metaClass) else null
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun updateMangaInfo(
|
||||
@ -765,7 +771,9 @@ class MangaPresenter(
|
||||
mergedManga?.forEach { (manga, source) ->
|
||||
downloadManager.deleteManga(manga, source)
|
||||
}
|
||||
} else /* SY <-- */ downloadManager.deleteManga(state.manga, state.source)
|
||||
} else {
|
||||
/* SY <-- */ downloadManager.deleteManga(state.manga, state.source)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1361,7 +1369,9 @@ class MangaPresenter(
|
||||
}
|
||||
else -> trackItems
|
||||
}
|
||||
} else trackItems
|
||||
} else {
|
||||
trackItems
|
||||
}
|
||||
}
|
||||
// SY <--
|
||||
.collectLatest { trackItems ->
|
||||
|
@ -61,7 +61,9 @@ class EditMergedMangaHolder(view: View, val adapter: EditMergedMangaAdapter) : F
|
||||
fun updateDownloadChaptersIcon(setTint: Boolean) {
|
||||
val color = if (setTint) {
|
||||
itemView.context.getResourceColor(R.attr.colorAccent)
|
||||
} else itemView.context.getResourceColor(R.attr.colorOnSurface)
|
||||
} else {
|
||||
itemView.context.getResourceColor(R.attr.colorOnSurface)
|
||||
}
|
||||
|
||||
binding.download.drawable.setTint(color)
|
||||
}
|
||||
@ -69,7 +71,9 @@ class EditMergedMangaHolder(view: View, val adapter: EditMergedMangaAdapter) : F
|
||||
fun updateChapterUpdatesIcon(setTint: Boolean) {
|
||||
val color = if (setTint) {
|
||||
itemView.context.getResourceColor(R.attr.colorAccent)
|
||||
} else itemView.context.getResourceColor(R.attr.colorOnSurface)
|
||||
} else {
|
||||
itemView.context.getResourceColor(R.attr.colorOnSurface)
|
||||
}
|
||||
|
||||
binding.getChapterUpdates.drawable.setTint(color)
|
||||
}
|
||||
|
@ -99,7 +99,9 @@ class EditMergedSettingsHeaderAdapter(private val controller: EditMergedSettings
|
||||
mergedMangas.indexOfFirst { it.second.isInfoManga }.let {
|
||||
if (it != -1) {
|
||||
binding.mangaInfoSpinner.setSelection(it)
|
||||
} else binding.mangaInfoSpinner.setSelection(0)
|
||||
} else {
|
||||
binding.mangaInfoSpinner.setSelection(0)
|
||||
}
|
||||
}
|
||||
|
||||
binding.mangaInfoSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||
|
@ -174,7 +174,9 @@ class ReaderPresenter(
|
||||
/* SY --> */ if (manga.source == MERGED_SOURCE_ID) {
|
||||
(sourceManager.get(MERGED_SOURCE_ID) as MergedSource)
|
||||
.getChapters(manga.id!!)
|
||||
} else /* SY <-- */ getChapterByMangaId.await(manga.id!!)
|
||||
} else {
|
||||
/* SY <-- */ getChapterByMangaId.await(manga.id!!)
|
||||
}
|
||||
}
|
||||
|
||||
val selectedChapter = chapters.find { it.id == chapterId }
|
||||
@ -303,7 +305,9 @@ class ReaderPresenter(
|
||||
val source = sourceManager.get(manga.source)?.getMainSource<MetadataSource<*, *>>()
|
||||
val metadata = if (source != null) {
|
||||
getFlatMetadataById.await(mangaId)?.raise(source.metaClass)
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
withUIContext {
|
||||
init(manga.toDbManga(), initialChapterId, metadata)
|
||||
}
|
||||
|
@ -439,7 +439,11 @@ class PagerPageHolder(
|
||||
|
||||
val centerMargin = if (viewer.config.centerMarginType and PagerConfig.CenterMarginType.DOUBLE_PAGE_CENTER_MARGIN > 0 &&
|
||||
!viewer.config.imageCropBorders
|
||||
) 96 / (max(1, getHeight()) / max(height, height2)) else 0
|
||||
) {
|
||||
96 / (max(1, getHeight()) / max(height, height2))
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
||||
return ImageUtil.mergeBitmaps(imageBitmap, imageBitmap2, isLTR, centerMargin, viewer.config.pageCanvasColor) {
|
||||
viewer.scope.launchUI {
|
||||
@ -480,7 +484,11 @@ class PagerPageHolder(
|
||||
|
||||
val sideMargin = if ((viewer.config.centerMarginType and PagerConfig.CenterMarginType.DOUBLE_PAGE_CENTER_MARGIN) > 0 &&
|
||||
viewer.config.doublePages && !viewer.config.imageCropBorders
|
||||
) 48 else 0
|
||||
) {
|
||||
48
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
||||
return ImageUtil.splitInHalf(imageStream, side, sideMargin)
|
||||
}
|
||||
|
@ -276,9 +276,13 @@ class PagerViewerAdapter(private val viewer: PagerViewer) : ViewPagerAdapter() {
|
||||
val fullPageBeforeIndex = max(
|
||||
0,
|
||||
(
|
||||
if (index > -1) (
|
||||
items.take(index).indexOfLast { it?.fullPage == true }
|
||||
) else -1
|
||||
if (index > -1) {
|
||||
(
|
||||
items.take(index).indexOfLast { it?.fullPage == true }
|
||||
)
|
||||
} else {
|
||||
-1
|
||||
}
|
||||
),
|
||||
)
|
||||
// Add a shifted page to the first place there isnt a full page
|
||||
|
@ -554,12 +554,15 @@ class SettingsAdvancedController(
|
||||
withUIContext {
|
||||
val activity = activity ?: return@withUIContext
|
||||
val cleanupString =
|
||||
if (foldersCleared == 0) activity.getString(R.string.no_folders_to_cleanup)
|
||||
else resources!!.getQuantityString(
|
||||
R.plurals.cleanup_done,
|
||||
foldersCleared,
|
||||
foldersCleared,
|
||||
)
|
||||
if (foldersCleared == 0) {
|
||||
activity.getString(R.string.no_folders_to_cleanup)
|
||||
} else {
|
||||
resources!!.getQuantityString(
|
||||
R.plurals.cleanup_done,
|
||||
foldersCleared,
|
||||
foldersCleared,
|
||||
)
|
||||
}
|
||||
activity.toast(cleanupString, Toast.LENGTH_LONG)
|
||||
}
|
||||
}
|
||||
|
@ -470,7 +470,9 @@ class SettingsEhController : SettingsController() {
|
||||
|
||||
val statsText = if (stats != null) {
|
||||
context.getString(R.string.gallery_updater_stats_text, getRelativeTimeString(getRelativeTimeFromNow(stats.startTime.milliseconds), context), stats.updateCount, stats.possibleUpdates)
|
||||
} else context.getString(R.string.gallery_updater_not_ran_yet)
|
||||
} else {
|
||||
context.getString(R.string.gallery_updater_not_ran_yet)
|
||||
}
|
||||
|
||||
val allMeta = getExhFavoriteMangaWithMetadata.await()
|
||||
.mapNotNull {
|
||||
|
@ -82,14 +82,18 @@ class SettingsMainController : BasicFullComposeController() {
|
||||
painter = painterResource(R.drawable.eh_ic_ehlogo_red_24dp),
|
||||
onClick = { router.pushController(SettingsEhController()) },
|
||||
)
|
||||
} else null,
|
||||
} else {
|
||||
null
|
||||
},
|
||||
if (remember { MdUtil.getEnabledMangaDexs(preferences).isNotEmpty() }) {
|
||||
SettingsSection(
|
||||
titleRes = R.string.pref_category_mangadex,
|
||||
painter = painterResource(R.drawable.ic_tracker_mangadex_logo_24dp),
|
||||
onClick = { router.pushController(SettingsMangaDexController()) },
|
||||
)
|
||||
} else null,
|
||||
} else {
|
||||
null
|
||||
},
|
||||
// SY <--
|
||||
SettingsSection(
|
||||
titleRes = R.string.pref_category_advanced,
|
||||
|
@ -66,8 +66,11 @@ class GalleryAdder(
|
||||
// Find matching source
|
||||
val source = if (forceSource != null) {
|
||||
try {
|
||||
if (forceSource.matchesUri(uri)) forceSource
|
||||
else return GalleryAddEvent.Fail.UnknownSource(url, context)
|
||||
if (forceSource.matchesUri(uri)) {
|
||||
forceSource
|
||||
} else {
|
||||
return GalleryAddEvent.Fail.UnknownSource(url, context)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
logger.e(context.getString(R.string.gallery_adder_source_uri_must_match), e)
|
||||
return GalleryAddEvent.Fail.UnknownType(url, context)
|
||||
@ -98,11 +101,15 @@ class GalleryAdder(
|
||||
logger.e(context.getString(R.string.gallery_adder_uri_clean_error), e)
|
||||
null
|
||||
}
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
val chapterMangaUrl = if (realChapterUrl != null) {
|
||||
source.mapChapterUrlToMangaUrl(realChapterUrl.toUri())
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
// Map URL to manga URL
|
||||
val realMangaUrl = try {
|
||||
|
@ -20,7 +20,8 @@ enum class DebugToggles(val default: Boolean) {
|
||||
RESTRICT_EXH_GALLERY_UPDATE_CHECK_FREQUENCY(true),
|
||||
|
||||
// Pretend that all galleries only have a single version
|
||||
INCLUDE_ONLY_ROOT_WHEN_LOADING_EXH_VERSIONS(false);
|
||||
INCLUDE_ONLY_ROOT_WHEN_LOADING_EXH_VERSIONS(false),
|
||||
;
|
||||
|
||||
private val prefKey = "eh_debug_toggle_${name.lowercase(Locale.US)}"
|
||||
|
||||
|
@ -162,7 +162,9 @@ class SettingsDebugController : BasicFullComposeController() {
|
||||
.capitalize(Locale.getDefault()),
|
||||
subtitleAnnotated = if (pref.value != default) {
|
||||
AnnotatedString("MODIFIED", SpanStyle(color = Color.Red))
|
||||
} else null,
|
||||
} else {
|
||||
null
|
||||
},
|
||||
)
|
||||
}
|
||||
item {
|
||||
|
@ -172,7 +172,9 @@ class EHentaiUpdateHelper(context: Context) {
|
||||
?.takeIf { it.chapterId != chapter.id && it.readAt != null }
|
||||
if (newHistory != null) {
|
||||
HistoryUpdate(chapter.id, newHistory.readAt!!, newHistory.readDuration)
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
val currentChapterIds = currentChapters.map { it.id }
|
||||
val historyToDelete = chainsAsHistory.filterNot { it.chapterId in currentChapterIds }
|
||||
@ -207,7 +209,9 @@ class EHentaiUpdateHelper(context: Context) {
|
||||
lastPageRead = lastPageRead,
|
||||
bookmark = bookmark,
|
||||
)
|
||||
} else it
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
} else {
|
||||
new = true
|
||||
@ -220,7 +224,9 @@ class EHentaiUpdateHelper(context: Context) {
|
||||
bookmark = chapter.bookmark,
|
||||
lastPageRead = if (newLastPageRead != null && chapter.lastPageRead <= 0) {
|
||||
newLastPageRead
|
||||
} else chapter.lastPageRead,
|
||||
} else {
|
||||
chapter.lastPageRead
|
||||
},
|
||||
dateFetch = chapter.dateFetch,
|
||||
dateUpload = chapter.dateUpload,
|
||||
chapterNumber = -1F,
|
||||
|
@ -9,7 +9,8 @@ import eu.kanade.tachiyomi.data.preference.PreferenceKeys
|
||||
enum class EHLogLevel(@StringRes val nameRes: Int, @StringRes val description: Int) {
|
||||
MINIMAL(R.string.log_minimal, R.string.log_minimal_desc),
|
||||
EXTRA(R.string.log_extra, R.string.log_extra_desc),
|
||||
EXTREME(R.string.log_extreme, R.string.log_extreme_desc);
|
||||
EXTREME(R.string.log_extreme, R.string.log_extreme_desc),
|
||||
;
|
||||
|
||||
companion object {
|
||||
private var curLogLevel: Int? = null
|
||||
|
@ -49,7 +49,9 @@ class ApiMangaParser(
|
||||
val metadata = if (mangaId != null) {
|
||||
val flatMetadata = getFlatMetadataById.await(mangaId)
|
||||
flatMetadata?.raise(metaClass) ?: newMetaInstance()
|
||||
} else newMetaInstance()
|
||||
} else {
|
||||
newMetaInstance()
|
||||
}
|
||||
|
||||
parseIntoMetadata(metadata, input, simpleChapters, statistics)
|
||||
if (mangaId != null) {
|
||||
@ -253,7 +255,9 @@ class ApiMangaParser(
|
||||
.map {
|
||||
if (it == "no group") {
|
||||
"No Group"
|
||||
} else it
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}
|
||||
.toSet()
|
||||
.ifEmpty { setOf("No Group") }
|
||||
|
@ -9,7 +9,8 @@ enum class FollowStatus(val int: Int) {
|
||||
ON_HOLD(3),
|
||||
PLAN_TO_READ(4),
|
||||
DROPPED(5),
|
||||
RE_READING(6);
|
||||
RE_READING(6),
|
||||
;
|
||||
|
||||
fun toDex(): String = this.name.lowercase(Locale.US)
|
||||
|
||||
|
@ -20,7 +20,8 @@ enum class MangaDexRelation(@StringRes val resId: Int, val mdString: String?) {
|
||||
PRESERIALIZATION(R.string.relation_preserialization, "preserialization"),
|
||||
COLORED(R.string.relation_colored, "colored"),
|
||||
SERIALIZATION(R.string.relation_serialization, "serialization"),
|
||||
ALTERNATE_VERSION(R.string.relation_alternate_version, "alternate_version");
|
||||
ALTERNATE_VERSION(R.string.relation_alternate_version, "alternate_version"),
|
||||
;
|
||||
|
||||
companion object {
|
||||
fun fromDex(mdString: String) = values().find { it.mdString == mdString }
|
||||
|
@ -291,7 +291,9 @@ class MdUtil {
|
||||
?: if (originalLanguage == "ja") {
|
||||
langMap["ja-ro"]
|
||||
?: langMap["jp-ro"]
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun getAltTitle(langMaps: List<Map<String, String>>, currentLang: String, originalLanguage: String): String? {
|
||||
@ -300,7 +302,9 @@ class MdUtil {
|
||||
?: if (originalLanguage == "ja") {
|
||||
langMaps.firstNotNullOfOrNull { it["ja-ro"] }
|
||||
?: langMaps.firstNotNullOfOrNull { it["jp-ro"] }
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun cdnCoverUrl(dexId: String, fileName: String): String {
|
||||
|
@ -28,7 +28,9 @@ class HBrowseSearchMetadata : RaisedSearchMetadata() {
|
||||
// Guess thumbnail URL if manga does not have thumbnail URL
|
||||
val cover = if (manga.thumbnail_url.isNullOrBlank()) {
|
||||
guessThumbnailUrl(hbId.toString())
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
val artist = tags.ofNamespace(ARTIST_NAMESPACE).joinToString { it.name }
|
||||
|
||||
|
@ -45,7 +45,9 @@ class NHentaiSearchMetadata : RaisedSearchMetadata() {
|
||||
typeToExtension(coverImageType)?.let {
|
||||
"https://t.nhentai.net/galleries/$mediaId/cover.$it"
|
||||
}
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
val title = when (preferredTitle) {
|
||||
TITLE_TYPE_SHORT -> shortTitle ?: englishTitle ?: japaneseTitle ?: manga.title
|
||||
|
@ -40,7 +40,9 @@ val MANGADEX_LOGIN_PATCH: EHInterceptor = { request, response, sourceId ->
|
||||
)
|
||||
}
|
||||
}
|
||||
} else response
|
||||
} else {
|
||||
response
|
||||
}
|
||||
}
|
||||
|
||||
val MANGADEX_SOURCE_IDS = listOf(
|
||||
|
@ -20,8 +20,11 @@ fun OkHttpClient.Builder.injectPatches(sourceIdProducer: () -> Long): OkHttpClie
|
||||
|
||||
fun findAndApplyPatches(sourceId: Long): EHInterceptor {
|
||||
// TODO make it so captcha doesnt auto open in manga eden while applying universal interceptors
|
||||
return if (Injekt.get<PreferencesHelper>().autoSolveCaptcha().get()) (EH_INTERCEPTORS[sourceId].orEmpty() + EH_INTERCEPTORS[EH_UNIVERSAL_INTERCEPTOR].orEmpty()).merge()
|
||||
else EH_INTERCEPTORS[sourceId].orEmpty().merge()
|
||||
return if (Injekt.get<PreferencesHelper>().autoSolveCaptcha().get()) {
|
||||
(EH_INTERCEPTORS[sourceId].orEmpty() + EH_INTERCEPTORS[EH_UNIVERSAL_INTERCEPTOR].orEmpty()).merge()
|
||||
} else {
|
||||
EH_INTERCEPTORS[sourceId].orEmpty().merge()
|
||||
}
|
||||
}
|
||||
|
||||
fun List<EHInterceptor>.merge(): EHInterceptor {
|
||||
|
@ -19,5 +19,7 @@ val CAPTCHA_DETECTION_PATCH: EHInterceptor = { request, response, sourceId ->
|
||||
)
|
||||
}
|
||||
}
|
||||
} else response
|
||||
} else {
|
||||
response
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,9 @@ class SearchEngine {
|
||||
textToSubQueries(component.namespace, null)
|
||||
}
|
||||
}
|
||||
} else error("Unknown query component!")
|
||||
} else {
|
||||
error("Unknown query component!")
|
||||
}
|
||||
|
||||
if (query != null) {
|
||||
(if (component.excluded) exclude else include) += query
|
||||
|
@ -34,7 +34,9 @@ class SmartSearchEngine(
|
||||
async(Dispatchers.Default) {
|
||||
val builtQuery = if (extraSearchParams != null) {
|
||||
"$query ${extraSearchParams.trim()}"
|
||||
} else query
|
||||
} else {
|
||||
query
|
||||
}
|
||||
|
||||
val searchResults = source.fetchSearchManga(1, builtQuery, FilterList()).awaitSingle()
|
||||
|
||||
@ -56,7 +58,9 @@ class SmartSearchEngine(
|
||||
val eligibleManga = supervisorScope {
|
||||
val searchQuery = if (extraSearchParams != null) {
|
||||
"$title ${extraSearchParams.trim()}"
|
||||
} else title
|
||||
} else {
|
||||
title
|
||||
}
|
||||
val searchResults = source.fetchSearchManga(1, searchQuery, FilterList()).awaitSingle()
|
||||
|
||||
if (searchResults.mangas.size == 1) {
|
||||
|
@ -82,7 +82,8 @@ object Entry {
|
||||
enum class UseHentaiAtHome(override val value: String) : ConfigItem {
|
||||
ANY("0"),
|
||||
DEFAULTONLY("1"),
|
||||
NO("2");
|
||||
NO("2"),
|
||||
;
|
||||
|
||||
override val key = "uh"
|
||||
}
|
||||
@ -94,7 +95,8 @@ object Entry {
|
||||
`1600`("4"),
|
||||
`1280`("3"),
|
||||
`980`("2"),
|
||||
`780`("1");
|
||||
`780`("1"),
|
||||
;
|
||||
|
||||
override val key = "xr"
|
||||
}
|
||||
@ -102,7 +104,8 @@ object Entry {
|
||||
|
||||
enum class TitleDisplayLanguage(override val value: String) : ConfigItem {
|
||||
DEFAULT("0"),
|
||||
JAPANESE("1");
|
||||
JAPANESE("1"),
|
||||
;
|
||||
|
||||
override val key = "tl"
|
||||
}
|
||||
@ -118,7 +121,8 @@ object Entry {
|
||||
`25`("0"),
|
||||
`50`("1"),
|
||||
`100`("2"),
|
||||
`200`("3");
|
||||
`200`("3"),
|
||||
;
|
||||
|
||||
override val key = "rc"
|
||||
}
|
||||
@ -127,7 +131,8 @@ object Entry {
|
||||
`4`("0"),
|
||||
`10`("1"),
|
||||
`20`("2"),
|
||||
`40`("3");
|
||||
`40`("3"),
|
||||
;
|
||||
|
||||
override val key = "tr"
|
||||
}
|
||||
@ -135,7 +140,8 @@ object Entry {
|
||||
|
||||
enum class UseOriginalImages(override val value: String) : ConfigItem {
|
||||
NO("0"),
|
||||
YES("1");
|
||||
YES("1"),
|
||||
;
|
||||
|
||||
override val key = "oi"
|
||||
}
|
||||
|
@ -76,7 +76,9 @@ class BrowserActionActivity : AppCompatActivity() {
|
||||
NoopActionCompletionVerifier(it)
|
||||
}
|
||||
}
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val headers = (
|
||||
@ -94,7 +96,9 @@ class BrowserActionActivity : AppCompatActivity() {
|
||||
@Suppress("NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE", "UNCHECKED_CAST")
|
||||
val verifyComplete: ((String) -> Boolean)? = if (source != null) {
|
||||
source::verifyComplete!!
|
||||
} else intent.getSerializableExtraCompat(VERIFY_LAMBDA_EXTRA)
|
||||
} else {
|
||||
intent.getSerializableExtraCompat(VERIFY_LAMBDA_EXTRA)
|
||||
}
|
||||
|
||||
if (verifyComplete == null || url == null) {
|
||||
finish()
|
||||
@ -105,7 +109,9 @@ class BrowserActionActivity : AppCompatActivity() {
|
||||
|
||||
binding.toolbar.title = if (source != null) {
|
||||
"${source.name}: $actionStr"
|
||||
} else actionStr
|
||||
} else {
|
||||
actionStr
|
||||
}
|
||||
|
||||
val parsedUrl = URL(url)
|
||||
|
||||
|
@ -39,7 +39,9 @@ fun PervEdenDescription(state: MangaScreenState.Success, openMetadataViewer: ()
|
||||
binding.language.text = if (language != null) {
|
||||
val local = Locale(language)
|
||||
local.displayName
|
||||
} else context.getString(R.string.unknown)
|
||||
} else {
|
||||
context.getString(R.string.unknown)
|
||||
}
|
||||
|
||||
binding.ratingBar.rating = meta.rating ?: 0F
|
||||
@SuppressLint("SetTextI18n")
|
||||
|
@ -55,7 +55,9 @@ private class DataSaverImpl(preferences: PreferencesHelper) : DataSaver {
|
||||
imageUrl.contains(".gif", true) -> if (ignoreGif) imageUrl else getUrl(imageUrl)
|
||||
else -> getUrl(imageUrl)
|
||||
}
|
||||
} else imageUrl
|
||||
} else {
|
||||
imageUrl
|
||||
}
|
||||
}
|
||||
|
||||
private fun getUrl(imageUrl: String): String {
|
||||
|
@ -80,7 +80,9 @@ fun DomainManga.mangaType(sourceName: String? = Injekt.get<SourceManager>().get(
|
||||
fun Manga.defaultReaderType(type: MangaType = mangaType()): Int? {
|
||||
return if (type == MangaType.TYPE_MANHWA || type == MangaType.TYPE_WEBTOON) {
|
||||
ReadingModeType.WEBTOON.prefValue
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun isMangaTag(tag: String): Boolean {
|
||||
@ -184,5 +186,5 @@ enum class MangaType {
|
||||
TYPE_MANHWA,
|
||||
TYPE_MANHUA,
|
||||
TYPE_COMIC,
|
||||
TYPE_WEBTOON
|
||||
TYPE_WEBTOON,
|
||||
}
|
||||
|
@ -26,5 +26,7 @@ fun Response.interceptAsHtml(block: (Document) -> Unit): Response {
|
||||
}
|
||||
|
||||
rebuiltResponse
|
||||
} else this
|
||||
} else {
|
||||
this
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,12 @@ object SourceTagsUtil {
|
||||
TSUMINO_SOURCE_ID -> wrapTagTsumino(parsed.namespace, parsed.name.substringBefore('|').trim())
|
||||
else -> wrapTag(parsed.namespace, parsed.name.substringBefore('|').trim())
|
||||
}
|
||||
} else null
|
||||
} else null
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun wrapTag(namespace: String, tag: String) = if (tag.contains(spaceRegex)) {
|
||||
@ -103,7 +107,8 @@ object SourceTagsUtil {
|
||||
IMAGE_SET_COLOR("#3f51b5"),
|
||||
COSPLAY_COLOR("#9c27b0"),
|
||||
ASIAN_PORN_COLOR("#9575cd"),
|
||||
MISC_COLOR("#f06292");
|
||||
MISC_COLOR("#f06292"),
|
||||
;
|
||||
|
||||
constructor(color: String) : this(Color.parseColor(color))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user