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

[Paywalls V2] TextComponentStyle no longer needs a Composable context #1986

Merged
merged 45 commits into from
Dec 17, 2024

Conversation

JayShortway
Copy link
Member

Description

The goal of this PR is to make it possible to construct a TextComponentStyle without needing a @Composable context. The main changes in this PR are as follows:

  • TextComponentStyle had a @Composable constructor function. That is removed.
  • rememberProcessedText() is moved from StyleFactory to TextComponentView.

Comment on lines +15 to +21
internal fun SystemFontFamily(familyName: String, weight: FontWeight?): FontFamily =
FontFamily(
Font(
familyName = DeviceFontFamilyName(familyName),
weight = weight ?: FontWeight.Normal,
),
)
Copy link
Member Author

Choose a reason for hiding this comment

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

This used to be in TextComponentStyle.kt.

Comment on lines +53 to +55
// TODO Remove these default values
packageContext: PackageContext = PackageContext(null, PackageContext.VariableContext(emptyList())),
locale: Locale = Locale.current,
Copy link
Member Author

Choose a reason for hiding this comment

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

This will be in a follow-up PR.

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.90%. Comparing base (8c5b2f4) to head (3cc534b).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1986   +/-   ##
=======================================
  Coverage   81.90%   81.90%           
=======================================
  Files         260      260           
  Lines        8505     8505           
  Branches     1227     1227           
=======================================
  Hits         6966     6966           
  Misses       1039     1039           
  Partials      500      500           

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

Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

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

LGTM!

Base automatically changed from pw2-stack-tests to main December 17, 2024 09:07
# Conflicts:
#	ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/button/ButtonComponentView.kt
#	ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/style/StyleFactory.kt
#	ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/stack/StackComponentViewTests.kt
@JayShortway JayShortway enabled auto-merge (squash) December 17, 2024 09:12
@JayShortway JayShortway merged commit ab1b344 into main Dec 17, 2024
9 checks passed
@JayShortway JayShortway deleted the pw2-simplify-textstyle branch December 17, 2024 09:39
tonidero pushed a commit that referenced this pull request Dec 19, 2024
**This is an automatic release.**

## RevenueCat SDK
### 📦 Dependency Updates
* Bump fastlane from 2.225.0 to 2.226.0 (#1973) via dependabot[bot]
(@dependabot[bot])
* Bump fastlane-plugin-revenuecat_internal from `3b1e7cf` to `4ee8579`
(#1980) via dependabot[bot] (@dependabot[bot])

### 🔄 Other Changes
* [Paywalls V2] Fixes previews of `ButtonComponentView`,
`StackComponentView` and `TextComponentView` (#1992) via JayShortway
(@JayShortway)
* [Paywalls V2] Adds a `FLAG_PAYWALL_COMPONENTS` build flag (#1990) via
JayShortway (@JayShortway)
* [Paywalls V2] Moves more state to `PaywallState` (#1988) via
JayShortway (@JayShortway)
* [PaywallsV2] Improve `ButtonComponentView` to handle disabling the
button and add `PurchasePackage` action (#1984) via Toni Rico
(@tonidero)
* [Paywalls V2] `TextComponentStyle` no longer needs a Composable
context (#1986) via JayShortway (@JayShortway)
* Make web redemption link APIs stable (#1985) via Toni Rico (@tonidero)
* [WEB-1757] Handle new backend error codes that may show in the
redemption endpoint (#1987) via Toni Rico (@tonidero)
* [Paywalls V2] Stack background, borders and shadows update depending
on the theme (#1982) via JayShortway (@JayShortway)
* [Paywalls V2] Fixes `TextComponentView`'s font size (#1981) via
JayShortway (@JayShortway)
* [Paywalls V2] Various minor fixes (#1979) via JayShortway
(@JayShortway)
* [Paywalls V2] Adds support to PaywallsTester (#1978) via JayShortway
(@JayShortway)
* [Paywalls V2] Adds `PaywallComponentsData` to `Offering` (#1977) via
JayShortway (@JayShortway)
* Parse web redemption link strings more defensively (#1976) via Toni
Rico (@tonidero)
* Add web redemption parse method for strings to support hybrids (#1972)
via Toni Rico (@tonidero)

Co-authored-by: revenuecat-ops <[email protected]>
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