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

[Android] Fix missing link action updates in compose library #804

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

jonnyandrew
Copy link
Contributor

Problem

When moving the cursor/selection to a new position, the compose state does not update the available link action.

Solution

Previously the Android compose library only updated the available link action when the editor text changed. However, this misses any updates that result from changing the selection. To solve this:

  • Rust lib: return link action changes along with composer updates
  • Android view lib: Add a listener API to the to allow registering for link action updates
  • Android compose lib: Use the listener API to listen for state changes and update the compose state

@jonnyandrew jonnyandrew force-pushed the jonny/link-action-callback branch 2 times, most recently from d8cf87b to cefc5a6 Compare September 12, 2023 15:02
@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2023

Codecov Report

Patch coverage: 67.18% and project coverage change: -0.03% ⚠️

Comparison is base (c65b914) 88.31% compared to head (b498285) 88.28%.
Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #804      +/-   ##
============================================
- Coverage     88.31%   88.28%   -0.03%     
- Complexity      364      367       +3     
============================================
  Files           154      155       +1     
  Lines         17837    17881      +44     
  Branches        864      862       -2     
============================================
+ Hits          15753    15787      +34     
- Misses         1847     1860      +13     
+ Partials        237      234       -3     
Flag Coverage Δ
uitests 74.47% <77.50%> (+0.26%) ⬆️
uitests-android 69.25% <77.50%> (+0.58%) ⬆️
uitests-ios 80.14% <ø> (ø)
unittests 86.92% <48.97%> (-0.07%) ⬇️
unittests-android 50.48% <48.00%> (+0.13%) ⬆️
unittests-ios 75.52% <ø> (ø)
unittests-rust 89.88% <50.00%> (-0.07%) ⬇️

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

Files Changed Coverage Δ
bindings/wysiwyg-ffi/src/ffi_composer_update.rs 95.76% <0.00%> (-1.24%) ⬇️
bindings/wysiwyg-ffi/src/ffi_link_actions.rs 0.00% <0.00%> (ø)
.../java/io/element/android/wysiwyg/EditorEditText.kt 64.62% <66.66%> (-0.40%) ⬇️
...roid/wysiwyg/internal/view/models/LinkActionExt.kt 66.66% <66.66%> (ø)
...roid/wysiwyg/internal/viewmodel/EditorViewModel.kt 53.73% <80.00%> (+7.63%) ⬆️
crates/wysiwyg/src/composer_model/base.rs 94.87% <100.00%> (+0.08%) ⬆️
crates/wysiwyg/src/composer_model/replace_text.rs 79.14% <100.00%> (+0.11%) ⬆️
crates/wysiwyg/src/composer_update.rs 100.00% <100.00%> (ø)
crates/wysiwyg/src/link_action.rs 100.00% <100.00%> (ø)
.../element/android/wysiwyg/compose/RichTextEditor.kt 64.04% <100.00%> (+1.25%) ⬆️

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

@jonnyandrew jonnyandrew force-pushed the jonny/link-action-callback branch from cefc5a6 to d88b92c Compare September 13, 2023 11:32
@jonnyandrew jonnyandrew requested a review from a team September 13, 2023 12:24
@jonnyandrew jonnyandrew marked this pull request as ready for review September 13, 2023 12:24
@sonarcloud
Copy link

sonarcloud bot commented Sep 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@jonnyandrew jonnyandrew merged commit a75603d into main Sep 14, 2023
7 checks passed
@jonnyandrew jonnyandrew deleted the jonny/link-action-callback branch September 14, 2023 10:31
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.

3 participants