-
Notifications
You must be signed in to change notification settings - Fork 226
Limit the text length in the 'in reply to' preview #4491
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
Limit the text length in the 'in reply to' preview #4491
Conversation
Otherwise, very long texts with no line breaks can cause a Compose crash
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
// Add a limit to the text length to avoid a crash in Compose | ||
is InReplyToMetadata.Text -> metadata.text.ellipsize(512) | ||
// Add a limit to the text length to avoid a crash in Compose | ||
is InReplyToMetadata.Thumbnail -> metadata.text.ellipsize(512) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember that we already have a similar fix (limiting the size of text to avoid a Compose crash), but I can find it. Maybe I dreamt it?
Else maybe create a const for this 512
(not a big deal)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same issue, I know it's there, I just don't know where 😅 .
EDIT: found it
Line 40 in 97f3be3
private const val MAX_SAFE_LENGTH = 500 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried unifying both in an extension function in a new commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tried unifying both in an extension function in a new commit.
That's also why I wanted to find where it was done before. Thanks for the update!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4491 +/- ##
========================================
Coverage 80.08% 80.08%
========================================
Files 2077 2077
Lines 55588 55588
Branches 6802 6802
========================================
Hits 44519 44519
Misses 8733 8733
Partials 2336 2336 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Content
What the title says.
Motivation and context
Otherwise, very long texts with no line breaks can cause a Compose crash.
Fixes #3772
Screenshots / GIFs
There shouldn't be any visual change, unless you have a huge screen that can display in reply to previews of > 512 chars.
Tests
If the app doesn't crash, we worked around the Compose bug.
Tested devices
Checklist