Update linter

(cherry picked from commit f0eb42e72d)

# Conflicts:
#	app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullBackupRestore.kt
#	app/src/main/java/eu/kanade/tachiyomi/data/backup/full/models/Backup.kt
#	app/src/main/java/eu/kanade/tachiyomi/data/backup/full/models/BackupManga.kt
#	app/src/main/java/eu/kanade/tachiyomi/data/backup/legacy/models/Backup.kt
#	app/src/main/java/eu/kanade/tachiyomi/extension/model/Extension.kt
#	app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/base/changehandler/OneWayFadeChangeHandler.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchController.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/SelectionHeader.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourceItem.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/SourcePresenter.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/SourceFilterSheet.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/GlobalSearchController.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryHolder.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryListHolder.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderPageSheet.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/model/ReaderPage.kt
#	app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt
#	app/src/main/java/eu/kanade/tachiyomi/util/view/ViewExtensions.kt
This commit is contained in:
arkon
2022-04-08 15:30:30 -04:00
committed by Jobobby04
parent e0c1e56588
commit e98567a86b
503 changed files with 1589 additions and 1684 deletions
+15 -15
View File
@@ -108,7 +108,7 @@ object EXHMigrations {
Query.builder()
.table(MangaTable.TABLE)
.where("${MangaTable.COL_SOURCE} = $HBROWSE_SOURCE_ID")
.build()
.build(),
)
.prepare()
.executeAsBlocking()
@@ -145,7 +145,7 @@ object EXHMigrations {
Query.builder()
.table(MangaTable.TABLE)
.where("${MangaTable.COL_SOURCE} = $MERGED_SOURCE_ID")
.build()
.build(),
)
.prepare()
.executeAsBlocking()
@@ -172,7 +172,7 @@ object EXHMigrations {
mergeUrl = mergedManga.first.url,
mangaId = mergedManga.first.id!!,
mangaUrl = mergedManga.first.url,
mangaSourceId = MERGED_SOURCE_ID
mangaSourceId = MERGED_SOURCE_ID,
)
mergedManga.second.children.distinct().forEachIndexed { index, mangaSource ->
val load = mangaSource.load(db, sourceManager) ?: return@forEachIndexed
@@ -187,7 +187,7 @@ object EXHMigrations {
mergeUrl = mergedManga.first.url,
mangaId = load.manga.id!!,
mangaUrl = load.manga.url,
mangaSourceId = load.source.id
mangaSourceId = load.source.id,
)
}
}
@@ -206,7 +206,7 @@ object EXHMigrations {
Query.builder()
.table(ChapterTable.TABLE)
.where("${ChapterTable.COL_MANGA_ID} IN (${mergedMangas.filter { it.id != null }.joinToString { it.id.toString() }})")
.build()
.build(),
)
.prepare()
.executeAsBlocking()
@@ -216,7 +216,7 @@ object EXHMigrations {
Query.builder()
.table(ChapterTable.TABLE)
.where("${ChapterTable.COL_MANGA_ID} IN (${loadedMangaList.filter { it.manga.id != null }.joinToString { it.manga.id.toString() }})")
.build()
.build(),
)
.prepare()
.executeAsBlocking()
@@ -291,7 +291,7 @@ object EXHMigrations {
.table(TrackTable.TABLE)
.where("${TrackTable.COL_SYNC_ID} = ?")
.whereArgs(6)
.build()
.build(),
)
}
if (oldVersion under 18) {
@@ -367,7 +367,7 @@ object EXHMigrations {
"fav-sync",
"fav-sync.management",
"fav-sync.lock",
"fav-sync.note"
"fav-sync.note",
).map {
File(context.filesDir, it)
}.filter(File::exists).forEach {
@@ -412,7 +412,7 @@ object EXHMigrations {
source = it.substringBefore(':').toLongOrNull() ?: return@mapNotNull null,
content["name"]!!.jsonPrimitive.content,
content["query"]!!.jsonPrimitive.contentOrNull?.nullIfBlank(),
Json.encodeToString(content["filters"]!!.jsonArray)
Json.encodeToString(content["filters"]!!.jsonArray),
)
}.getOrNull()
}?.ifEmpty { null }
@@ -424,7 +424,7 @@ object EXHMigrations {
id = null,
source = it.toLong(),
savedSearch = null,
global = true
global = true,
)
}?.ifEmpty { null }
if (feed != null) {
@@ -518,13 +518,13 @@ object EXHMigrations {
@SerialName("u")
val url: String,
@SerialName("m")
val mangaUrl: String
val mangaUrl: String,
)
@Serializable
private data class MangaConfig(
@SerialName("c")
val children: List<MangaSource>
val children: List<MangaSource>,
) {
companion object {
fun readFromUrl(url: String): MangaConfig? {
@@ -546,7 +546,7 @@ object EXHMigrations {
@SerialName("s")
val source: Long,
@SerialName("u")
val url: String
val url: String,
) {
fun load(db: DatabaseHelper, sourceManager: SourceManager): LoadedMangaSource? {
val manga = db.getManga(url, source).executeAsBlocking() ?: return null
@@ -573,10 +573,10 @@ object EXHMigrations {
UPDATE ${MangaTable.TABLE}
SET ${MangaTable.COL_SOURCE} = $newId
WHERE ${MangaTable.COL_SOURCE} = $oldId
""".trimIndent()
""".trimIndent(),
)
.affectsTables(MangaTable.TABLE)
.build()
.build(),
)
}
}
+4 -4
View File
@@ -51,7 +51,7 @@ class GalleryAdder {
url: String,
fav: Boolean = false,
forceSource: UrlImportableSource? = null,
throttleFunc: suspend () -> Unit = {}
throttleFunc: suspend () -> Unit = {},
): GalleryAddEvent {
logger.d(context.getString(R.string.gallery_adder_importing_manga, url, fav.toString(), forceSource))
try {
@@ -177,7 +177,7 @@ class GalleryAdder {
return GalleryAddEvent.Fail.Error(
url,
((e.message ?: "Unknown error!") + " (Gallery: $url)").trim()
((e.message ?: "Unknown error!") + " (Gallery: $url)").trim(),
)
}
}
@@ -192,7 +192,7 @@ sealed class GalleryAddEvent {
override val galleryUrl: String,
val manga: Manga,
val context: Context,
val chapter: Chapter? = null
val chapter: Chapter? = null,
) : GalleryAddEvent() {
override val galleryTitle = manga.title
override val logMessage = context.getString(R.string.batch_add_success_log_message, galleryTitle)
@@ -205,7 +205,7 @@ sealed class GalleryAddEvent {
open class Error(
override val galleryUrl: String,
override val logMessage: String
override val logMessage: String,
) : Fail()
class NotFound(galleryUrl: String, context: Context) :
+10 -10
View File
@@ -144,10 +144,10 @@ object DebugFunctions {
"""
UPDATE ${MangaTable.TABLE}
SET ${MangaTable.COL_FAVORITE} = 1
""".trimIndent()
""".trimIndent(),
)
.affectsTables(MangaTable.TABLE)
.build()
.build(),
)
}
}
@@ -235,10 +235,10 @@ object DebugFunctions {
UPDATE ${MangaTable.TABLE}
SET ${MangaTable.COL_SOURCE} = $to
WHERE ${MangaTable.COL_SOURCE} = $from
""".trimIndent()
""".trimIndent(),
)
.affectsTables(MangaTable.TABLE)
.build()
.build(),
)
}
@@ -329,10 +329,10 @@ object DebugFunctions {
UPDATE ${MangaTable.TABLE}
SET ${MangaTable.COL_VIEWER} = 0
WHERE ${MangaTable.COL_VIEWER} = -1
""".trimIndent()
""".trimIndent(),
)
.affectsTables(MangaTable.TABLE)
.build()
.build(),
)
}
}
@@ -345,10 +345,10 @@ object DebugFunctions {
"""
UPDATE ${MangaTable.TABLE}
SET ${MangaTable.COL_VIEWER} = 0
""".trimIndent()
""".trimIndent(),
)
.affectsTables(MangaTable.TABLE)
.build()
.build(),
)
}
}
@@ -366,10 +366,10 @@ object DebugFunctions {
UPDATE ${MangaTable.TABLE}
SET ${MangaTable.COL_SOURCE} = ${NHentai.otherId}
WHERE ${MangaTable.COL_FAVORITE} = 1 AND ${MangaTable.COL_SOURCE} in ($sources)
""".trimIndent()
""".trimIndent(),
)
.affectsTables(MangaTable.TABLE)
.build()
.build(),
)
}
}
@@ -7,7 +7,7 @@ import kotlin.time.Duration.Companion.seconds
class EHentaiThrottleManager(
private val max: Duration = THROTTLE_MAX,
private val inc: Duration = THROTTLE_INC
private val inc: Duration = THROTTLE_INC,
) {
private var lastThrottleTime = Duration.ZERO
var throttleTime = Duration.ZERO
@@ -22,7 +22,7 @@ class EHentaiUpdateHelper(context: Context) {
val parentLookupTable =
MemAutoFlushingLookupTable(
File(context.filesDir, "exh-plt.maftable"),
GalleryEntry.Serializer()
GalleryEntry.Serializer(),
)
private val db: DatabaseHelper by injectLazy()
@@ -55,7 +55,7 @@ class EHentaiUpdateHelper(context: Context) {
ChapterChain(
manga.await() ?: return@coroutineScope null,
chapterList.await(),
history.await()
history.await(),
)
}
}
@@ -143,13 +143,13 @@ class EHentaiUpdateHelper(context: Context) {
data class HistoryUpdates(
val history: List<History>,
val urlHistory: List<Pair<String, History>>,
val historyToDelete: List<Long>
val historyToDelete: List<Long>,
)
private fun getHistory(
newChapters: List<Chapter>,
chainsAsChapters: List<Chapter>,
chainsAsHistory: List<History>
chainsAsHistory: List<History>,
): HistoryUpdates {
val historyMap = chainsAsHistory
.groupBy { history ->
@@ -185,14 +185,14 @@ class EHentaiUpdateHelper(context: Context) {
null
}
},
oldHistory
oldHistory,
)
}
private fun getChapterList(
accepted: ChapterChain,
toDiscard: List<ChapterChain>,
chainsAsChapters: List<Chapter>
chainsAsChapters: List<Chapter>,
): Pair<List<Chapter>, Boolean> {
var new = false
return toDiscard
@@ -256,7 +256,7 @@ data class GalleryEntry(val gId: String, val gToken: String) {
val colonIndex = string.indexOf(':')
return GalleryEntry(
string.substring(0, colonIndex),
string.substring(colonIndex + 1, string.length)
string.substring(colonIndex + 1, string.length),
)
}
}
@@ -125,7 +125,7 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
meta.gId,
meta.gToken,
failuresThisIteration,
modifiedThisIteration.size
modifiedThisIteration.size,
)
if (manga.id in modifiedThisIteration) {
@@ -147,7 +147,7 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
manga.id,
meta.gId,
meta.gToken,
failuresThisIteration
failuresThisIteration,
)
}
@@ -160,7 +160,7 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
manga.id,
meta.gId,
meta.gToken,
failuresThisIteration
failuresThisIteration,
)
continue
@@ -186,9 +186,9 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
EHentaiUpdaterStats(
startTime,
allMeta.size,
updatedThisIteration
)
)
updatedThisIteration,
),
),
)
if (updatedManga.isNotEmpty()) {
@@ -256,7 +256,7 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
interval.toLong(),
TimeUnit.HOURS,
10,
TimeUnit.MINUTES
TimeUnit.MINUTES,
)
.addTag(TAG)
.setConstraints(constraints)
@@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
data class EHentaiUpdaterStats(
val startTime: Long,
val possibleUpdates: Int,
val updateCount: Int
val updateCount: Int,
)
@@ -35,7 +35,7 @@ import kotlin.coroutines.CoroutineContext
class MemAutoFlushingLookupTable<T>(
file: File,
private val serializer: EntrySerializer<T>,
private val debounceTimeMs: Long = 3000
private val debounceTimeMs: Long = 3000,
) : CoroutineScope, Closeable {
/**
* The context of this scope.
@@ -125,14 +125,14 @@ class FavoritesSyncHelper(val context: Context) {
wakeLock = ignore {
context.powerManager.newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK,
"teh:ExhFavoritesSyncWakelock"
"teh:ExhFavoritesSyncWakelock",
)
}
ignore { wifiLock?.release() }
wifiLock = ignore {
context.wifiManager.createWifiLock(
WifiManager.WIFI_MODE_FULL_HIGH_PERF,
"teh:ExhFavoritesSyncWifi"
"teh:ExhFavoritesSyncWifi",
)
}
@@ -249,7 +249,7 @@ class FavoritesSyncHelper(val context: Context) {
.add("favnote", "")
.add("apply", "Add to Favorites")
.add("update", "1")
.build()
.build(),
)
if (!explicitlyRetryExhRequest(10, request)) {
@@ -299,7 +299,7 @@ class FavoritesSyncHelper(val context: Context) {
val request = POST(
url = "https://exhentai.org/favorites.php",
body = formBody.build()
body = formBody.build(),
)
if (!explicitlyRetryExhRequest(10, request)) {
@@ -320,7 +320,7 @@ class FavoritesSyncHelper(val context: Context) {
status.value = FavoritesSyncStatus.Processing(
context.getString(R.string.favorites_sync_adding_to_remote, index + 1, changeSet.added.size),
needWarnThrottle(),
context
context,
)
throttleManager.throttle()
@@ -340,7 +340,7 @@ class FavoritesSyncHelper(val context: Context) {
// Consider both EX and EH sources
listOf(
db.getManga(url, EXH_SOURCE_ID),
db.getManga(url, EH_SOURCE_ID)
db.getManga(url, EH_SOURCE_ID),
).forEach {
val manga = it.executeAsBlocking()
@@ -368,7 +368,7 @@ class FavoritesSyncHelper(val context: Context) {
context.getString(R.string.favorites_sync_add_to_local, index + 1, changeSet.added.size),
needWarnThrottle(),
context,
it.title
it.title,
)
throttleManager.throttle()
@@ -379,7 +379,7 @@ class FavoritesSyncHelper(val context: Context) {
"${exh.baseUrl}${it.getUrl()}",
true,
exh,
throttleManager::throttle
throttleManager::throttle,
)
if (result is GalleryAddEvent.Fail) {
@@ -404,7 +404,7 @@ class FavoritesSyncHelper(val context: Context) {
} else if (result is GalleryAddEvent.Success) {
insertedMangaCategories += MangaCategory.create(
result.manga,
categories[it.category]
categories[it.category],
) to result.manga
}
}
@@ -439,7 +439,7 @@ sealed class FavoritesSyncStatus(val message: String) {
class MangaInMultipleCategories(
val manga: Manga,
val categories: List<Category>,
context: Context
context: Context,
) :
BadLibraryState(context.getString(R.string.favorites_sync_manga_in_multiple_categories, manga.title, categories.joinToString { it.name }))
}
@@ -449,7 +449,7 @@ sealed class FavoritesSyncStatus(val message: String) {
context.getString(R.string.favorites_sync_processing_throttle, message)
} else {
message
}
},
) {
val delayedMessage get() = if (title != null) this.message + "\n\n" + title else null
}
@@ -82,7 +82,7 @@ class LocalFavoritesStorage {
dbCategories.indexOf(
category.firstOrNull()
?: return@mapNotNull null
?: return@mapNotNull null,
) to it
}
}
@@ -95,7 +95,7 @@ class LocalFavoritesStorage {
title = manga.originalTitle,
gid = EHentaiSearchMetadata.galleryId(manga.url),
token = EHentaiSearchMetadata.galleryToken(manga.url),
category = categoryId
category = categoryId,
).also {
if (it.category > MAX_CATEGORIES) {
return@mapNotNull null
@@ -113,5 +113,5 @@ class LocalFavoritesStorage {
data class ChangeSet(
val added: List<FavoriteEntry>,
val removed: List<FavoriteEntry>
val removed: List<FavoriteEntry>,
)
@@ -20,7 +20,7 @@ import exh.favorites.sql.tables.FavoriteEntryTable.TABLE
class FavoriteEntryTypeMapping : SQLiteTypeMapping<FavoriteEntry>(
FavoriteEntryPutResolver(),
FavoriteEntryGetResolver(),
FavoriteEntryDeleteResolver()
FavoriteEntryDeleteResolver(),
)
class FavoriteEntryPutResolver : DefaultPutResolver<FavoriteEntry>() {
@@ -40,7 +40,7 @@ class FavoriteEntryPutResolver : DefaultPutResolver<FavoriteEntry>() {
COL_TITLE to obj.title,
COL_GID to obj.gid,
COL_TOKEN to obj.token,
COL_CATEGORY to obj.category
COL_CATEGORY to obj.category,
)
}
@@ -51,7 +51,7 @@ class FavoriteEntryGetResolver : DefaultGetResolver<FavoriteEntry>() {
title = cursor.getString(cursor.getColumnIndexOrThrow(COL_TITLE)),
gid = cursor.getString(cursor.getColumnIndexOrThrow(COL_GID)),
token = cursor.getString(cursor.getColumnIndexOrThrow(COL_TOKEN)),
category = cursor.getInt(cursor.getColumnIndexOrThrow(COL_CATEGORY))
category = cursor.getInt(cursor.getColumnIndexOrThrow(COL_CATEGORY)),
)
}
@@ -12,7 +12,7 @@ interface FavoriteEntryQueries : DbProvider {
.withQuery(
Query.builder()
.table(FavoriteEntryTable.TABLE)
.build()
.build(),
)
.prepare()
@@ -24,7 +24,7 @@ interface FavoriteEntryQueries : DbProvider {
.byQuery(
DeleteQuery.builder()
.table(FavoriteEntryTable.TABLE)
.build()
.build(),
)
.prepare()
}
@@ -27,6 +27,6 @@ object FavoriteEntryTable {
val fixTableQuery: String
get() = createTableQuery.replace(
"CREATE TABLE",
"CREATE TABLE IF NOT EXISTS"
"CREATE TABLE IF NOT EXISTS",
)
}
@@ -34,7 +34,7 @@ class EHDebugModeOverlay(private val context: Context) : OverlayModule<String>(n
val view = LinearLayout(root.context).apply {
layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
ViewGroup.LayoutParams.WRAP_CONTENT,
)
setPadding(4.dpToPx, 0, 4.dpToPx, 4.dpToPx)
}
@@ -46,7 +46,7 @@ class EHDebugModeOverlay(private val context: Context) : OverlayModule<String>(n
text = HtmlCompat.fromHtml(buildInfo(), HtmlCompat.FROM_HTML_MODE_LEGACY)
layoutParams = LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
ViewGroup.LayoutParams.WRAP_CONTENT,
)
}
@@ -31,7 +31,7 @@ class EnhancedFilePrinter internal constructor(
private val fileNameGenerator: FileNameGenerator,
private val backupStrategy: BackupStrategy,
private val cleanStrategy: CleanStrategy,
private val flattener: Flattener
private val flattener: Flattener,
) : Printer {
/**
* Log writer.
@@ -191,7 +191,7 @@ class EnhancedFilePrinter internal constructor(
fileNameGenerator ?: DefaultsFactory.createFileNameGenerator(),
backupStrategy ?: DefaultsFactory.createBackupStrategy(),
cleanStrategy ?: DefaultsFactory.createCleanStrategy(),
flattener ?: DefaultsFactory.createFlattener2()
flattener ?: DefaultsFactory.createFlattener2(),
)
}
+1 -1
View File
@@ -64,7 +64,7 @@ sealed class LogLevel(val int: Int, val androidLevel: Int) {
Info,
Debug,
Verbose,
All
All,
)
}
}
@@ -46,8 +46,8 @@ class MangaDexFabHeaderAdapter(val controller: BaseController<*>, val source: Ca
controller.router.replaceTopController(
BrowseSourceController(
source,
"id:$randomMangaUrl"
).withFadeTransaction()
"id:$randomMangaUrl",
).withFadeTransaction(),
)
onClick()
}.launchIn(controller.viewScope)
+3 -3
View File
@@ -8,7 +8,7 @@ data class MangaListDto(
override val limit: Int,
override val offset: Int,
override val total: Int,
override val data: List<MangaDataDto>
override val data: List<MangaDataDto>,
) : ListCallDto<MangaDataDto>
@Serializable
@@ -44,12 +44,12 @@ data class MangaAttributesDto(
@Serializable
data class TagDto(
val id: String,
val attributes: TagAttributesDto
val attributes: TagAttributesDto,
)
@Serializable
data class TagAttributesDto(
val name: Map<String, String>
val name: Map<String, String>,
)
@Serializable
+2 -2
View File
@@ -10,7 +10,7 @@ data class MangaPlusResponse(
@Serializable
data class SuccessResult(
@ProtoNumber(10) val mangaViewer: MangaViewer? = null
@ProtoNumber(10) val mangaViewer: MangaViewer? = null,
)
@Serializable
@@ -24,5 +24,5 @@ data class MangaPage(
@ProtoNumber(1) val imageUrl: String,
@ProtoNumber(2) val width: Int,
@ProtoNumber(3) val height: Int,
@ProtoNumber(5) val encryptionKey: String? = null
@ProtoNumber(5) val encryptionKey: String? = null,
)
+2 -2
View File
@@ -5,13 +5,13 @@ import kotlinx.serialization.json.JsonElement
@Serializable
data class RatingResponseDto(
val ratings: JsonElement
val ratings: JsonElement,
)
@Serializable
data class PersonalRatingDto(
val rating: Int,
val createdAt: String
val createdAt: String,
)
@Serializable
+1 -1
View File
@@ -33,7 +33,7 @@ data class RelationDto(
@Serializable
data class RelationMangaDto(
val id: String
val id: String,
)
@Serializable
@@ -4,15 +4,15 @@ import kotlinx.serialization.Serializable
@Serializable
data class StatisticsDto(
val statistics: Map<String, StatisticsMangaDto>
val statistics: Map<String, StatisticsMangaDto>,
)
@Serializable
data class StatisticsMangaDto(
val rating: StatisticsMangaRatingDto
val rating: StatisticsMangaRatingDto,
)
@Serializable
data class StatisticsMangaRatingDto(
val average: Double?
val average: Double?,
)
@@ -15,8 +15,8 @@ class MangaDexFollowsController(bundle: Bundle) : BrowseSourceController(bundle)
constructor(source: CatalogueSource) : this(
bundleOf(
SOURCE_ID_KEY to source.id
)
SOURCE_ID_KEY to source.id,
),
)
override fun getTitle(): String? {
@@ -23,7 +23,7 @@ import uy.kohesive.injekt.injectLazy
import java.util.Locale
class ApiMangaParser(
private val lang: String
private val lang: String,
) {
val db: DatabaseHelper by injectLazy()
@@ -42,7 +42,7 @@ class ApiMangaParser(
sourceId: Long,
input: MangaDto,
simpleChapters: List<String>,
statistics: StatisticsMangaDto?
statistics: StatisticsMangaDto?,
): MangaInfo {
val mangaId = db.getManga(manga.key, sourceId).executeAsBlocking()?.id
val metadata = if (mangaId != null) {
@@ -63,13 +63,13 @@ class ApiMangaParser(
metadata: MangaDexSearchMetadata,
mangaDto: MangaDto,
simpleChapters: List<String>,
statistics: StatisticsMangaDto?
statistics: StatisticsMangaDto?,
) {
with(metadata) {
try {
val mangaAttributesDto = mangaDto.data.attributes
mdUuid = mangaDto.data.id
title = MdUtil.cleanString(MdUtil.getTitleFromManga(mangaAttributesDto, lang,))
title = MdUtil.cleanString(MdUtil.getTitleFromManga(mangaAttributesDto, lang))
altTitles = mangaAttributesDto.altTitles.mapNotNull { it[lang] }.nullIfEmpty()
val mangaRelationshipsDto = mangaDto.data.relationships
@@ -85,8 +85,8 @@ class ApiMangaParser(
MdUtil.getFromLangMap(
langMap = mangaAttributesDto.description.asMdMap(),
currentLang = lang,
originalLanguage = mangaAttributesDto.originalLanguage
).orEmpty()
originalLanguage = mangaAttributesDto.originalLanguage,
).orEmpty(),
)
authors = mangaRelationshipsDto.filter { relationshipDto ->
@@ -87,7 +87,7 @@ class BilibiliHandler(currentClient: OkHttpClient) {
return POST(
"$baseUrl/$BASE_API_ENDPOINT/ComicDetail?device=pc&platform=web",
headers = newHeaders,
body = requestBody
body = requestBody,
)
}
@@ -136,7 +136,7 @@ class BilibiliHandler(currentClient: OkHttpClient) {
return POST(
"$baseUrl/$BASE_API_ENDPOINT/GetImageIndex?device=pc&platform=web",
headers = newHeaders,
body = requestBody
body = requestBody,
)
}
@@ -173,7 +173,7 @@ class BilibiliHandler(currentClient: OkHttpClient) {
return POST(
"$baseUrl/$BASE_API_ENDPOINT/ImageToken?device=pc&platform=web",
headers = newHeaders,
body = requestBody
body = requestBody,
)
}
@@ -187,24 +187,24 @@ class BilibiliHandler(currentClient: OkHttpClient) {
@Serializable
data class BilibiliPageDto(
val token: String,
val url: String
val url: String,
)
@Serializable
data class BilibiliResultDto<T>(
val code: Int = 0,
val data: T? = null,
@SerialName("msg") val message: String = ""
@SerialName("msg") val message: String = "",
)
@Serializable
data class BilibiliReader(
val images: List<BilibiliImageDto> = emptyList()
val images: List<BilibiliImageDto> = emptyList(),
)
@Serializable
data class BilibiliImageDto(
val path: String
val path: String,
)
@Serializable
@@ -218,7 +218,7 @@ class BilibiliHandler(currentClient: OkHttpClient) {
@SerialName("season_id") val seasonId: Int = 0,
val styles: List<String> = emptyList(),
val title: String,
@SerialName("vertical_cover") val verticalCover: String = ""
@SerialName("vertical_cover") val verticalCover: String = "",
)
@Serializable
@@ -227,7 +227,7 @@ class BilibiliHandler(currentClient: OkHttpClient) {
@SerialName("is_locked") val isLocked: Boolean,
@SerialName("ord") val order: Float,
@SerialName("pub_time") val publicationTime: String,
val title: String
val title: String,
)
companion object {
@@ -13,7 +13,7 @@ class FilterHandler {
SortFilter(sortableList.map { it.first }.toTypedArray()),
TagList(getTags()),
TagInclusionMode(),
TagExclusionMode()
TagExclusionMode(),
).toMutableList()
if (true) { // preferencesHelper.showR18Filter()) {
@@ -32,7 +32,7 @@ class FilterHandler {
Demographic("Shounen"),
Demographic("Shoujo"),
Demographic("Seinen"),
Demographic("Josei")
Demographic("Josei"),
)
private class Status(name: String) : Filter.CheckBox(name)
@@ -54,7 +54,7 @@ class FilterHandler {
ContentRating("Safe"),
ContentRating("Suggestive"),
ContentRating("Erotica"),
ContentRating("Pornographic")
ContentRating("Pornographic"),
)
private class OriginalLanguage(name: String, val isoCode: String) : Filter.CheckBox(name)
@@ -147,7 +147,7 @@ class FilterHandler {
Tag("8c86611e-fab7-4986-9dec-d1a2f44acdd5", "Virtual Reality"),
Tag("e197df38-d0e7-43b5-9b09-2842d0c326dd", "Web Comic"),
Tag("acc803a4-c95a-4c22-86fc-eb6b582d82a2", "Wuxia"),
Tag("631ef465-9aba-4afb-b0fc-ea10efe274a8", "Zombies")
Tag("631ef465-9aba-4afb-b0fc-ea10efe274a8", "Zombies"),
)
private class TagInclusionMode :
@@ -20,7 +20,7 @@ import kotlinx.coroutines.async
class FollowsHandler(
private val lang: String,
private val service: MangaDexAuthService
private val service: MangaDexAuthService,
) {
/**
@@ -48,7 +48,7 @@ class FollowsHandler(
*/
private fun followsParseMangaPage(
response: List<MangaDataDto>,
statuses: Map<String, String?>
statuses: Map<String, String?>,
): List<Pair<SManga, MangaDexSearchMetadata>> {
val comparator = compareBy<Pair<SManga, MangaDexSearchMetadata>> { it.second.followStatus }
.thenBy { it.first.title }
@@ -56,7 +56,7 @@ class FollowsHandler(
return response.map {
MdUtil.createMangaEntry(
it,
lang
lang,
).toSManga() to MangaDexSearchMetadata().apply {
followStatus = FollowStatus.fromDex(statuses[it.id]).int
}
@@ -26,7 +26,7 @@ class MangaHandler(
private val lang: String,
private val service: MangaDexService,
private val apiMangaParser: ApiMangaParser,
private val followsHandler: FollowsHandler
private val followsHandler: FollowsHandler,
) {
suspend fun getMangaDetails(manga: MangaInfo, sourceId: Long): MangaInfo {
return coroutineScope {
@@ -39,7 +39,7 @@ class MangaHandler(
sourceId,
response.await(),
simpleChapters.await(),
statistics.await()
statistics.await(),
)
}
}
@@ -62,7 +62,7 @@ class MangaHandler(
lang,
it,
blockedGroups,
blockedUploaders
blockedUploaders,
)
}
@@ -35,7 +35,7 @@ class MangaPlusHandler(currentClient: OkHttpClient) {
private fun pageListRequest(chapterId: String): Request {
return GET(
"$baseUrl/manga_viewer?chapter_id=$chapterId&split=yes&img_quality=super_high",
headers
headers,
)
}
@@ -38,20 +38,20 @@ class PageHandler(
if (chapterResponse.data.attributes.externalUrl != null && chapterResponse.data.attributes.pages == 0) {
when {
chapter.scanlator.equals("mangaplus", true) -> mangaPlusHandler.fetchPageList(
chapterResponse.data.attributes.externalUrl
chapterResponse.data.attributes.externalUrl,
)
/*chapter.scanlator.equals("comikey", true) -> comikeyHandler.fetchPageList(
chapterResponse.data.attributes.externalUrl
)*/
chapter.scanlator.equals("bilibili comics", true) -> bilibiliHandler.fetchPageList(
chapterResponse.data.attributes.externalUrl,
chapterResponse.data.attributes.chapter.toString()
chapterResponse.data.attributes.chapter.toString(),
)
chapter.scanlator.equals("azuki manga", true) -> azukiHandler.fetchPageList(
chapterResponse.data.attributes.externalUrl
chapterResponse.data.attributes.externalUrl,
)
chapter.scanlator.equals("mangahot", true) -> mangaHotHandler.fetchPageList(
chapterResponse.data.attributes.externalUrl
chapterResponse.data.attributes.externalUrl,
)
else -> throw Exception("${chapter.scanlator} not supported")
}
@@ -15,7 +15,7 @@ import tachiyomi.source.model.MangaInfo
class SimilarHandler(
private val lang: String,
private val service: MangaDexService,
private val similarService: SimilarService
private val similarService: SimilarService,
) {
suspend fun getSimilar(manga: MangaInfo): MetadataMangasPage {
@@ -61,7 +61,7 @@ class SimilarHandler(
it.relation = relatedListDto.data.firstOrNull { it.relationships.any { it.id == MdUtil.getMangaId(manga.url) } }
?.attributes?.relation?.let(MangaDexRelation::fromDex)
}
}
},
)
}
}
@@ -56,7 +56,7 @@ class MangaDexLoginHelper(val authServiceLazy: Lazy<MangaDexAuthService>, val pr
MdUtil.updateLoginToken(
loginResponseDto.token,
preferences,
mdList
mdList,
)
true
} else {
@@ -32,7 +32,7 @@ class MangaDexAuthService(
private val client: OkHttpClient,
private val headers: Headers,
private val preferences: PreferencesHelper,
private val mdList: MdList
private val mdList: MdList,
) {
private val noAuthenticatorClient = client.newBuilder()
.authenticator(Authenticator.NONE)
@@ -41,7 +41,7 @@ class MangaDexAuthService(
fun getHeaders() = MdUtil.getAuthHeaders(
headers,
preferences,
mdList
mdList,
)
suspend fun login(request: LoginRequestDto): LoginResponseDto {
@@ -49,8 +49,8 @@ class MangaDexAuthService(
POST(
MdApi.login,
body = MdUtil.encodeToBody(request),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -59,8 +59,8 @@ class MangaDexAuthService(
POST(
MdApi.logout,
getHeaders(),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -69,8 +69,8 @@ class MangaDexAuthService(
GET(
MdApi.checkToken,
getHeaders(),
CacheControl.FORCE_NETWORK
)
CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -80,8 +80,8 @@ class MangaDexAuthService(
MdApi.refreshToken,
getHeaders(),
body = MdUtil.encodeToBody(request),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -90,8 +90,8 @@ class MangaDexAuthService(
GET(
"${MdApi.userFollows}?limit=100&offset=$offset&includes[]=${MdConstants.Types.coverArt}",
getHeaders(),
CacheControl.FORCE_NETWORK
)
CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -100,8 +100,8 @@ class MangaDexAuthService(
GET(
"${MdApi.manga}/$mangaId/status",
getHeaders(),
CacheControl.FORCE_NETWORK
)
CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -110,8 +110,8 @@ class MangaDexAuthService(
GET(
"${MdApi.manga}/$mangaId/read",
getHeaders(),
CacheControl.FORCE_NETWORK
)
CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -124,8 +124,8 @@ class MangaDexAuthService(
"${MdApi.manga}/$mangaId/status",
getHeaders(),
body = MdUtil.encodeToBody(readingStatusDto),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -134,8 +134,8 @@ class MangaDexAuthService(
GET(
MdApi.readingStatusForAllManga,
getHeaders(),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -144,8 +144,8 @@ class MangaDexAuthService(
GET(
"${MdApi.readingStatusForAllManga}?status=$status",
getHeaders(),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -154,8 +154,8 @@ class MangaDexAuthService(
POST(
"${MdApi.chapter}/$chapterId/read",
getHeaders(),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -166,7 +166,7 @@ class MangaDexAuthService(
.delete()
.headers(getHeaders())
.cacheControl(CacheControl.FORCE_NETWORK)
.build()
.build(),
).await().parseAs(MdUtil.jsonParser)
}
@@ -175,8 +175,8 @@ class MangaDexAuthService(
POST(
"${MdApi.manga}/$mangaId/follow",
getHeaders(),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -187,7 +187,7 @@ class MangaDexAuthService(
.delete()
.headers(getHeaders())
.cacheControl(CacheControl.FORCE_NETWORK)
.build()
.build(),
).await().parseAs(MdUtil.jsonParser)
}
@@ -197,8 +197,8 @@ class MangaDexAuthService(
"${MdApi.rating}/$mangaId",
getHeaders(),
body = MdUtil.encodeToBody(RatingDto(rating)),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -209,7 +209,7 @@ class MangaDexAuthService(
.url("${MdApi.rating}/$mangaId")
.headers(getHeaders())
.cacheControl(CacheControl.FORCE_NETWORK)
.build()
.build(),
).await().parseAs(MdUtil.jsonParser)
}
@@ -226,8 +226,8 @@ class MangaDexAuthService(
.build()
.toString(),
getHeaders(),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
}
@@ -25,11 +25,11 @@ import okhttp3.HttpUrl.Companion.toHttpUrl
import okhttp3.OkHttpClient
class MangaDexService(
private val client: OkHttpClient
private val client: OkHttpClient,
) {
suspend fun viewMangas(
ids: List<String>
ids: List<String>,
): MangaListDto {
return client.newCall(
GET(
@@ -44,13 +44,13 @@ class MangaDexService(
}
.build()
.toString(),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
suspend fun viewManga(
id: String
id: String,
): MangaDto {
return client.newCall(
GET(
@@ -64,13 +64,13 @@ class MangaDexService(
}
.build()
.toString(),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
suspend fun mangasRating(
vararg ids: String
vararg ids: String,
): StatisticsDto {
return client.newCall(
GET(
@@ -83,14 +83,14 @@ class MangaDexService(
}
.build()
.toString(),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
suspend fun aggregateChapters(
id: String,
translatedLanguage: String
translatedLanguage: String,
): AggregateDto {
return client.newCall(
GET(
@@ -103,8 +103,8 @@ class MangaDexService(
}
.build()
.toString(),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -115,7 +115,7 @@ class MangaDexService(
translatedLanguage: String,
offset: Int,
blockedGroups: String,
blockedUploaders: String
blockedUploaders: String,
): ChapterListDto {
val url = MdApi.manga.toHttpUrl()
.newBuilder()
@@ -145,8 +145,8 @@ class MangaDexService(
return client.newCall(
GET(
url,
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
@@ -167,14 +167,14 @@ class MangaDexService(
POST(
MdConstants.atHomeReportUrl,
body = MdUtil.encodeToBody(atHomeImageReportDto),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
suspend fun getAtHomeServer(
atHomeRequestUrl: String,
headers: Headers
headers: Headers,
): AtHomeDto {
return client.newCall(GET(atHomeRequestUrl, headers, CacheControl.FORCE_NETWORK))
.await()
@@ -191,8 +191,8 @@ class MangaDexService(
}
.build()
.toString(),
cache = CacheControl.FORCE_NETWORK
)
cache = CacheControl.FORCE_NETWORK,
),
).await().parseAs(MdUtil.jsonParser)
}
}
@@ -8,13 +8,13 @@ import exh.md.utils.MdUtil
import okhttp3.OkHttpClient
class SimilarService(
private val client: OkHttpClient
private val client: OkHttpClient,
) {
suspend fun getSimilarManga(mangaId: String): SimilarMangaDto {
return client.newCall(
GET(
"${MdUtil.similarBaseApi}$mangaId.json"
)
"${MdUtil.similarBaseApi}$mangaId.json",
),
).await().parseAs()
}
}
@@ -18,8 +18,8 @@ class MangaDexSimilarController(bundle: Bundle) : BrowseSourceController(bundle)
bundleOf(
MANGA_ID to manga.id!!,
MANGA_TITLE to manga.title,
SOURCE_ID_KEY to source.id
)
SOURCE_ID_KEY to source.id,
),
)
private val mangaTitle = args.getString(MANGA_TITLE)
@@ -24,7 +24,7 @@ class MangaDexSimilarPager(val manga: Manga, val source: MangaDex) : Pager() {
MetadataMangasPage(
relatedPage.mangas + similarPage.mangas,
false,
relatedPage.mangasMetadata + similarPage.mangasMetadata
relatedPage.mangasMetadata + similarPage.mangasMetadata,
)
}
+4 -4
View File
@@ -79,11 +79,11 @@ class MdUtil {
"English :",
"[English]:",
"English Translaton:",
"[B][ENG][/B]"
"[B][ENG][/B]",
)
val bbCodeToRemove = listOf(
"list", "*", "hr", "u", "b", "i", "s", "center", "spoiler="
"list", "*", "hr", "u", "b", "i", "s", "center", "spoiler=",
)
val descriptionLanguages = listOf(
"=FRANCAIS=",
@@ -274,7 +274,7 @@ class MdUtil {
?.fileName
?.let { coverFileName ->
cdnCoverUrl(json.id, coverFileName)
}.orEmpty()
}.orEmpty(),
)
}
@@ -331,7 +331,7 @@ class MdUtil {
fun getAuthHeaders(headers: Headers, preferences: PreferencesHelper, mdList: MdList) =
headers.newBuilder().add(
"Authorization",
"Bearer " + (sessionToken(preferences, mdList) ?: throw NoSessionException())
"Bearer " + (sessionToken(preferences, mdList) ?: throw NoSessionException()),
).build()
fun getEnabledMangaDex(preferences: PreferencesHelper, sourceManager: SourceManager = Injekt.get()): MangaDex? {
@@ -27,7 +27,7 @@ import exh.merged.sql.tables.MergedTable.TABLE
class MergedMangaTypeMapping : SQLiteTypeMapping<MergedMangaReference>(
MergedMangaPutResolver(),
MergedMangaGetResolver(),
MergedMangaDeleteResolver()
MergedMangaDeleteResolver(),
)
class MergedMangaPutResolver : DefaultPutResolver<MergedMangaReference>() {
@@ -53,7 +53,7 @@ class MergedMangaPutResolver : DefaultPutResolver<MergedMangaReference>() {
COL_MERGE_URL to obj.mergeUrl,
COL_MANGA_ID to obj.mangaId,
COL_MANGA_URL to obj.mangaUrl,
COL_MANGA_SOURCE to obj.mangaSourceId
COL_MANGA_SOURCE to obj.mangaSourceId,
)
}
@@ -70,7 +70,7 @@ class MergedMangaGetResolver : DefaultGetResolver<MergedMangaReference>() {
mergeUrl = cursor.getString(cursor.getColumnIndexOrThrow(COL_MERGE_URL)),
mangaId = cursor.getLongOrNull(cursor.getColumnIndexOrThrow(COL_MANGA_ID)),
mangaUrl = cursor.getString(cursor.getColumnIndexOrThrow(COL_MANGA_URL)),
mangaSourceId = cursor.getLong(cursor.getColumnIndexOrThrow(COL_MANGA_SOURCE))
mangaSourceId = cursor.getLong(cursor.getColumnIndexOrThrow(COL_MANGA_SOURCE)),
)
}
@@ -32,7 +32,7 @@ data class MergedMangaReference(
val mangaUrl: String,
// source of the manga that is merged into this merge
val mangaSourceId: Long
val mangaSourceId: Long,
) {
companion object {
const val CHAPTER_SORT_NONE = 0
@@ -26,7 +26,7 @@ interface MergedQueries : DbProvider {
.table(MergedTable.TABLE)
.where("${MergedTable.COL_MERGE_ID} = ?")
.whereArgs(mergedMangaId)
.build()
.build(),
)
.prepare()
@@ -37,7 +37,7 @@ interface MergedQueries : DbProvider {
.table(MergedTable.TABLE)
.where("${MergedTable.COL_MERGE_URL} = ?")
.whereArgs(mergedMangaUrl)
.build()
.build(),
)
.prepare()
@@ -47,7 +47,7 @@ interface MergedQueries : DbProvider {
.table(MergedTable.TABLE)
.where("${MergedTable.COL_MERGE_ID} = ?")
.whereArgs(mergedMangaId)
.build()
.build(),
)
.prepare()
@@ -57,7 +57,7 @@ interface MergedQueries : DbProvider {
RawQuery.builder()
.query(getMergedMangaQuery())
.args(mergedMangaId)
.build()
.build(),
)
.prepare()
@@ -67,7 +67,7 @@ interface MergedQueries : DbProvider {
RawQuery.builder()
.query(getMergedMangaFromUrlQuery())
.args(mergedMangaUrl)
.build()
.build(),
)
.prepare()
@@ -76,7 +76,7 @@ interface MergedQueries : DbProvider {
.withQuery(
RawQuery.builder()
.query(getAllMergedMangaQuery())
.build()
.build(),
)
.prepare()
@@ -86,7 +86,7 @@ interface MergedQueries : DbProvider {
.table(MergedTable.TABLE)
.where("${MergedTable.COL_MERGE_URL} = ?")
.whereArgs(mergedMangaUrl)
.build()
.build(),
)
.prepare()
@@ -96,7 +96,7 @@ interface MergedQueries : DbProvider {
Query.builder()
.table(MergedTable.TABLE)
.orderBy(MergedTable.COL_ID)
.build()
.build(),
)
.prepare()
@@ -107,7 +107,7 @@ interface MergedQueries : DbProvider {
.query(getMergedChaptersQuery())
.args(mergedMangaId)
.observesTables(ChapterTable.TABLE, MergedTable.TABLE)
.build()
.build(),
)
.prepare()
@@ -126,7 +126,7 @@ interface MergedQueries : DbProvider {
fun deleteAllMergedManga() = db.delete().byQuery(
DeleteQuery.builder()
.table(MergedTable.TABLE)
.build()
.build(),
)
.prepare()
@@ -26,6 +26,6 @@ class MergedMangaIdPutResolver : PutResolver<MergedMangaReference>() {
.build()
fun mapToContentValues(mergedMangaReference: MergedMangaReference) = contentValuesOf(
MergedTable.COL_MANGA_ID to mergedMangaReference.mangaId
MergedTable.COL_MANGA_ID to mergedMangaReference.mangaId,
)
}
@@ -62,7 +62,7 @@ object MetadataUtil {
"(wip)",
"{wip}",
"<wip>",
"wip"
"wip",
)
val EX_DATE_FORMAT = SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US)
@@ -85,7 +85,7 @@ class EHentaiSearchMetadata : RaisedSearchMetadata() {
description = description,
genres = genres,
status = status,
cover = cover ?: manga.cover
cover = cover ?: manga.cover,
)
}
@@ -34,7 +34,7 @@ class EightMusesSearchMetadata : RaisedSearchMetadata() {
cover = cover ?: manga.cover,
artist = artist,
genres = genres,
description = description
description = description,
)
}
@@ -44,7 +44,7 @@ class EightMusesSearchMetadata : RaisedSearchMetadata() {
title?.let { getString(R.string.title) to it },
path.nullIfEmpty()?.joinToString("/", prefix = "/")
?.let { getString(R.string.path) to it },
thumbnailUrl?.let { getString(R.string.thumbnail_url) to it }
thumbnailUrl?.let { getString(R.string.thumbnail_url) to it },
)
}
}
@@ -41,7 +41,7 @@ class HBrowseSearchMetadata : RaisedSearchMetadata() {
cover = cover ?: manga.cover,
artist = artist,
genres = genres,
description = description
description = description,
)
}
@@ -52,7 +52,7 @@ class HBrowseSearchMetadata : RaisedSearchMetadata() {
hbUrl?.let { getString(R.string.url) to it },
thumbnail?.let { getString(R.string.thumbnail_url) to it },
title?.let { getString(R.string.title) to it },
length?.let { getString(R.string.page_count) to it.toString() }
length?.let { getString(R.string.page_count) to it.toString() },
)
}
}
@@ -52,7 +52,7 @@ class HitomiSearchMetadata : RaisedSearchMetadata() {
genres = genres,
artist = artist,
status = status,
description = description
description = description,
)
}
@@ -65,7 +65,7 @@ class HitomiSearchMetadata : RaisedSearchMetadata() {
artists.nullIfEmpty()?.joinToString()?.let { getString(R.string.artist) to it },
genre?.let { getString(R.string.genre) to it },
language?.let { getString(R.string.language) to it },
uploadDate?.let { getString(R.string.date_posted) to MetadataUtil.EX_DATE_FORMAT.format(Date(it)) }
uploadDate?.let { getString(R.string.date_posted) to MetadataUtil.EX_DATE_FORMAT.format(Date(it)) },
)
}
}
@@ -70,7 +70,7 @@ class MangaDexSearchMetadata : RaisedSearchMetadata() {
artist = artist ?: manga.artist,
status = status ?: manga.status,
genres = genres,
description = description ?: manga.description
description = description ?: manga.description,
)
}
@@ -81,7 +81,7 @@ class NHentaiSearchMetadata : RaisedSearchMetadata() {
artist = artist ?: manga.artist,
genres = genres,
status = status,
description = description
description = description,
)
}
@@ -60,7 +60,7 @@ class PervEdenSearchMetadata : RaisedSearchMetadata() {
artist = artist ?: manga.artist,
status = status,
genres = genres,
description = description
description = description,
)
}
@@ -49,7 +49,7 @@ class PururinSearchMetadata : RaisedSearchMetadata() {
cover = cover ?: manga.cover,
artist = artist,
genres = genres,
description = description
description = description,
)
}
@@ -62,7 +62,7 @@ class TsuminoSearchMetadata : RaisedSearchMetadata() {
artist = artist ?: manga.artist,
status = status,
genres = genres,
description = description
description = description,
)
}
@@ -19,7 +19,7 @@ import kotlin.reflect.KClass
data class FlatMetadata(
val metadata: SearchMetadata,
val tags: List<SearchTag>,
val titles: List<SearchTitle>
val titles: List<SearchTitle>,
) {
inline fun <reified T : RaisedSearchMetadata> raise(): T = raise(T::class)
@@ -100,7 +100,7 @@ abstract class RaisedSearchMetadata {
uploader,
extra,
indexedExtra,
0
0,
),
tags.map {
SearchTag(
@@ -108,7 +108,7 @@ abstract class RaisedSearchMetadata {
mangaId,
it.namespace,
it.name,
it.type
it.type,
)
},
titles.map {
@@ -116,9 +116,9 @@ abstract class RaisedSearchMetadata {
null,
mangaId,
it.title,
it.type
it.type,
)
}
},
)
}
@@ -6,5 +6,5 @@ import kotlinx.serialization.Serializable
data class RaisedTag(
val namespace: String?,
val name: String,
val type: Int
val type: Int,
)
@@ -5,5 +5,5 @@ import kotlinx.serialization.Serializable
@Serializable
data class RaisedTitle(
val title: String,
val type: Int = 0
val type: Int = 0,
)
@@ -20,7 +20,7 @@ import exh.metadata.sql.tables.SearchMetadataTable.TABLE
class SearchMetadataTypeMapping : SQLiteTypeMapping<SearchMetadata>(
SearchMetadataPutResolver(),
SearchMetadataGetResolver(),
SearchMetadataDeleteResolver()
SearchMetadataDeleteResolver(),
)
class SearchMetadataPutResolver : DefaultPutResolver<SearchMetadata>() {
@@ -52,7 +52,7 @@ class SearchMetadataGetResolver : DefaultGetResolver<SearchMetadata>() {
uploader = cursor.getString(cursor.getColumnIndexOrThrow(COL_UPLOADER)),
extra = cursor.getString(cursor.getColumnIndexOrThrow(COL_EXTRA)),
indexedExtra = cursor.getString(cursor.getColumnIndexOrThrow(COL_INDEXED_EXTRA)),
extraVersion = cursor.getInt(cursor.getColumnIndexOrThrow(COL_EXTRA_VERSION))
extraVersion = cursor.getInt(cursor.getColumnIndexOrThrow(COL_EXTRA_VERSION)),
)
}
@@ -20,7 +20,7 @@ import exh.metadata.sql.tables.SearchTagTable.TABLE
class SearchTagTypeMapping : SQLiteTypeMapping<SearchTag>(
SearchTagPutResolver(),
SearchTagGetResolver(),
SearchTagDeleteResolver()
SearchTagDeleteResolver(),
)
class SearchTagPutResolver : DefaultPutResolver<SearchTag>() {
@@ -51,7 +51,7 @@ class SearchTagGetResolver : DefaultGetResolver<SearchTag>() {
mangaId = cursor.getLong(cursor.getColumnIndexOrThrow(COL_MANGA_ID)),
namespace = cursor.getString(cursor.getColumnIndexOrThrow(COL_NAMESPACE)),
name = cursor.getString(cursor.getColumnIndexOrThrow(COL_NAME)),
type = cursor.getInt(cursor.getColumnIndexOrThrow(COL_TYPE))
type = cursor.getInt(cursor.getColumnIndexOrThrow(COL_TYPE)),
)
}
@@ -19,7 +19,7 @@ import exh.metadata.sql.tables.SearchTitleTable.TABLE
class SearchTitleTypeMapping : SQLiteTypeMapping<SearchTitle>(
SearchTitlePutResolver(),
SearchTitleGetResolver(),
SearchTitleDeleteResolver()
SearchTitleDeleteResolver(),
)
class SearchTitlePutResolver : DefaultPutResolver<SearchTitle>() {
@@ -48,7 +48,7 @@ class SearchTitleGetResolver : DefaultGetResolver<SearchTitle>() {
id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_ID)),
mangaId = cursor.getLong(cursor.getColumnIndexOrThrow(COL_MANGA_ID)),
title = cursor.getString(cursor.getColumnIndexOrThrow(COL_TITLE)),
type = cursor.getInt(cursor.getColumnIndexOrThrow(COL_TYPE))
type = cursor.getInt(cursor.getColumnIndexOrThrow(COL_TYPE)),
)
}
@@ -18,7 +18,7 @@ data class SearchMetadata(
val indexedExtra: String?,
// The version of this metadata's extra. Used to track changes to the 'extra' field's schema
val extraVersion: Int
val extraVersion: Int,
) {
// Transient information attached to this piece of metadata, useful for caching
@@ -17,5 +17,5 @@ data class SearchTag(
val name: String,
// Tag type
val type: Int
val type: Int,
)
@@ -14,5 +14,5 @@ data class SearchTitle(
val title: String,
// Title type, useful for distinguishing between main/alt titles
val type: Int
val type: Int,
)
@@ -15,7 +15,7 @@ interface SearchMetadataQueries : DbProvider {
.table(SearchMetadataTable.TABLE)
.where("${SearchMetadataTable.COL_MANGA_ID} = ?")
.whereArgs(mangaId)
.build()
.build(),
)
.prepare()
@@ -24,7 +24,7 @@ interface SearchMetadataQueries : DbProvider {
.withQuery(
Query.builder()
.table(SearchMetadataTable.TABLE)
.build()
.build(),
)
.prepare()
@@ -35,7 +35,7 @@ interface SearchMetadataQueries : DbProvider {
.table(SearchMetadataTable.TABLE)
.where("${SearchMetadataTable.COL_INDEXED_EXTRA} = ?")
.whereArgs(extra)
.build()
.build(),
)
.prepare()
@@ -46,7 +46,7 @@ interface SearchMetadataQueries : DbProvider {
fun deleteAllSearchMetadata() = db.delete().byQuery(
DeleteQuery.builder()
.table(SearchMetadataTable.TABLE)
.build()
.build(),
)
.prepare()
}
@@ -15,7 +15,7 @@ interface SearchTagQueries : DbProvider {
.table(SearchTagTable.TABLE)
.where("${SearchTagTable.COL_MANGA_ID} = ?")
.whereArgs(mangaId)
.build()
.build(),
)
.prepare()
@@ -25,7 +25,7 @@ interface SearchTagQueries : DbProvider {
.table(SearchTagTable.TABLE)
.where("${SearchTagTable.COL_MANGA_ID} = ?")
.whereArgs(mangaId)
.build()
.build(),
)
.prepare()
@@ -38,7 +38,7 @@ interface SearchTagQueries : DbProvider {
fun deleteAllSearchTags() = db.delete().byQuery(
DeleteQuery.builder()
.table(SearchTagTable.TABLE)
.build()
.build(),
)
.prepare()
@@ -15,7 +15,7 @@ interface SearchTitleQueries : DbProvider {
.table(SearchTitleTable.TABLE)
.where("${SearchTitleTable.COL_MANGA_ID} = ?")
.whereArgs(mangaId)
.build()
.build(),
)
.prepare()
@@ -25,7 +25,7 @@ interface SearchTitleQueries : DbProvider {
.table(SearchTitleTable.TABLE)
.where("${SearchTitleTable.COL_MANGA_ID} = ?")
.whereArgs(mangaId)
.build()
.build(),
)
.prepare()
@@ -38,7 +38,7 @@ interface SearchTitleQueries : DbProvider {
fun deleteAllSearchTitle() = db.delete().byQuery(
DeleteQuery.builder()
.table(SearchTitleTable.TABLE)
.build()
.build(),
)
.prepare()
+2 -2
View File
@@ -36,7 +36,7 @@ val MANGADEX_LOGIN_PATCH: EHInterceptor = { request, response, sourceId ->
"Login",
(Injekt.get<SourceManager>().get(sourceId) as? HttpSource)?.headers?.toMultimap()?.mapValues {
it.value.joinToString(",")
} ?: emptyMap()
} ?: emptyMap(),
)
}
}
@@ -81,6 +81,6 @@ val MANGADEX_SOURCE_IDS = listOf(
3781216447842245147,
4774459486579224459,
4710920497926776490,
5779037855201976894
5779037855201976894,
)
const val MANGADEX_DOMAIN = "mangadex.org"
@@ -35,6 +35,6 @@ fun List<EHInterceptor>.merge(): EHInterceptor {
private const val EH_UNIVERSAL_INTERCEPTOR = -1L
private val EH_INTERCEPTORS: Map<Long, List<EHInterceptor>> = mapOf(
EH_UNIVERSAL_INTERCEPTOR to listOf(
CAPTCHA_DETECTION_PATCH // Auto captcha detection
)
CAPTCHA_DETECTION_PATCH, // Auto captcha detection
),
)
@@ -15,7 +15,7 @@ val CAPTCHA_DETECTION_PATCH: EHInterceptor = { request, response, sourceId ->
BrowserActionActivity.launchUniversal(
Injekt.get<Application>(),
sourceId,
request.url.toString()
request.url.toString(),
)
}
}
@@ -20,8 +20,8 @@ class RecommendsController(bundle: Bundle) : BrowseSourceController(bundle) {
constructor(manga: Manga, source: CatalogueSource) : this(
bundleOf(
MANGA_ID to manga.id!!,
SOURCE_ID_KEY to source.id
)
SOURCE_ID_KEY to source.id,
),
)
override fun getTitle(): String? {
@@ -54,9 +54,9 @@ class RecommendsController(bundle: Bundle) : BrowseSourceController(bundle) {
router.pushController(
SourceController(
bundleOf(
SourceController.SMART_SEARCH_CONFIG to smartSearchConfig
)
).withFadeTransaction()
SourceController.SMART_SEARCH_CONFIG to smartSearchConfig,
),
).withFadeTransaction(),
)
}
@@ -150,7 +150,8 @@ class Anilist : API("https://graphql.anilist.co/") {
|}
|}
|}
|""".trimMargin()
|
""".trimMargin()
val variables = buildJsonObject {
put("search", search)
}
@@ -172,8 +173,8 @@ class Anilist : API("https://graphql.anilist.co/") {
{ languageContains(it.jsonObject, "romaji", search) },
{ languageContains(it.jsonObject, "english", search) },
{ languageContains(it.jsonObject, "native", search) },
{ countOccurrence(it.jsonObject["synonyms"]!!.jsonArray, search) > 0 }
)
{ countOccurrence(it.jsonObject["synonyms"]!!.jsonArray, search) > 0 },
),
).last().jsonObject
return result["recommendations"]?.jsonObject?.get("edges")?.jsonArray?.map {
@@ -193,7 +194,7 @@ class Anilist : API("https://graphql.anilist.co/") {
open class RecommendsPager(
private val manga: Manga,
private val smart: Boolean = true,
private var preferredApi: API = API.MYANIMELIST
private var preferredApi: API = API.MYANIMELIST,
) : Pager() {
override suspend fun requestNextPage() {
if (smart) preferredApi = if (manga.mangaType() != MangaType.TYPE_MANGA) API.ANILIST else preferredApi
@@ -223,7 +224,7 @@ open class RecommendsPager(
companion object {
val API_MAP = mapOf(
API.MYANIMELIST to MyAnimeList(),
API.ANILIST to Anilist()
API.ANILIST to Anilist(),
)
enum class API { MYANIMELIST, ANILIST }
@@ -6,5 +6,5 @@ data class EXHSavedSearch(
val id: Long,
val name: String,
val query: String,
val filterList: FilterList?
val filterList: FilterList?,
)
@@ -20,7 +20,7 @@ import exh.savedsearches.tables.FeedSavedSearchTable.TABLE
class FeedSavedSearchTypeMapping : SQLiteTypeMapping<FeedSavedSearch>(
FeedSavedSearchPutResolver(),
FeedSavedSearchGetResolver(),
FeedSavedSearchDeleteResolver()
FeedSavedSearchDeleteResolver(),
)
class FeedSavedSearchPutResolver : DefaultPutResolver<FeedSavedSearch>() {
@@ -39,7 +39,7 @@ class FeedSavedSearchPutResolver : DefaultPutResolver<FeedSavedSearch>() {
COL_ID to obj.id,
COL_SOURCE to obj.source,
COL_SAVED_SEARCH_ID to obj.savedSearch,
COL_GLOBAL to obj.global
COL_GLOBAL to obj.global,
)
}
@@ -49,7 +49,7 @@ class FeedSavedSearchGetResolver : DefaultGetResolver<FeedSavedSearch>() {
id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_ID)),
source = cursor.getLong(cursor.getColumnIndexOrThrow(COL_SOURCE)),
savedSearch = cursor.getLongOrNull(cursor.getColumnIndexOrThrow(COL_SAVED_SEARCH_ID)),
global = cursor.getInt(cursor.getColumnIndexOrThrow(COL_GLOBAL)) == 1
global = cursor.getInt(cursor.getColumnIndexOrThrow(COL_GLOBAL)) == 1,
)
}
@@ -21,7 +21,7 @@ import exh.savedsearches.tables.SavedSearchTable.TABLE
class SavedSearchTypeMapping : SQLiteTypeMapping<SavedSearch>(
SavedSearchPutResolver(),
SavedSearchGetResolver(),
SavedSearchDeleteResolver()
SavedSearchDeleteResolver(),
)
class SavedSearchPutResolver : DefaultPutResolver<SavedSearch>() {
@@ -41,7 +41,7 @@ class SavedSearchPutResolver : DefaultPutResolver<SavedSearch>() {
COL_SOURCE to obj.source,
COL_NAME to obj.name,
COL_QUERY to obj.query,
COL_FILTERS_JSON to obj.filtersJson
COL_FILTERS_JSON to obj.filtersJson,
)
}
@@ -52,7 +52,7 @@ class SavedSearchGetResolver : DefaultGetResolver<SavedSearch>() {
source = cursor.getLong(cursor.getColumnIndexOrThrow(COL_SOURCE)),
name = cursor.getString(cursor.getColumnIndexOrThrow(COL_NAME)),
query = cursor.getStringOrNull(cursor.getColumnIndexOrThrow(COL_QUERY)),
filtersJson = cursor.getStringOrNull(cursor.getColumnIndexOrThrow(COL_FILTERS_JSON))
filtersJson = cursor.getStringOrNull(cursor.getColumnIndexOrThrow(COL_FILTERS_JSON)),
)
}
@@ -11,5 +11,5 @@ data class FeedSavedSearch(
var savedSearch: Long?,
// If the feed is a global or source specific feed
var global: Boolean
var global: Boolean,
)
@@ -18,7 +18,7 @@ interface FeedSavedSearchQueries : DbProvider {
.table(FeedSavedSearchTable.TABLE)
.where("${FeedSavedSearchTable.COL_GLOBAL} = 1")
.orderBy(FeedSavedSearchTable.COL_ID)
.build()
.build(),
)
.prepare()
@@ -30,7 +30,7 @@ interface FeedSavedSearchQueries : DbProvider {
.where("${FeedSavedSearchTable.COL_SOURCE} = ? AND ${FeedSavedSearchTable.COL_GLOBAL} = 0")
.whereArgs(sourceId)
.orderBy(FeedSavedSearchTable.COL_ID)
.build()
.build(),
)
.prepare()
@@ -46,13 +46,13 @@ interface FeedSavedSearchQueries : DbProvider {
.table(FeedSavedSearchTable.TABLE)
.where("${FeedSavedSearchTable.COL_ID} = ?")
.whereArgs(id)
.build()
.build(),
).prepare()
fun deleteAllFeedSavedSearches() = db.delete().byQuery(
DeleteQuery.builder()
.table(FeedSavedSearchTable.TABLE)
.build()
.build(),
)
.prepare()
@@ -61,7 +61,7 @@ interface FeedSavedSearchQueries : DbProvider {
.withQuery(
RawQuery.builder()
.query(getGlobalFeedSavedSearchQuery())
.build()
.build(),
)
.prepare()
@@ -71,7 +71,7 @@ interface FeedSavedSearchQueries : DbProvider {
RawQuery.builder()
.query(getSourceFeedSavedSearchQuery())
.args(sourceId)
.build()
.build(),
)
.prepare()
@@ -14,7 +14,7 @@ interface SavedSearchQueries : DbProvider {
.table(SavedSearchTable.TABLE)
.where("${SavedSearchTable.COL_SOURCE} = ?")
.whereArgs(source)
.build()
.build(),
)
.prepare()
@@ -24,7 +24,7 @@ interface SavedSearchQueries : DbProvider {
.table(SavedSearchTable.TABLE)
.where("${SavedSearchTable.COL_SOURCE} = ?")
.whereArgs(source)
.build()
.build(),
)
.prepare()
@@ -34,7 +34,7 @@ interface SavedSearchQueries : DbProvider {
Query.builder()
.table(SavedSearchTable.TABLE)
.orderBy(SavedSearchTable.COL_ID)
.build()
.build(),
)
.prepare()
@@ -45,7 +45,7 @@ interface SavedSearchQueries : DbProvider {
.table(SavedSearchTable.TABLE)
.where("${SavedSearchTable.COL_ID} = ?")
.whereArgs(id)
.build()
.build(),
)
.prepare()
@@ -56,7 +56,7 @@ interface SavedSearchQueries : DbProvider {
.table(SavedSearchTable.TABLE)
.where("${SavedSearchTable.COL_ID} IN (?)")
.whereArgs(ids.joinToString())
.build()
.build(),
)
.prepare()
@@ -72,13 +72,13 @@ interface SavedSearchQueries : DbProvider {
.table(SavedSearchTable.TABLE)
.where("${SavedSearchTable.COL_ID} = ?")
.whereArgs(id)
.build()
.build(),
).prepare()
fun deleteAllSavedSearches() = db.delete().byQuery(
DeleteQuery.builder()
.table(SavedSearchTable.TABLE)
.build()
.build(),
)
.prepare()
+1 -1
View File
@@ -2,5 +2,5 @@ package exh.search
class Namespace(
var namespace: String,
var tag: Text? = null
var tag: Text? = null,
) : QueryComponent()
+1 -1
View File
@@ -10,7 +10,7 @@ class SearchEngine {
fun textToSubQueries(
namespace: String?,
component: Text?
component: Text?,
): Pair<String, List<String>>? {
val maybeLenientComponent = component?.let {
if (!it.exact) {
+1 -1
View File
@@ -33,7 +33,7 @@ class Text : QueryComponent() {
// Can't make it match a single word in Realm :(
StringBuilder(" ").append(rBaseBuilder()).append(" ").toString(),
StringBuilder(" ").append(rBaseBuilder()).toString(),
rBaseBuilder().append(" ").toString()
rBaseBuilder().append(" ").toString(),
)
}
return lenientTagQueries!!
@@ -15,7 +15,7 @@ import uy.kohesive.injekt.injectLazy
import java.util.Locale
class SmartSearchEngine(
private val extraSearchParams: String? = null
private val extraSearchParams: String? = null,
) {
private val db: DatabaseHelper by injectLazy()
@@ -90,7 +90,7 @@ class SmartSearchEngine(
splitSortedByLargest.take(2),
splitSortedByLargest.take(1),
splitCleanedTitle.take(2),
splitCleanedTitle.take(1)
splitCleanedTitle.take(1),
)
return searchQueries.map {
@@ -121,7 +121,7 @@ class SmartSearchEngine(
'(' to ')',
'[' to ']',
'<' to '>',
'{' to '}'
'{' to '}',
)
var openingBracketPairs = bracketPairs.mapIndexed { index, (opening, _) ->
opening to index
@@ -18,16 +18,16 @@ object BlacklistedSources {
5980349886941016589,
6073266008352078708,
5499077866612745456,
6140480779421365791
6140480779421365791,
)
val BLACKLISTED_EXT_SOURCES = EHENTAI_EXT_SOURCES
val BLACKLISTED_EXTENSIONS = arrayOf(
"eu.kanade.tachiyomi.extension.all.ehentai"
"eu.kanade.tachiyomi.extension.all.ehentai",
)
var HIDDEN_SOURCES = setOf(
MERGED_SOURCE_ID
MERGED_SOURCE_ID,
)
}
@@ -15,7 +15,7 @@ import uy.kohesive.injekt.injectLazy
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
class EnhancedHttpSource(
val originalSource: HttpSource,
val enhancedSource: HttpSource
val enhancedSource: HttpSource,
) : HttpSource() {
private val prefs: PreferencesHelper by injectLazy()
+3 -3
View File
@@ -36,7 +36,7 @@ private val DELEGATED_METADATA_SOURCES by lazy {
EightMuses::class,
Hitomi::class,
PervEden::class,
NHentai::class
NHentai::class,
)
}
@@ -52,7 +52,7 @@ var mangaDexSourceIds: List<Long> = emptyList()
var LIBRARY_UPDATE_EXCLUDED_SOURCES = listOf(
EH_SOURCE_ID,
EXH_SOURCE_ID,
PURURIN_SOURCE_ID
PURURIN_SOURCE_ID,
)
fun handleSourceLibrary() {
@@ -87,7 +87,7 @@ fun handleSourceLibrary() {
LIBRARY_UPDATE_EXCLUDED_SOURCES = listOf(
EH_SOURCE_ID,
EXH_SOURCE_ID,
PURURIN_SOURCE_ID
PURURIN_SOURCE_ID,
) + hitomiSourceIds + nHentaiSourceIds
}
@@ -32,7 +32,7 @@ class EHConfigurator(val context: Context) {
action: String,
name: String,
set: String,
sp: Int
sp: Int,
) =
configuratorClient.newCall(
requestWithCreds(sp)
@@ -42,9 +42,9 @@ class EHConfigurator(val context: Context) {
.add("profile_action", action)
.add("profile_name", name)
.add("profile_set", set)
.build()
.build(),
)
.build()
.build(),
)
.await()
@@ -58,7 +58,7 @@ class EHConfigurator(val context: Context) {
val perksPage = configuratorClient.newCall(
ehSource.requestWithCreds()
.url(HATH_PERKS_URL)
.build()
.build(),
)
.await().asJsoup()
@@ -117,7 +117,7 @@ class EHConfigurator(val context: Context) {
"create",
PROFILE_NAME,
slot.toString(),
1
1,
)
// Build new profile
@@ -128,7 +128,7 @@ class EHConfigurator(val context: Context) {
source.requestWithCreds(sp = slot)
.url(source.uconfigUrl)
.post(form)
.build()
.build(),
).await()
// Persist slot + sk
@@ -175,7 +175,7 @@ object Entry {
GenreConfigItem("ct_imageset", list[6]),
GenreConfigItem("ct_cosplay", list[7]),
GenreConfigItem("ct_asianporn", list[8]),
GenreConfigItem("ct_misc", list[9])
GenreConfigItem("ct_misc", list[9]),
)
}
@@ -208,7 +208,7 @@ object Entry {
Thai(config[13]),
Vietnamese(config[14]),
NotAvailable(config[15]),
Other(config[16])
Other(config[16]),
).flatMap { it.configs }
}
@@ -219,7 +219,7 @@ object Entry {
open val configs: List<LanguageConfigItem>
get() = listOf(
LanguageConfigItem(translatedKey, values[1]),
LanguageConfigItem(rewriteKey, values[2])
LanguageConfigItem(rewriteKey, values[2]),
)
protected class LanguageConfigItem(override val key: String, value: Boolean) : ConfigItem {
@@ -18,7 +18,7 @@ import kotlin.coroutines.EmptyCoroutineContext
@Suppress("DEPRECATION", "unused")
open class CoroutinePresenter<V>(
scope: CoroutineScope = MainScope()
scope: CoroutineScope = MainScope(),
) : Presenter<V>(), CoroutineScope by scope {
@Suppress("DeprecatedCallableAddReplaceWith")
@Deprecated("Use launchInView, Flow.inView, Flow.mapView")
@@ -113,7 +113,7 @@ class BatchAddController : NucleusController<EhFragmentBatchAddBinding, BatchAdd
get() = listOf(
inputTitleView,
galleriesBox,
btnAddGalleries
btnAddGalleries,
)
private var List<View>.isVisible: Boolean
@@ -78,7 +78,7 @@ class BatchAddPresenter : BasePresenter<BatchAddController>() {
is GalleryAddEvent.Success -> context.getString(R.string.batch_add_ok)
is GalleryAddEvent.Fail -> context.getString(R.string.batch_add_error)
}
) + " " + result.logMessage
) + " " + result.logMessage,
)
}
@@ -11,7 +11,7 @@ class AutoSolvingWebViewClient(
activity: BrowserActionActivity,
verifyComplete: (String) -> Boolean,
injectScript: String?,
headers: Map<String, String>
headers: Map<String, String>,
) : HeadersInjectingWebViewClient(activity, verifyComplete, injectScript, headers) {
override fun shouldInterceptRequest(view: WebView, request: WebResourceRequest): WebResourceResponse? {
@@ -25,7 +25,7 @@ class AutoSolvingWebViewClient(
return WebResourceResponse(
"text/html",
"UTF-8",
doc.toString().byteInputStream().buffered()
doc.toString().byteInputStream().buffered(),
)
}
return super.shouldInterceptRequest(view, request)
@@ -6,7 +6,7 @@ import android.webkit.WebViewClient
open class BasicWebViewClient(
protected val activity: BrowserActionActivity,
protected val verifyComplete: (String) -> Boolean,
private val injectScript: String?
private val injectScript: String?,
) : WebViewClient() {
override fun onPageFinished(view: WebView, url: String) {
super.onPageFinished(view, url)
@@ -155,7 +155,7 @@ class BrowserActionActivity : AppCompatActivity() {
Request.Builder()
// Rob demo credentials
.url("https://speech-to-text-demo.ng.bluemix.net/api/v1/credentials")
.build()
.build(),
)
.asObservableSuccess()
.subscribeOn(Schedulers.io())
@@ -206,14 +206,14 @@ class BrowserActionActivity : AppCompatActivity() {
{
getAudioButtonLocation(loopId)
},
250
250,
)
} else {
binding.webview.postDelayed(
{
doStageCheckbox(loopId)
},
250
250,
)
}
}
@@ -236,7 +236,7 @@ class BrowserActionActivity : AppCompatActivity() {
{
getAudioButtonLocation(loopId)
},
250
250,
)
}
}
@@ -254,20 +254,20 @@ class BrowserActionActivity : AppCompatActivity() {
it!!
.replace(TRANSCRIPT_CLEANER_REGEX, "")
.replace(SPACE_DEDUPE_REGEX, " ")
.trim()
.trim(),
)
}
},
{
runBlocking { captchaSolveFail() }
}
},
)
} else {
binding.webview.postDelayed(
{
doStageDownloadAudio(loopId)
},
250
250,
)
}
}
@@ -287,7 +287,7 @@ class BrowserActionActivity : AppCompatActivity() {
httpClient.newCall(
Request.Builder()
.url(url)
.build()
.build(),
).asObservableSuccess().map {
token to it
}
@@ -300,7 +300,7 @@ class BrowserActionActivity : AppCompatActivity() {
"https://stream.watsonplatform.net/speech-to-text/api/v1/recognize".toHttpUrlOrNull()!!
.newBuilder()
.addQueryParameter("watson-token", token)
.build()
.build(),
)
.post(
MultipartBody.Builder()
@@ -312,12 +312,12 @@ class BrowserActionActivity : AppCompatActivity() {
audioFile.toRequestBody(
"audio/mp3".toMediaTypeOrNull(),
0,
audioFile.size
)
audioFile.size,
),
)
.build()
.build(),
)
.build()
.build(),
).asObservableSuccess()
}.map { response ->
response.parseAs<JsonObject>()["results"]!!
@@ -358,7 +358,7 @@ class BrowserActionActivity : AppCompatActivity() {
}
})();
""".trimIndent().replace("\n", ""),
null
null,
)
}
@@ -393,7 +393,7 @@ class BrowserActionActivity : AppCompatActivity() {
}
})();
""".trimIndent().replace("\n", ""),
null
null,
)
}
@@ -421,7 +421,7 @@ class BrowserActionActivity : AppCompatActivity() {
}
})();
""".trimIndent().replace("\n", ""),
null
null,
)
}
@@ -452,7 +452,7 @@ class BrowserActionActivity : AppCompatActivity() {
}
})();
""".trimIndent().replace("\n", ""),
null
null,
)
}
@@ -488,7 +488,7 @@ class BrowserActionActivity : AppCompatActivity() {
{
runValidateCaptcha(loopId)
},
250
250,
)
}
}
@@ -520,7 +520,7 @@ class BrowserActionActivity : AppCompatActivity() {
}
})();
""".trimIndent().replace("\n", ""),
null
null,
)
}
@@ -685,7 +685,7 @@ class BrowserActionActivity : AppCompatActivity() {
cookies: Map<String, String>,
script: String?,
url: String,
autoSolveSubmitBtnSelector: String? = null
autoSolveSubmitBtnSelector: String? = null,
) {
val intent = baseIntent(context).apply {
putExtra(SOURCE_ID_EXTRA, source.id)
@@ -701,7 +701,7 @@ class BrowserActionActivity : AppCompatActivity() {
fun launchUniversal(
context: Context,
source: HttpSource,
url: String
url: String,
) {
val intent = baseIntent(context).apply {
putExtra(SOURCE_ID_EXTRA, source.id)
@@ -714,7 +714,7 @@ class BrowserActionActivity : AppCompatActivity() {
fun launchUniversal(
context: Context,
sourceId: Long,
url: String
url: String,
) {
val intent = baseIntent(context).apply {
putExtra(SOURCE_ID_EXTRA, sourceId)
@@ -729,7 +729,7 @@ class BrowserActionActivity : AppCompatActivity() {
completionVerifier: ActionCompletionVerifier,
script: String?,
url: String,
actionName: String
actionName: String,
) {
val intent = baseIntent(context).apply {
putExtra(SOURCE_ID_EXTRA, completionVerifier.id)
@@ -747,7 +747,7 @@ class BrowserActionActivity : AppCompatActivity() {
script: String?,
url: String,
actionName: String,
headers: Map<String, String>? = emptyMap()
headers: Map<String, String>? = emptyMap(),
) {
val intent = baseIntent(context).apply {
putExtra(HEADERS_EXTRA, HashMap(headers!!))
@@ -8,7 +8,7 @@ open class HeadersInjectingWebViewClient(
activity: BrowserActionActivity,
verifyComplete: (String) -> Boolean,
injectScript: String?,
private val headers: Map<String, String>
private val headers: Map<String, String>,
) : BasicWebViewClient(activity, verifyComplete, injectScript) {
override fun shouldInterceptRequest(view: WebView, request: WebResourceRequest): WebResourceResponse? {
@@ -72,7 +72,7 @@ open class HeadersInjectingWebViewClient(
502 to "Bad Gateway",
503 to "Service Unavailable",
504 to "Gateway Time-out",
505 to "HTTP Version not supported"
505 to "HTTP Version not supported",
)
}
}
@@ -76,7 +76,7 @@ class InterceptActivity : BaseActivity() {
.setAction(MainActivity.SHORTCUT_MANGA)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
.putExtra(MangaController.MANGA_EXTRA, it.mangaId)
}
},
)
}
is InterceptResult.Failure -> {
@@ -214,8 +214,10 @@ class EhLoginActivity : BaseActivity() {
fun checkLoginCookies(url: String): Boolean {
getCookies(url)?.let { parsed ->
return parsed.count {
(it.name.equals(MEMBER_ID_COOKIE, ignoreCase = true) ||
it.name.equals(PASS_HASH_COOKIE, ignoreCase = true)) &&
(
it.name.equals(MEMBER_ID_COOKIE, ignoreCase = true) ||
it.name.equals(PASS_HASH_COOKIE, ignoreCase = true)
) &&
it.value.isNotBlank()
} >= 2
}
@@ -20,8 +20,8 @@ import uy.kohesive.injekt.api.get
class MetadataViewController : NucleusController<MetadataViewControllerBinding, MetadataViewPresenter> {
constructor(manga: Manga?) : super(
bundleOf(
MangaController.MANGA_EXTRA to (manga?.id ?: 0)
)
MangaController.MANGA_EXTRA to (manga?.id ?: 0),
),
) {
this.manga = manga
if (manga != null) {
@@ -30,7 +30,7 @@ class MetadataViewController : NucleusController<MetadataViewControllerBinding,
}
constructor(mangaId: Long) : this(
Injekt.get<DatabaseHelper>().getManga(mangaId).executeAsBlocking()
Injekt.get<DatabaseHelper>().getManga(mangaId).executeAsBlocking(),
)
@Suppress("unused")
@@ -50,7 +50,7 @@ class MetadataViewController : NucleusController<MetadataViewControllerBinding,
override fun createPresenter(): MetadataViewPresenter {
return MetadataViewPresenter(
manga!!,
source!!
source!!,
)
}
@@ -20,7 +20,7 @@ class MetadataViewPresenter(
val manga: Manga,
val source: Source,
val preferences: PreferencesHelper = Injekt.get(),
private val db: DatabaseHelper = Injekt.get()
private val db: DatabaseHelper = Injekt.get(),
) : CoroutinePresenter<MetadataViewController>() {
val meta = MutableStateFlow<RaisedSearchMetadata?>(null)
@@ -16,7 +16,7 @@ import exh.metadata.metadata.EHentaiSearchMetadata
import exh.ui.metadata.MetadataViewController
class EHentaiDescriptionAdapter(
private val controller: MangaController
private val controller: MangaController,
) :
RecyclerView.Adapter<EHentaiDescriptionAdapter.EHentaiDescriptionViewHolder>() {
@@ -82,12 +82,12 @@ class EHentaiDescriptionAdapter(
binding.pages,
binding.rating,
binding.uploader,
binding.visible
binding.visible,
).forEach { textView ->
textView.setOnLongClickListener {
itemView.context.copyToClipboard(
textView.text.toString(),
textView.text.toString()
textView.text.toString(),
)
true
}
@@ -100,8 +100,8 @@ class EHentaiDescriptionAdapter(
binding.moreInfo.setOnClickListener {
controller.router?.pushController(
MetadataViewController(
controller.manga
).withFadeTransaction()
controller.manga,
).withFadeTransaction(),
)
}
}
@@ -14,7 +14,7 @@ import exh.metadata.metadata.EightMusesSearchMetadata
import exh.ui.metadata.MetadataViewController
class EightMusesDescriptionAdapter(
private val controller: MangaController
private val controller: MangaController,
) :
RecyclerView.Adapter<EightMusesDescriptionAdapter.EightMusesDescriptionViewHolder>() {
@@ -43,7 +43,7 @@ class EightMusesDescriptionAdapter(
binding.title.setOnLongClickListener {
itemView.context.copyToClipboard(
binding.title.text.toString(),
binding.title.text.toString()
binding.title.text.toString(),
)
true
}
@@ -51,8 +51,8 @@ class EightMusesDescriptionAdapter(
binding.moreInfo.setOnClickListener {
controller.router?.pushController(
MetadataViewController(
controller.manga
).withFadeTransaction()
controller.manga,
).withFadeTransaction(),
)
}
}
@@ -14,7 +14,7 @@ import exh.metadata.metadata.HBrowseSearchMetadata
import exh.ui.metadata.MetadataViewController
class HBrowseDescriptionAdapter(
private val controller: MangaController
private val controller: MangaController,
) :
RecyclerView.Adapter<HBrowseDescriptionAdapter.HBrowseDescriptionViewHolder>() {
@@ -44,7 +44,7 @@ class HBrowseDescriptionAdapter(
binding.pages.setOnLongClickListener {
itemView.context.copyToClipboard(
binding.pages.text.toString(),
binding.pages.text.toString()
binding.pages.text.toString(),
)
true
}
@@ -52,8 +52,8 @@ class HBrowseDescriptionAdapter(
binding.moreInfo.setOnClickListener {
controller.router?.pushController(
MetadataViewController(
controller.manga
).withFadeTransaction()
controller.manga,
).withFadeTransaction(),
)
}
}
@@ -16,7 +16,7 @@ import exh.ui.metadata.MetadataViewController
import java.util.Date
class HitomiDescriptionAdapter(
private val controller: MangaController
private val controller: MangaController,
) :
RecyclerView.Adapter<HitomiDescriptionAdapter.HitomiDescriptionViewHolder>() {
@@ -51,12 +51,12 @@ class HitomiDescriptionAdapter(
listOf(
binding.genre,
binding.language,
binding.whenPosted
binding.whenPosted,
).forEach { textView ->
textView.setOnLongClickListener {
itemView.context.copyToClipboard(
textView.text.toString(),
textView.text.toString()
textView.text.toString(),
)
true
}
@@ -65,8 +65,8 @@ class HitomiDescriptionAdapter(
binding.moreInfo.setOnClickListener {
controller.router?.pushController(
MetadataViewController(
controller.manga
).withFadeTransaction()
controller.manga,
).withFadeTransaction(),
)
}
}

Some files were not shown because too many files have changed in this diff Show More