Fix custom icons incorrectly being themed

Fix #964
This commit is contained in:
MM20 2024-07-22 20:50:03 +02:00
parent 5fab16beec
commit a4be78d6b1
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -367,27 +367,15 @@ class IconService(
suspend fun searchCustomIcons(query: String, iconPack: IconPack?): List<CustomIconWithPreview> {
val transformations = this.transformations.first()
val iconPackIcons = iconPackManager.searchIconPackIcon(query, iconPack).flatMap {
val unthemedIcon = if (it.themed) {
iconPackManager.getIcon(it.iconPack, it, false)
val themedIcon = if (it.themed) {
iconPackManager.getIcon(it.iconPack, it, true)
?.transform(transformations)
} else null
val icon = iconPackManager.getIcon(it.iconPack, it, true)
val unthemedIcon = iconPackManager.getIcon(it.iconPack, it, false)
?.transform(transformations)
buildList {
val ent = it.toDatabaseEntity()
if (icon != null) {
add(CustomIconWithPreview(
customIcon = CustomIconPackIcon(
iconPackPackage = it.iconPack,
type = ent.type,
drawable = ent.drawable,
extras = ent.extras,
allowThemed = true,
),
preview = icon
))
}
if (unthemedIcon != null) {
add(CustomIconWithPreview(
customIcon = CustomIconPackIcon(
@ -400,6 +388,18 @@ class IconService(
preview = unthemedIcon
))
}
if (themedIcon != null) {
add(CustomIconWithPreview(
customIcon = CustomIconPackIcon(
iconPackPackage = it.iconPack,
type = ent.type,
drawable = ent.drawable,
extras = ent.extras,
allowThemed = true,
),
preview = themedIcon
))
}
}
}