Emoji completion 🎉 does not completes to 🎉 like on web (#1285)
This commit is contained in:
parent
9c8ff7de7f
commit
a4192a0761
@ -44,6 +44,7 @@ Bugfix 🐛:
|
||||
- Fix issue with media path (#1227)
|
||||
- Add user to direct chat by user id (#1065)
|
||||
- Use correct URL for SSO connection (#1178)
|
||||
- Emoji completion :tada: does not completes to 🎉 like on web (#1285)
|
||||
|
||||
Translations 🗣:
|
||||
-
|
||||
|
@ -77,7 +77,17 @@ class EmojiDataSourceTest : InstrumentedTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testQuickReaction() {
|
||||
fun testTada() {
|
||||
val emojiDataSource = EmojiDataSource(context().resources)
|
||||
|
||||
val result = emojiDataSource.filterWith("tada")
|
||||
|
||||
assertEquals("Should find tada emoji", 1, result.size)
|
||||
assertEquals("Should find tada emoji", "🎉", result[0].emoji)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testQuickReactions() {
|
||||
val emojiDataSource = EmojiDataSource(context().resources)
|
||||
|
||||
assertEquals("Should have 8 quick reactions", 8, emojiDataSource.getQuickReactions().size)
|
||||
|
@ -32,6 +32,23 @@ class EmojiDataSource @Inject constructor(
|
||||
.adapter(EmojiData::class.java)
|
||||
.fromJson(input.bufferedReader().use { it.readText() })
|
||||
}
|
||||
?.let { parsedRawData ->
|
||||
// Add key as a keyword, it will solve the issue that ":tada" is not available in completion
|
||||
parsedRawData.copy(
|
||||
emojis = mutableMapOf<String, EmojiItem>().apply {
|
||||
parsedRawData.emojis.keys.forEach { key ->
|
||||
val origin = parsedRawData.emojis[key] ?: return@forEach
|
||||
|
||||
// Do not add keys containing '_'
|
||||
if (origin.keywords.contains(key) || key.contains("_")) {
|
||||
put(key, origin)
|
||||
} else {
|
||||
put(key, origin.copy(keywords = origin.keywords + key))
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
?: EmojiData(emptyList(), emptyMap(), emptyMap())
|
||||
|
||||
private val quickReactions = mutableListOf<EmojiItem>()
|
||||
|
Loading…
Reference in New Issue
Block a user