Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Auto-replace plain text with emoji #1009

Merged
merged 14 commits into from
Jul 18, 2024
Merged

Auto-replace plain text with emoji #1009

merged 14 commits into from
Jul 18, 2024

Conversation

langleyd
Copy link
Contributor

@langleyd langleyd commented Jul 5, 2024

What's included this PR?

Custom Suggestion Pattern API and Auto-replace plain text with emoji feature(Web only so far). E.g.:) => 🙂

What does it look like?

Screen.Recording.2024-07-05.at.14.12.28.mov

Implementation detail

I considered 2 approaches for this:

  1. Initially I considered passing all of the text-to-emoji mappings and have all the logic on the rust side to do the replacement when the text changes. The advantage to this is that it maximises code re-use on the rust side.
  2. Then I considered extending the Suggestions api(that slash commands and mentions are built upon) to support "custom" suggestion patterns(in addition to the existing static ones /,@, #). The advantage of this is that it builds upon an existing pattern rather than creating a new way of doing things. It also gives flexibility to the client as to how the feature works. The version implemented works as the web-client does, by automatically replacing the suggestions, but there has been a suggestion previously that it should work as it does on Telegram where suggestions are rendered first from which the user can choose to accept:

image

@codecov-commenter
Copy link

codecov-commenter commented Jul 5, 2024

Codecov Report

Attention: Patch coverage is 76.75676% with 43 lines in your changes missing coverage. Please review.

Project coverage is 90.14%. Comparing base (4c50704) to head (0bb2c9e).

Files Patch % Lines
bindings/wysiwyg-wasm/src/lib.rs 0.00% 40 Missing ⚠️
bindings/wysiwyg-ffi/src/ffi_composer_model.rs 81.81% 2 Missing ⚠️
bindings/wysiwyg-ffi/src/ffi_pattern_key.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1009      +/-   ##
==========================================
- Coverage   90.19%   90.14%   -0.05%     
==========================================
  Files         179      179              
  Lines       21468    21627     +159     
  Branches      280      292      +12     
==========================================
+ Hits        19363    19496     +133     
- Misses       2102     2128      +26     
  Partials        3        3              
Flag Coverage Δ
uitests 84.61% <50.00%> (ø)
uitests-ios 84.61% <50.00%> (ø)
unittests 89.23% <76.75%> (-0.05%) ⬇️
unittests-ios 87.57% <100.00%> (ø)
unittests-react 89.35% <100.00%> (+0.70%) ⬆️
unittests-rust 89.50% <62.28%> (-0.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@langleyd langleyd added the Web label Jul 5, 2024
@langleyd langleyd marked this pull request as ready for review July 5, 2024 13:40
Copy link
Contributor

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

The Rust part LGTM, good job!

Copy link

sonarcloud bot commented Jul 18, 2024

@langleyd langleyd merged commit 1c6e60f into main Jul 18, 2024
7 checks passed
@langleyd langleyd deleted the langleyd/auto_replace_emoji branch July 18, 2024 11:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants