Improve tag emoji assignment

This commit is contained in:
MM20
2024-11-11 20:48:04 +01:00
parent 76ee00f404
commit a21dde5741
20 changed files with 569 additions and 69 deletions
@@ -119,6 +119,12 @@ sealed class CustomIcon : CustomAttribute {
}
"force_themed_icon" -> ForceThemedIcon
"default_placeholder_icon" -> DefaultPlaceholderIcon
"custom_text_icon" -> {
CustomTextIcon(
text = payload.getString("text"),
color = payload.getInt("color")
)
}
else -> null
}
}
@@ -233,4 +239,17 @@ data object DefaultPlaceholderIcon: CustomIcon() {
"type" to "default_placeholder_icon"
).toString()
}
}
data class CustomTextIcon(
val text: String,
val color: Int = 0,
): CustomIcon() {
override fun toDatabaseValue(): String {
return jsonObjectOf(
"type" to "custom_text_icon",
"text" to text,
"color" to color,
).toString()
}
}