mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
using the safe emoji processor to avoid the timeline failing when processing the content and the emoji library hasn't initialised yet
This commit is contained in:
parent
ca58a04f57
commit
37db28ae7c
1 changed files with 5 additions and 3 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue