diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/BindingOptions.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/BindingOptions.kt index 317b8423a8..e50f141af1 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/BindingOptions.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/BindingOptions.kt @@ -17,6 +17,8 @@ package im.vector.app.features.home.room.detail.timeline.item data class BindingOptions( - val canUseTextFuture: Boolean, - val preventMutation: Boolean + // Allowed by default + val canUseTextFuture: Boolean = true, + // No need to prevent mutation by default + val preventMutation: Boolean = false ) 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 175e595b37..27c966e33e 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 @@ -30,15 +30,12 @@ class SpanUtils @Inject constructor() { val emojiCharSequence = EmojiCompat.get().process(charSequence) if (emojiCharSequence !is Spanned) { - return BindingOptions( - canUseTextFuture = true, - preventMutation = false - ) + return BindingOptions() } return BindingOptions( canUseTextFuture = canUseTextFuture(emojiCharSequence), - preventMutation = preventMutation(emojiCharSequence) + preventMutation = mustPreventMutation(emojiCharSequence) ) } @@ -55,7 +52,7 @@ class SpanUtils @Inject constructor() { } // Workaround for setting text during binding which mutate the text itself - private fun preventMutation(spanned: Spanned): Boolean { + private fun mustPreventMutation(spanned: Spanned): Boolean { return spanned .getSpans(0, spanned.length, Any::class.java) .any { it is MetricAffectingSpan }