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

feat(ui): expose a method for checking whether a message contains only emojis and should be boosted (use a bigger font size) #4577

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

stefanceriu
Copy link
Member

  • supports only text room message types
  • enumerates through their body's grapheme clusters and check that every single one of them is an emoji
  • part of the LazyTimelineItemProvider so that it can be opt in

…y emojis and should be boosted (use a bigger font size)
Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 56.25000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 85.40%. Comparing base (4c4dd03) to head (ae29e45).

Files with missing lines Patch % Lines
...rates/matrix-sdk-ui/src/timeline/event_item/mod.rs 56.25% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4577      +/-   ##
==========================================
- Coverage   85.42%   85.40%   -0.02%     
==========================================
  Files         286      286              
  Lines       32213    32229      +16     
==========================================
+ Hits        27517    27525       +8     
- Misses       4696     4704       +8     

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

Copy link
Member

@Hywan Hywan left a comment

Choose a reason for hiding this comment

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

Neat!

@@ -442,6 +443,19 @@ impl EventTimelineItem {
}
}

pub fn should_boost(&self) -> bool {
Copy link
Member

Choose a reason for hiding this comment

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

Please add a documentation with an example :-).

Copy link
Member Author

@stefanceriu stefanceriu Jan 23, 2025

Choose a reason for hiding this comment

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

Documentation sorted but I'm not so sure about the example, creating a timeline item seems too involved.

Copy link
Member

@Hywan Hywan Jan 24, 2025

Choose a reason for hiding this comment

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

Pro tips: You can create declare a function that takes a TimelineItem as a parameter, however the function is “hidden” from the doc:

/// # fn test(timeline_item: TimelineItem) {
/// timeline_item.do_something();
/// # }

rustdoc will be able to run the test by checking the types (not the execution though, because test() won't run), and rustdoc will also be able to render the doc, as:

timeline_item.do_something();

Copy link
Member

@Hywan Hywan Jan 24, 2025

Choose a reason for hiding this comment

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

@stefanceriu stefanceriu force-pushed the stefan/allEmojiTextMessageBoosting branch 2 times, most recently from 85a2b49 to d145fce Compare January 23, 2025 17:20
@stefanceriu stefanceriu force-pushed the stefan/allEmojiTextMessageBoosting branch from d145fce to ae29e45 Compare January 23, 2025 17:28
@stefanceriu stefanceriu marked this pull request as ready for review January 23, 2025 17:38
@stefanceriu stefanceriu requested a review from a team as a code owner January 23, 2025 17:38
@stefanceriu stefanceriu requested review from bnjbvr and removed request for a team January 23, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants