-
Notifications
You must be signed in to change notification settings - Fork 54
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] Adds ImageComponentState
and override functionality
#2012
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/LoadedPaywallComponents.kt # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/LocalizedTextPartial.kt # 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/ktx/Localization.kt # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/stack/StackComponentView.kt # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/style/StyleFactory.kt # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/style/TextComponentStyle.kt # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/text/TextComponentState.kt # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/text/TextComponentView.kt # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/helpers/Result.kt # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/BuildPresentedPartialTests.kt # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/LocalizedTextPartialTests.kt # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/ToPresentedOverridesTests.kt # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/button/ButtonComponentViewTests.kt # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/stack/StackComponentViewTests.kt # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/stack/StackComponentViewWindowTests.kt # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/style/StyleFactoryTests.kt # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/text/TextComponentViewTests.kt # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/text/TextComponentViewWindowTests.kt # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/helpers/FakePaywallState.kt
# Conflicts: # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/LoadedPaywallComponents.kt # 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/stack/StackComponentView.kt # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/text/TextComponentView.kt # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/helpers/NonEmptyMap.kt # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/helpers/ResultTests.kt
JayShortway
commented
Dec 27, 2024
Comment on lines
-69
to
-87
private fun Size.adjustForImage(imageUrls: ImageUrls, density: Density): Size = | ||
Size( | ||
width = imageUrls.width?.let { imageWidthPx -> | ||
when (width) { | ||
is Fit -> Fixed(with(density) { imageWidthPx.toInt().toDp().value.toUInt() }) | ||
is Fill, | ||
is Fixed, | ||
-> width | ||
} | ||
} ?: width, | ||
height = imageUrls.height?.let { imageHeightPx -> | ||
when (height) { | ||
is Fit -> Fixed(with(density) { imageHeightPx.toInt().toDp().value.toUInt() }) | ||
is Fill, | ||
is Fixed, | ||
-> height | ||
} | ||
} ?: height, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was moved to ImageComponentState
.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## pw2-validate-loading-phase #2012 +/- ##
===========================================================
Coverage 81.90% 81.90%
===========================================================
Files 260 260
Lines 8516 8516
Branches 1226 1226
===========================================================
Hits 6975 6975
Misses 1042 1042
Partials 499 499 ☔ View full report in Codecov by Sentry. |
📸 Snapshot Test125 unchanged
🛸 Powered by Emerge Tools |
tonidero
approved these changes
Jan 2, 2025
tonidero
pushed a commit
that referenced
this pull request
Jan 9, 2025
**This is an automatic release.** ## RevenueCat SDK ### 📦 Dependency Updates * Updates the Play Billing Library to 7.1.1. (#2032) via JayShortway (@JayShortway) ### 🔄 Other Changes * [Paywalls V2] Fixes click consumption in text buttons (#2033) via JayShortway (@JayShortway) * [Paywalls V2] Handles gradient percentages in the 0..100 range (#2030) via JayShortway (@JayShortway) * [Paywalls V2] Add `Badge` property to StackComponent (#2003) via Toni Rico (@tonidero) * [Paywalls V2] Improves image previews (#2029) via JayShortway (@JayShortway) * Make `PurchasesError` `java.io.Serializable` (#2031) via Toni Rico (@tonidero) * [Paywalls V2] Fixes `ImageComponentView` size when axes are Fit and Fixed (#2024) via JayShortway (@JayShortway) * [Paywalls V2] Image backgrounds support `fit_mode` and `color_overlay` (#2021) via JayShortway (@JayShortway) * [Paywalls V2] Fixes various rendering issues (#2020) via JayShortway (@JayShortway) * [Paywalls V2] Fixes various deserialization issues (#2018) via JayShortway (@JayShortway) * [Paywalls V2] Simplifies validation of `PaywallComponentsData` (#2017) via JayShortway (@JayShortway) * [Paywalls V2] Moves click handling from `ButtonComponentStyle` to `ButtonComponentView` (#2016) via JayShortway (@JayShortway) * [Paywalls V2] Adds `PackageComponentView` (#2014) via JayShortway (@JayShortway) * [Paywalls V2] Adds `ImageComponentState` and override functionality (#2012) via JayShortway (@JayShortway) 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
ImageComponentState
and,ImageComponentStyle
to theStyleFactory
,PresentedImagePartial
.