Merge pull request #4742 from vector-im/feature/aris/fix_immutable_model_crash

Fix crash ImmutableModelException
This commit is contained in:
ganfra 2021-12-17 15:30:19 +01:00 committed by GitHub
commit 461beda634
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

1
changelog.d/4742.bugfix Normal file
View file

@ -0,0 +1 @@
Fix app crash uppon long press on a reply event

View file

@ -16,6 +16,7 @@
package im.vector.app.features.home.room.detail.timeline.tools
import android.text.SpannableStringBuilder
import android.text.style.ClickableSpan
import android.view.MotionEvent
import android.widget.TextView
@ -44,7 +45,8 @@ fun CharSequence.findPillsAndProcess(scope: CoroutineScope, processBlock: (PillI
fun CharSequence.linkify(callback: TimelineEventController.UrlClickCallback?): CharSequence {
val text = this.toString()
val spannable = toSpannable()
// SpannableStringBuilder is used to avoid Epoxy throwing ImmutableModelException
val spannable = SpannableStringBuilder(this)
MatrixLinkify.addLinks(spannable, object : MatrixPermalinkSpan.Callback {
override fun onUrlClicked(url: String) {
callback?.onUrlClicked(url, text)