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

Fix linkification not working for Spanned strings in text messages #3233

Merged
merged 2 commits into from
Jul 22, 2024

Conversation

jmartinesp
Copy link
Member

Content

Make CharSequence.withFixedURLSpans() handle any type of CharSequence, not only Spannable. If the text wasn't Spannable, a new one will be created from it.

Motivation and context

Previously, the RTE would always return a SpannableString as a result, and as the code checked for this is Spannable it worked fine.

Now a SpannedString is returned instead (the result of a buildSpannedString { ... } block), so the code was skipped.

This issue was found as a regression after upgrading the RTE version to 2.37.7 in #3218.

Tests

  • Open a room where a plain link was sent inside a message with formatted_body.
  • The link should be auto linkified again.

Tested devices

  • Physical
  • Emulator
  • OS version(s): 14

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

…ble`.

This issue was found as a regression after upgrading the RTE version to `2.37.7`.
@jmartinesp jmartinesp added the PR-Bugfix For bug fix label Jul 22, 2024
@jmartinesp jmartinesp requested a review from a team as a code owner July 22, 2024 07:07
@jmartinesp jmartinesp requested review from ganfra and removed request for a team July 22, 2024 07:07
Copy link
Contributor

github-actions bot commented Jul 22, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/4iGEra

Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

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

Should we add some more tests ?

@jmartinesp
Copy link
Member Author

Should we add some more tests ?

Yep, on it.

@jmartinesp jmartinesp added the Run-Maestro Starts a Maestro Cloud session to run integration tests label Jul 22, 2024
@jmartinesp jmartinesp enabled auto-merge (squash) July 22, 2024 08:35
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Jul 22, 2024
Copy link

sonarcloud bot commented Jul 22, 2024

Copy link

codecov bot commented Jul 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.13%. Comparing base (3a9830f) to head (a1336e0).
Report is 3 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3233   +/-   ##
========================================
  Coverage    76.13%   76.13%           
========================================
  Files         1645     1645           
  Lines        38839    38839           
  Branches      7530     7529    -1     
========================================
+ Hits         29570    29571    +1     
  Misses        5361     5361           
+ Partials      3908     3907    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jmartinesp jmartinesp merged commit a888b4d into develop Jul 22, 2024
30 checks passed
@jmartinesp jmartinesp deleted the fix/jme/linkification-with-spanned-string branch July 22, 2024 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Bugfix For bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants