fix(adapty-ui): render product text on first composition before produ…#45
Open
Taha-Firoz wants to merge 2 commits into
Open
fix(adapty-ui): render product text on first composition before produ…#45Taha-Firoz wants to merge 2 commits into
Taha-Firoz wants to merge 2 commits into
Conversation
…cts load TextResolver.resolve returned StringWrapper.EMPTY whenever products[desiredProductId] was null, which blanked the Purchase Button label (and Products text) on the first opening of an Android paywall, even for literal labels with no product-dependent tags. The label only appeared after dismissing and reopening, once the SDK had cached the products. Match the iOS path (AdaptyUITextView's placeholder branch): drop the early return and let the resolver continue with a nullable product. The default-payment-mode lookup returns the configured text immediately, and recomposition fills in tag-resolved values once products arrive.
Contributor
|
Hi @Taha-Firoz, thank you for your contribution! We’ll review it and I’ll get back to you soon. |
Author
|
I'll be adding another commit, the purchase button doesn't involve the payment tray reliably either. |
ViewModelProvider was keyed only by class name, so every AdaptyPaywallView in the same Activity received the same PaywallViewModel. Android fires attach listeners after AbstractComposeView creates and runs its initial composition, so the first frame of a freshly attached AdaptyPaywallView read the shared VM's stale dataState.value (the previous paywall's UserArgs) before setNewData() ran, rendering the prior paywall's tree and corrupting state[group_*] with its productId. The next Buy Now tap then silently no-oped because the lookup hit a product not present in the new paywall's products map. Pass a per-instance UUID as the ViewModelProvider key so each view gets its own VM.
Author
|
When the host opens different paywalls in the same Activity, the second paywall rendered the previous |
Contributor
|
@Taha-Firoz thank you, we're taking a look. |
This file contains hidden or 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
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.
TextResolver.resolvereturnedStringWrapper.EMPTYwheneverproducts[desiredProductId]wasnull, which blanked the Purchase Button label (and Products text) on the first launch of an Android paywall, even for literal labels with no product-dependent tags. The label only appeared after dismissing and reopening, once the SDK had cached the products.Match the iOS path (AdaptyUITextView's placeholder branch): drop the early return and let the resolver continue with a nullable product. The default-payment-mode lookup returns the configured text immediately, and recomposition fills in tag-resolved values once products arrive.