ref(folder): remove trailing (none) when no genre is set

This commit is contained in:
tapframe 2026-05-05 13:09:48 +05:30
parent 17b1b46164
commit 42247c1d57

View file

@ -62,7 +62,7 @@ data class CollectionSource(
addonId = sourceAddonId, addonId = sourceAddonId,
type = sourceType, type = sourceType,
catalogId = sourceCatalogId, catalogId = sourceCatalogId,
genre = genre, genre = genre.normalizedOptionalGenre(),
) )
} }
} }
@ -193,7 +193,7 @@ data class CollectionFolder(
addonId = source.addonId, addonId = source.addonId,
type = source.type, type = source.type,
catalogId = source.catalogId, catalogId = source.catalogId,
genre = source.genre, genre = source.genre.normalizedOptionalGenre(),
) )
} }
} }
@ -217,6 +217,11 @@ data class Collection(
get() = FolderViewMode.fromString(viewMode) get() = FolderViewMode.fromString(viewMode)
} }
private fun String?.normalizedOptionalGenre(): String? =
this
?.trim()
?.takeIf { it.isNotEmpty() && !it.equals("none", ignoreCase = true) }
data class AvailableCatalog( data class AvailableCatalog(
val addonId: String, val addonId: String,
val addonName: String, val addonName: String,