Remove unused defensive code

This commit is contained in:
tarsin committed 2023-07-02 12:42:02 +08:00
1 parent a64c7d9f22
commit a2d9113be2
2 files changed
+5 -5

No files matched your search

@@ -22,7 +22,7 @@ import com.hippo.ehviewer.ui.tools.includeFontPadding
@Composable
fun GalleryTags(
tags: Array<GalleryTagGroup>,
tagGroups: Array<GalleryTagGroup>,
onTagClick: (String) -> Unit,
onTagLongClick: (String, String) -> Unit,
modifier: Modifier = Modifier,
@@ -30,10 +30,10 @@ fun GalleryTags(
val context = LocalContext.current
val canTranslate = Settings.showTagTranslations && EhTagDatabase.isTranslatable(context) && EhTagDatabase.initialized
val ehTags = EhTagDatabase.takeIf { canTranslate }
fun String.translate() = ehTags?.takeIf { it.initialized }?.getTranslation(tag = this) ?: this
fun String.translate(prefix: String?) = ehTags?.takeIf { it.initialized }?.getTranslation(prefix = prefix, tag = this) ?: this
fun String.translate() = ehTags?.getTranslation(tag = this) ?: this
fun String.translate(prefix: String?) = ehTags?.getTranslation(prefix = prefix, tag = this) ?: this
Column(modifier) {
tags.forEach { tagGroup ->
tagGroups.forEach { tagGroup ->
Row {
BaseRoundText(
text = tagGroup.groupName.translate(),
@@ -737,7 +737,7 @@ class GalleryDetailScene : BaseScene(), DownloadInfoListener {
}
} else {
GalleryTags(
tags = tags,
tagGroups = tags,
onTagClick = {
val lub = ListUrlBuilder()
lub.mode = ListUrlBuilder.MODE_TAG