-
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] Selects the correct package by default #2043
Draft
JayShortway
wants to merge
49
commits into
main
Choose a base branch
from
pw2-default-selected-package
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
…actions # Conflicts: # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/PaywallActionTests.kt
# Conflicts: # purchases/src/main/kotlin/com/revenuecat/purchases/paywalls/components/properties/ColorInfo.kt
…actions # Conflicts: # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/style/StyleFactory.kt
# Conflicts: # ui/revenuecatui/src/test/kotlin/com/revenuecat/purchases/ui/revenuecatui/components/PaywallActionTests.kt
# Conflicts: # ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/InternalPaywall.kt
…hould display its selected state.
…use the selected overrides.
JayShortway
commented
Jan 9, 2025
Comment on lines
+127
to
+131
// Find the first PackageComponentStyle which has isSelectedByDefault equal to true. | ||
val predicate: (ComponentStyle) -> Boolean = { it is PackageComponentStyle && it.isSelectedByDefault } | ||
val initialSelectedPackage = (stack.firstOrNull(predicate) ?: stickyFooter?.firstOrNull(predicate)) | ||
?.let { it as PackageComponentStyle? } | ||
?.rcPackage |
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.
Two reasons why this is not great:
- It traverses the tree again, while
StyleFactory
already did. Best to do it in 1 pass. - It is not compatible with multi-tier.
JayShortway
commented
Jan 9, 2025
* allows us to assert this behavior from a higher level. | ||
*/ | ||
@Test | ||
fun `Should select the correct package by default`(): Unit = with(composeTestRule) { |
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 is what this PR fixes.
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.
Description
The backend sends the
isSelectedByDefault
property along with anypackage
components. Thus far this was ignored. This PR fixes that.Note
This is a draft, because it is not compatible with multi-tier, and there's some ongoing discussion on possibly changing the network response. Best to wait for that to flesh out.