Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emojis in code blocks crash #4795

Closed

Conversation

ouchadam
Copy link
Contributor

Depends on #4790, Fixes #4794 Room crash when viewing/submitting emojis in code blocks (requires markdown to be enabled)

  • Extracts a dedicated model VectorCharSequence to contain the binding options and remove duplication when applying the setText logic
BEFORE AFTER
Screenshot_20211222_123031 Screenshot_20211222_101004


@EpoxyAttribute
var editedSpan: CharSequence? = null

override fun bind(holder: Holder) {
super.bind(holder)
holder.messageView.text = message
holder.messageView.setVectorText(message)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the fix for the crash in the code blocks (applying the same emoji fix we're using for the other message types)

@@ -24,20 +24,22 @@ import im.vector.app.EmojiSpanify
import im.vector.app.features.home.room.detail.timeline.item.BindingOptions
import javax.inject.Inject

class SpanUtils @Inject constructor(
data class VectorCharSequence(val value: CharSequence, val bindingOptions: BindingOptions)
Copy link
Contributor Author

@ouchadam ouchadam Dec 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could potentially override the hashcode/equals here to avoid epoxy throwing when spannables mutate but I chose to leave out the change from this PR to setup the groundwork instead

@github-actions
Copy link

Unit Test Results

  66 files  ±0    66 suites  ±0   1m 4s ⏱️ +14s
135 tests ±0  135 ✔️ ±0  0 💤 ±0  0 ±0 
418 runs  ±0  418 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 987d097. ± Comparison against base commit 627da49.

@ouchadam ouchadam linked an issue Dec 22, 2021 that may be closed by this pull request
@bmarty bmarty mentioned this pull request Jan 3, 2022
@bmarty
Copy link
Member

bmarty commented Jan 4, 2022

Probably have to be updated now that #4837 has been merged

@ouchadam ouchadam force-pushed the feature/adm/emoji-recycling branch from b5ce8dc to 6380ee9 Compare January 5, 2022 10:02
@ouchadam
Copy link
Contributor Author

ouchadam commented Jan 5, 2022

going to close this PR, we're only using text futures in the message item and #4837 fixes the crash

@ouchadam ouchadam closed this Jan 5, 2022
@ouchadam ouchadam deleted the feature/adm/codeblock-emoji-crash branch February 25, 2022 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when codeblocks contain emojis
2 participants