Update emoji search to handle aliases with underscores

This commit is contained in:
Aleksandras Kostarevas 2024-07-22 01:32:11 +03:00
parent 6144d3ca47
commit 02388e7388

View File

@ -663,8 +663,11 @@ fun EmojiGrid(
var emojiList = listOf(CategoryItem("Recent")) + recentEmojis.map { EmojiItemItem(it) } + categorizedEmojis
if(isSearching) {
emojiList = emojiList.filterIsInstance<EmojiItemItem>().searchMultiple(searchFilter) {
listOf(it.emoji.description) + it.emoji.aliases + it.emoji.tags
emojiList = emojiList.filterIsInstance<EmojiItemItem>().searchMultiple(searchFilter) { item ->
listOf(item.emoji.description) +
item.emoji.aliases.map { it.replace("_", " ") } +
item.emoji.tags +
item.emoji.aliases.filter { it.contains("_") }.flatMap { it.split("_") }
}.take(30)
if(emojiList.isEmpty()) {