From 37db28ae7cc6c2430671bc1fb022af3d1c134fba Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Fri, 17 Dec 2021 09:25:16 +0000 Subject: [PATCH] using the safe emoji processor to avoid the timeline failing when processing the content and the emoji library hasn't initialised yet --- .../main/java/im/vector/app/features/html/SpanUtils.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/html/SpanUtils.kt b/vector/src/main/java/im/vector/app/features/html/SpanUtils.kt index 27c966e33e..5e9e4263b5 100644 --- a/vector/src/main/java/im/vector/app/features/html/SpanUtils.kt +++ b/vector/src/main/java/im/vector/app/features/html/SpanUtils.kt @@ -21,13 +21,15 @@ import android.text.Spanned import android.text.style.MetricAffectingSpan import android.text.style.StrikethroughSpan import android.text.style.UnderlineSpan -import androidx.emoji2.text.EmojiCompat +import im.vector.app.EmojiCompatWrapper import im.vector.app.features.home.room.detail.timeline.item.BindingOptions import javax.inject.Inject -class SpanUtils @Inject constructor() { +class SpanUtils @Inject constructor( + private val emojiCompat: EmojiCompatWrapper +) { fun getBindingOptions(charSequence: CharSequence): BindingOptions { - val emojiCharSequence = EmojiCompat.get().process(charSequence) + val emojiCharSequence = emojiCompat.safeEmojiSpanify(charSequence) if (emojiCharSequence !is Spanned) { return BindingOptions()