Replace elvis operators with .orEmpty where possible
This commit is contained in:
@@ -10,7 +10,7 @@ import uy.kohesive.injekt.api.get
|
||||
|
||||
fun Manga.isLewd(): Boolean {
|
||||
val sourceName = Injekt.get<SourceManager>().get(source)?.name
|
||||
val currentTags = getGenres() ?: emptyList()
|
||||
val currentTags = getGenres().orEmpty()
|
||||
|
||||
if (source == EH_SOURCE_ID || source == EXH_SOURCE_ID || source in nHentaiSourceIds) {
|
||||
return currentTags.none { tag -> isNonHentaiTag(tag) }
|
||||
|
||||
@@ -51,7 +51,7 @@ class LoggingRealmQuery<E : RealmModel>(val query: RealmQuery<E>) {
|
||||
"\"$fieldName\" == \"$value\"" + (
|
||||
casing?.let {
|
||||
" CASE ${casing.name}"
|
||||
} ?: ""
|
||||
}.orEmpty()
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -121,7 +121,7 @@ class LoggingRealmQuery<E : RealmModel>(val query: RealmQuery<E>) {
|
||||
)}] IN \"$fieldName\"" + (
|
||||
casing?.let {
|
||||
" CASE ${casing.name}"
|
||||
} ?: ""
|
||||
}.orEmpty()
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -181,7 +181,7 @@ class LoggingRealmQuery<E : RealmModel>(val query: RealmQuery<E>) {
|
||||
"\"$fieldName\" != \"$value\"" + (
|
||||
casing?.let {
|
||||
" CASE ${casing.name}"
|
||||
} ?: ""
|
||||
}.orEmpty()
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -391,7 +391,7 @@ class LoggingRealmQuery<E : RealmModel>(val query: RealmQuery<E>) {
|
||||
"\"$fieldName\" CONTAINS \"$value\"" + (
|
||||
casing?.let {
|
||||
" CASE ${casing.name}"
|
||||
} ?: ""
|
||||
}.orEmpty()
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -411,7 +411,7 @@ class LoggingRealmQuery<E : RealmModel>(val query: RealmQuery<E>) {
|
||||
"\"$fieldName\" BEGINS WITH \"$value\"" + (
|
||||
casing?.let {
|
||||
" CASE ${casing.name}"
|
||||
} ?: ""
|
||||
}.orEmpty()
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -431,7 +431,7 @@ class LoggingRealmQuery<E : RealmModel>(val query: RealmQuery<E>) {
|
||||
"\"$fieldName\" ENDS WITH \"$value\"" + (
|
||||
casing?.let {
|
||||
" CASE ${casing.name}"
|
||||
} ?: ""
|
||||
}.orEmpty()
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -451,7 +451,7 @@ class LoggingRealmQuery<E : RealmModel>(val query: RealmQuery<E>) {
|
||||
"\"$fieldName\" LIKE \"$value\"" + (
|
||||
casing?.let {
|
||||
" CASE ${casing.name}"
|
||||
} ?: ""
|
||||
}.orEmpty()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ fun Manga.mangaType(context: Context): String {
|
||||
*/
|
||||
fun Manga.mangaType(): MangaType {
|
||||
val sourceName = Injekt.get<SourceManager>().getOrStub(source).name
|
||||
val currentTags = getGenres() ?: emptyList()
|
||||
val currentTags = getGenres().orEmpty()
|
||||
return if (currentTags.any { tag -> isMangaTag(tag) }) {
|
||||
MangaType.TYPE_MANGA
|
||||
} else if (currentTags.any { tag -> isWebtoonTag(tag) } || isWebtoonSource(sourceName)) {
|
||||
|
||||
Reference in New Issue
Block a user