Fix subscription state not updating after purchase or cancellation

- Add force parameter to checkSubscriptionStatus to bypass 5-minute
  throttle when called from transaction listener, purchase completion,
  and restore purchases
- Remove early return for expired/revoked states that prevented
  fallback to trial
- Only trust cached subscription expiration when offline (products
  failed to load); when StoreKit returns products successfully, treat
  the live entitlement check as authoritative
- Add debug logging throughout IAP state machine for diagnostics

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-03-13 09:07:08 -05:00
parent 75a3d7b448
commit c3e70d34b2
2 changed files with 40 additions and 27 deletions

View File

@@ -71,7 +71,7 @@ struct ReflectSubscriptionStoreView: View {
case .success(.success(_)):
AnalyticsManager.shared.trackPurchaseCompleted(productId: product.id, source: source)
Task { @MainActor in
await iapManager.checkSubscriptionStatus()
await iapManager.checkSubscriptionStatus(force: true)
iapManager.trackSubscriptionAnalytics(source: "purchase_success")
}
dismiss()