-
Notifications
You must be signed in to change notification settings - Fork 9
Minor fixes #356
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
base: develop
Are you sure you want to change the base?
Minor fixes #356
Conversation
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.
7 files reviewed, 2 comments
Additional Comments (2)
In the Fix: in the internal failure path, also call Prompt To Fix With AIThis is a comment left during a code review.
Path: superwall/src/main/java/com/superwall/sdk/store/transactions/TransactionManager.kt
Line: 600:609
Comment:
**Loading state never resets**
In the `PurchaseResult.Failed` branch for internal purchases, you only reset the UI via `ToggleSpinner(hidden = true)` (line ~357), but this PR also introduced `SetLoadingState(LoadingPurchase)` on purchase start (`Superwall.kt:1281-1283`). If the paywall UI is now driven by `PaywallLoadingState`, a failed purchase will leave the loading state stuck on `LoadingPurchase` (even if the spinner is hidden), which can keep the shimmer/overlay visible and block interaction.
Fix: in the internal failure path, also call `PaywallViewState.Updates.SetLoadingState(PaywallLoadingState.Ready)` (or whatever the non-loading state should be) when the purchase fails. This should be done in both the alert and non-alert branches so the UI always recovers.
How can I resolve this? If you propose a fix, please make it concise.
Fix: update Prompt To Fix With AIThis is a comment left during a code review.
Path: superwall/src/main/java/com/superwall/sdk/storage/core_data/Converters.kt
Line: 48:54
Comment:
**sanitizeMap now inconsistent**
`convertToJsonElement` now supports `Date`, `JSONArray`, and `JSONObject` (lines ~83-90), but `sanitizeMap` still filters these out (line ~51). That means callers using `Converters.fromMap()` will silently drop these values before conversion, and the new conversion code will never run for those types.
Fix: update `sanitizeMap` to allow `Date`, `JSONArray`, and `JSONObject` (and/or explicitly document that `sanitizeMap` is a stricter DB-only filter and ensure callers that need these types don’t go through it).
How can I resolve this? If you propose a fix, please make it concise. |
0b056c1 to
25aba58
Compare
Changes in this pull request
Checklist
CHANGELOG.mdfor any breaking changes, enhancements, or bug fixes.ktlintin the main directory and fixed any issues.Greptile Overview
Greptile Summary
PaywallLoadingState.LoadingPurchasewhen a purchase is initiated from the paywall webview.ClassCastExceptionand clearing corrupted stored values (Cache + Entitlements).Date/org.jsontypes, but current sanitization may drop these values before conversion.TransactionManagerto set loading state back toReadyafter purchase completes.Confidence Score: 3/5
LoadingPurchasestate is not clearly reset on all internal purchase failure paths, andConverters.sanitizeMapcurrently filters out the newly supported types so the added conversion logic can be bypassed/dropped silently.Important Files Changed
Sequence Diagram
sequenceDiagram participant Web as Paywall WebView participant SW as Superwall.eventDidOccur participant PV as PaywallView participant TM as TransactionManager participant PC as PurchaseController Web->>SW: InitiatePurchase(productId, shouldDismiss) SW->>PV: updateState(SetLoadingState(LoadingPurchase)) SW->>TM: purchase(PurchaseSource.Internal(productId, paywallState)) TM->>TM: prepareToPurchase(...) TM->>PC: purchase(activity, productDetails, offerId, basePlanId) alt Purchased TM->>TM: didPurchase(...) alt shouldDismiss && automaticallyDismiss TM->>SW: dismiss(paywallCacheKey, Purchased) else keep paywall open TM->>PV: updateState(SetLoadingState(Ready)) end else Failed TM->>TM: trackFailure(...) TM->>PV: updateState(ToggleSpinner(hidden=true)) note over TM,PV: PR adds LoadingPurchase on start, note over TM,PV: but failure path may not reset loading state. else Cancelled TM->>TM: trackCancelled(...) else Pending TM->>TM: handlePendingTransaction(...) end