Skip to content

Customer pw info#397

Merged
ianrumac merged 6 commits intodevelopfrom
ir/feat/customer-pw-info
Apr 21, 2026
Merged

Customer pw info#397
ianrumac merged 6 commits intodevelopfrom
ir/feat/customer-pw-info

Conversation

@ianrumac
Copy link
Copy Markdown
Collaborator

@ianrumac ianrumac commented Apr 20, 2026

Changes in this pull request

Checklist

  • All unit tests pass.
  • All UI tests pass.
  • Demo project builds and runs.
  • I added/updated tests or detailed why my change isn't tested.
  • I added an entry to the CHANGELOG.md for any breaking changes, enhancements, or bug fixes.
  • I have run ktlint in the main directory and fixed any issues.
  • I have updated the SDK documentation as well as the online docs.
  • I have reviewed the contributing guide

Greptile Summary

This PR threads CustomerInfo through the paywall product-loading and presentation pipelines. PaywallRequestManager takes a point-in-time snapshot via currentCustomerInfo() to determine Stripe/Paddle free-trial eligibility (blocking trials when subscriptions contains any prior same-store entry), while PaywallView subscribes to a customerInfoFlow() StateFlow for live updates that propagate into PaywallInfo.eventParams() as customer_* analytics params. The implementation is clean, tests cover cross-store non-blocking and per-store blocking cases, and lifecycle cleanup of the new customerInfoListener is correctly paired with the existing stopStateListener().

Confidence Score: 5/5

Safe to merge — all changes are additive and well-tested with no breaking surface.

No P0 or P1 issues found. The dual-path design (snapshot for product loading, live flow for view updates) is intentional and correctly implemented. Tests cover the key eligibility branches, and the new factory methods are properly mocked in both unit and instrumented tests.

No files require special attention.

Important Files Changed

Filename Overview
superwall/src/main/java/com/superwall/sdk/paywall/request/PaywallLogic.kt Added customerInfo parameter to getVariablesAndFreeTrial; Stripe/Paddle trials blocked by hasEverSubscribedOn (any historic subscription), Play/AppStore remain unaffected
superwall/src/main/java/com/superwall/sdk/paywall/presentation/PaywallInfo.kt customerInfo field added to PaywallInfo; eventParams() conditionally emits customer_* analytics params when info is not a placeholder
superwall/src/main/java/com/superwall/sdk/paywall/view/PaywallViewState.kt customerInfo added to state; info computed property injects live customerInfo via .copy(); SetCustomerInfo update class introduced
superwall/src/main/java/com/superwall/sdk/dependencies/FactoryProtocols.kt New CustomerInfoFactory fun interface exposing customerInfoFlow(): StateFlow for live updates in PaywallView
superwall/src/test/java/com/superwall/sdk/paywall/request/PaywallLogicTest.kt New tests cover Stripe/Paddle trial-blocking by prior same-store subscription, cross-store non-blocking, zero-trial-days, and Play Store unaffected cases

Sequence Diagram

sequenceDiagram
    participant PRM as PaywallRequestManager
    participant PL as PaywallLogic
    participant CI as CustomerInfo
    participant PV as PaywallView
    participant CIF as CustomerInfoFactory (StateFlow)

    PRM->>PRM: getProducts(paywall, request)
    PRM->>CI: factory.currentCustomerInfo()
    CI-->>PRM: CustomerInfo (snapshot)
    PRM->>PL: getVariablesAndFreeTrial(..., customerInfo)
    note over PL: Stripe/Paddle: check hasEverSubscribedOn(store)<br/>Play/AppStore: use storeProduct.hasFreeTrial
    PL-->>PRM: ProductProcessingOutcome (isFreeTrialAvailable)
    PRM->>PRM: paywall.isFreeTrialAvailable = outcome.isFreeTrialAvailable

    PV->>CIF: factory.customerInfoFlow().collect { ... }
    CIF-->>PV: CustomerInfo updates (live)
    PV->>PV: controller.updateState(SetCustomerInfo(it))
    note over PV: PaywallViewState.info computed property<br/>returns paywall.getInfo().copy(customerInfo = customerInfo)
    PV->>PV: PaywallInfo.eventParams() includes customer_* params
Loading

Reviews (1): Last reviewed commit: "Add free trial check based on previous s..." | Re-trigger Greptile

@ianrumac ianrumac changed the title Ir/feat/customer pw info Customer pw info Apr 20, 2026
@ianrumac ianrumac merged commit c8cc19b into develop Apr 21, 2026
4 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant