Extract source api from app module (#8014)
* Extract source api from app module
* Extract source online api from app module
(cherry picked from commit 86fe850794)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt
# core/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt
# source-api/src/main/java/eu/kanade/tachiyomi/source/Source.kt
# source-api/src/main/java/eu/kanade/tachiyomi/source/model/SManga.kt
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
package exh.util
|
||||
|
||||
fun <C : Collection<R>, R> C.nullIfEmpty() = ifEmpty { null }
|
||||
@@ -34,12 +34,12 @@ object SourceTagsUtil {
|
||||
}
|
||||
if (parsed?.namespace != null) {
|
||||
when (sourceId) {
|
||||
in hitomiSourceIds -> wrapTagHitomi(parsed.namespace, parsed.name.substringBefore('|').trim())
|
||||
in nHentaiSourceIds -> wrapTagNHentai(parsed.namespace, parsed.name.substringBefore('|').trim())
|
||||
in hitomiSourceIds -> wrapTagHitomi(parsed.namespace!!, parsed.name.substringBefore('|').trim())
|
||||
in nHentaiSourceIds -> wrapTagNHentai(parsed.namespace!!, parsed.name.substringBefore('|').trim())
|
||||
in mangaDexSourceIds -> parsed.name
|
||||
PURURIN_SOURCE_ID -> parsed.name.substringBefore('|').trim()
|
||||
TSUMINO_SOURCE_ID -> wrapTagTsumino(parsed.namespace, parsed.name.substringBefore('|').trim())
|
||||
else -> wrapTag(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 {
|
||||
null
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
package exh.util
|
||||
|
||||
import java.util.Locale
|
||||
|
||||
fun String.capitalize(locale: Locale = Locale.getDefault()) =
|
||||
replaceFirstChar { if (it.isLowerCase()) it.titlecase(locale) else it.toString() }
|
||||
@@ -1,3 +0,0 @@
|
||||
package exh.util
|
||||
|
||||
operator fun StringBuilder.plusAssign(other: String) { append(other) }
|
||||
@@ -1,15 +0,0 @@
|
||||
package exh.util
|
||||
|
||||
fun Collection<String>.trimAll() = map { it.trim() }
|
||||
fun Collection<String>.dropBlank() = filter { it.isNotBlank() }
|
||||
fun Collection<String>.dropEmpty() = filter { it.isNotEmpty() }
|
||||
|
||||
private val articleRegex by lazy { "^(an|a|the) ".toRegex(RegexOption.IGNORE_CASE) }
|
||||
|
||||
fun String.removeArticles(): String {
|
||||
return replace(articleRegex, "")
|
||||
}
|
||||
|
||||
fun String.trimOrNull() = trim().nullIfBlank()
|
||||
|
||||
fun String.nullIfBlank(): String? = ifBlank { null }
|
||||
Reference in New Issue
Block a user