fix: fixed isEligibleForIntroOfferIOS()#23
Conversation
WalkthroughThe isEligibleForIntroOfferIOS method in Sources/OpenIapModule.swift was refactored to use StoreKit’s SubscriptionInfo.isEligibleForIntroOffer(for:) in a single async call, removing the prior loop over current entitlements and manual verification. No public API signatures were changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor App
participant OpenIapModule
participant StoreKit as StoreKit.SubscriptionInfo
App->>OpenIapModule: isEligibleForIntroOfferIOS(productId)
Note over OpenIapModule: Previous flow removed:<br/>- Iterate entitlements<br/>- Verify each transaction<br/>- Early return if match
OpenIapModule->>StoreKit: isEligibleForIntroOffer(for: product)
StoreKit-->>OpenIapModule: Bool eligibility
OpenIapModule-->>App: Return eligibility
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)Sources/**/*.swift📄 CodeRabbit inference engine (CLAUDE.md)
Files:
Sources/{OpenIapProtocol.swift,OpenIapModule.swift}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (1)📚 Learning: 2025-10-09T19:13:15.972ZApplied to files:
🧬 Code graph analysis (1)Sources/OpenIapModule.swift (2)
🔇 Additional comments (2)
Comment |
|
@hyochan Please check this as soon as possible! 🙏🙏🙏 |
Hi, I discovered that
isEligibleForIntroOfferIOS()is not working as expected. After digging into it, I found that this feature relies onTransaction.currentEntitlements, which only returns subscriptions with a state ofsubscribedorinGracePeriod. As a result, the outcome doesn’t accurately represent the actual introductory offer eligibility.This fix changes the implementation to rely on
Product.SubscriptionInfo.isEligibleForIntroOffer(for: groupID)https://developer.apple.com/documentation/storekit/product/subscriptioninfo/iseligibleforintrooffer(for:)Summary by CodeRabbit