Skip to content

Fix application of modifiers in Markdown component#1893

Merged
tonidero merged 6 commits into
mainfrom
fix-incorrect-paddings-markdown
Oct 30, 2024
Merged

Fix application of modifiers in Markdown component#1893
tonidero merged 6 commits into
mainfrom
fix-incorrect-paddings-markdown

Conversation

@tonidero

Copy link
Copy Markdown
Contributor

Description

We were passing the modifier for the Markdown composable down to the whole composable tree inside that Markdown. We are currently passing some margins to the markdown composable which were basically applied to all individual components of the markdown, so if processing the markdown generated several components, all of them were applied the paddings for example.

I believe this was not expected so I decided to just not propagate the modifiers inside the Markdown composable and just keep it at the root.

Before After
image image

@tonidero tonidero marked this pull request as ready for review October 29, 2024 09:47
@tonidero tonidero requested review from a team October 29, 2024 09:47

@JayShortway JayShortway left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is great, thanks for fixing this! I think this actually fixes a bunch of violations in our detekt-baseline.xml. Could you regenerate that?

@tonidero

Copy link
Copy Markdown
Contributor Author

This is great, thanks for fixing this! I think this actually fixes a bunch of violations in our detekt-baseline.xml. Could you regenerate that?

Hmm seems the changes to the baseline weren't related (just pushed them in any case)... Probably could try to fix some others, but seems like something unrelated for this PR... But yeah, we should probably try to fix those when we can

@tonidero tonidero changed the title Fix application of modifiers in markdown components Fix application of modifiers in Markdown component Oct 29, 2024
@emerge-tools

emerge-tools Bot commented Oct 29, 2024

Copy link
Copy Markdown

📸 Snapshot Test

43 modified, 31 unchanged

Name Version Added Removed Modified Unchanged Errored Approval
TestPurchasesUIAndroidCompatibility
com.revenuecat.testpurchasesuiandroidcompatibility
1.0 (1) 0 0 43 31 0 ✅ Approved

🛸 Powered by Emerge Tools

@tonidero

Copy link
Copy Markdown
Contributor Author

This has changed the snapshots a bit as can be seen in Emerge ^... Mostly some margins have moved... I feel these are ok but would like someone to double-check @JayShortway @vegaro

@JayShortway

Copy link
Copy Markdown
Member

@tonidero

Regarding the baseline: that's interesting. Seems like this specific one wasn't caught by Detekt.
There are indeed some similar violations, if you search for ModifierReused:Markdown.kt and ModifierNotUsedAtRoot:Markdown.kt in detekt-baseline.xml. Not a blocker for me, feel free to decide if you want to fix those in this PR or not.

Regarding the Emerge screenshots: my only concern is the PurchaseButton. It seems to be a bit less tall now, making it a smaller touch target. Could decrease conversion + accessibility.
(The PurchaseButton also seems to be the main cause of the changes in e.g. Template4.)

@tonidero

Copy link
Copy Markdown
Contributor Author

my only concern is the PurchaseButton.

Hmm good call... Going to see if I can minimize the change there. Great catch!

allowLinks = false,
modifier = Modifier
.padding(vertical = UIConstant.defaultVerticalSpacing / 3)
.padding(vertical = UIConstant.defaultVerticalSpacing * 2 / 3)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This doesn't exactly match back up to the original size but it's pretty close. I think it's difficult to match it exactly since the components within markdown before perform some custom painting that was altering the sizes slightly... Lmk what you think!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We could also use a minimum height instead of relying on the font size + padding, but not a blocker for me.

@tonidero tonidero requested a review from JayShortway October 29, 2024 15:31

@JayShortway JayShortway left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Very nice improvement! Check out this one, the new one is much better haha. Thanks for fixing!

@codecov

codecov Bot commented Oct 30, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.25%. Comparing base (dad3113) to head (535c83d).
Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1893   +/-   ##
=======================================
  Coverage   82.25%   82.25%           
=======================================
  Files         227      227           
  Lines        7968     7968           
  Branches     1121     1121           
=======================================
  Hits         6554     6554           
  Misses        967      967           
  Partials      447      447           

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

@tonidero tonidero merged commit 0b459c3 into main Oct 30, 2024
@tonidero tonidero deleted the fix-incorrect-paddings-markdown branch October 30, 2024 12:09
tonidero pushed a commit that referenced this pull request Nov 4, 2024
**This is an automatic release.**

## RevenueCat SDK
### ✨ New Features
* [Experimental] Web purchase redemption (#1889) via Toni Rico
(@tonidero)
### 🐞 Bugfixes
* Keeps the org.json package. (#1891) via JayShortway (@JayShortway)
### 📦 Dependency Updates
* Bump rexml from 3.3.8 to 3.3.9 (#1892) via dependabot[bot]
(@dependabot[bot])
* Bump danger from 9.5.0 to 9.5.1 (#1885) via dependabot[bot]
(@dependabot[bot])
* Bump fastlane from 2.224.0 to 2.225.0 (#1884) via dependabot[bot]
(@dependabot[bot])

## RevenueCatUI SDK
### 🐞 Bugfixes
* Fix application of modifiers in `Markdown` component (#1893) via Toni
Rico (@tonidero)

### 🔄 Other Changes
* [CI] Allow publishing snapshot releases manually from branches (#1888)
via Toni Rico (@tonidero)
* Detekt auto-fixes (#1886) via Toni Rico (@tonidero)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants