[PW-128] Redact text in V2 paywalls while eligibility checks are pending#6775
Conversation
c3545b1 to
d282111
Compare
📸 Snapshot Test5 added, 269 unchanged
🛸 Powered by Emerge Tools |
MonikaMateska
left a comment
There was a problem hiding this comment.
The PR looks great, thanks for implementing it! 🙏
One thing worth exploring in the future: we could eagerly prefetch intro/promo offer eligibility right after offerings and products are resolved. That said, I'd still ship the current text reduction as-is while we figure that out.
On the configuration side, not urgent, just something to keep in mind, we could add a simple introEligibilityLoadingBehavior flag to PaywallViewConfiguration with two cases: .waitForResult (current default, shows a spinner) and .optimistic
(shows full-price text immediately, upgrades to the intro offer text once eligibility resolves)
JZDesign
left a comment
There was a problem hiding this comment.
Great work!
Considering the engine team's goal of keeping a sound testing framework that will aid in preventing UI regressions, the impact this has to the emerge snapshot test suite isn't ideal.
Please update the changed emerge snapshots to set isPaywallLoading to false, so that we can still use emerge the way we currently do. Spitballing here… one way is to add a constructor that is only available in debug builds, explicitly marked for use in previews, that we can provide a shouldShowLoadingState function, then in the normal initializer, we set the value ourselves then pass that in.
Another way would be to use the functions we have to tell if the sdk is being run for previews and to act on that (though this has less flexibility)
|
@JZDesign I've reverted the preview changes and added new ones for reference. |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
In Xcode Previews and Emerge runs the async eligibility check never
completes, leaving didFinishEligibilityCheck=false forever and causing
all text to render as redacted. Default didFinishEligibilityCheck to
true (finished) in those environments via ProcessInfo.isRunningForPreviews,
which covers both XCODE_RUNNING_FOR_PREVIEWS and EMERGE_IS_RUNNING_FOR_SNAPSHOTS.
Adds two new TextComponentView preview entries ("Default (Loading)" and
"Detected Platform (Loading)") that explicitly inject isPaywallLoading=true
so Emerge captures dedicated loading-state snapshots alongside the
existing loaded-state ones.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a DEBUG-only `paywallLoadingOverride` environment key that lets preview callers force `isPaywallLoading` on `PaywallsV2View` from outside, bypassing the internal `didFinishEligibilityCheck` state. Duplicates three representative preview entries (Template1, ButtonWithFooter, PackageVisibility) with `.environment(\.paywallLoadingOverride, true)` so emerge captures a redacted loading-state snapshot alongside each existing loaded-state snapshot. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ba8d6bd to
f3f702c
Compare
Summary
isPaywallLoadingSwiftUI environment key (PaywallLoadingKey.swift)PaywallsV2Viewsets it totrueuntil bothintroOfferEligibilityContextandpaywallPromoOfferCachefinish their async eligibility checksTextComponentViewreads the key and applies.redacted(reason: .placeholder)toNonLocalizedMarkdownText, hiding text content while preserving layout, images, and buttonstrue) and loaded (false) states🤖 Generated with Claude Code
Note
Low Risk
UI-only placeholder redaction on text during async eligibility; no purchase, auth, or backend changes.
Overview
Adds a Paywalls V2 loading state driven by a new SwiftUI environment value
isPaywallLoading, set fromPaywallsV2Viewwhile intro-offer and promo-offer eligibility work is still in flight.TextComponentViewapplies.redacted(reason: .placeholder)when that flag is true so copy does not flash wrong prices or intro messaging before eligibility resolves; layout and non-text UI are unchanged.DEBUG adds
paywallLoadingOverridefor previews/tests, treats preview runs as already loaded so snapshots are not stuck redacted, and adds snapshot coverage plus “(Loading)” paywall previews.Reviewed by Cursor Bugbot for commit f3f702c. Bugbot is set up for automated code reviews on this repo. Configure here.