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