feat: sync with openiap v1.3.16 - ExternalPurchaseCustomLink API (iOS 18.1+)#613
feat: sync with openiap v1.3.16 - ExternalPurchaseCustomLink API (iOS 18.1+)#613
Conversation
… 18.1+) - Update openiap-versions.json (gql: 1.3.16, apple: 1.3.14, google: 1.3.27) - Regenerate Dart types with ExternalPurchaseCustomLink types - Add iOS native implementation for 3 new APIs: - isEligibleForExternalPurchaseCustomLinkIOS() - getExternalPurchaseCustomLinkTokenIOS(tokenType) - showExternalPurchaseCustomLinkNoticeIOS(noticeType) - Add Dart API wrappers in flutter_inapp_purchase.dart - Update queryHandlers and mutationHandlers with new APIs - Add release blog post for v8.2.5 - Update llms.txt and llms-full.txt with new APIs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughThis PR adds iOS ExternalPurchaseCustomLink support (iOS 18.1+) to flutter_inapp_purchase: new APIs for eligibility, token retrieval, and notice display; Dart types and wiring; native Swift handlers; tests; docs; and OpenIAP version bumps. Changes
Sequence Diagram(s)sequenceDiagram
rect rgba(220,240,255,0.5)
participant App as Flutter App
participant Dart as Dart API
participant iOS as iOS Plugin (Swift)
participant OpenIAP as OpenIapModule / StoreKit
participant Server as ExternalPurchase Server
end
App->>Dart: isEligibleForExternalPurchaseCustomLinkIOS()
Dart->>iOS: invoke method channel
iOS->>OpenIAP: check eligibility (StoreKit API)
OpenIAP-->>iOS: eligibility result
iOS-->>Dart: bool
Dart-->>App: bool
Note right of App: If eligible, flow continues
App->>Dart: getExternalPurchaseCustomLinkTokenIOS(tokenType)
Dart->>iOS: invoke method channel with tokenType
iOS->>OpenIAP: request token
OpenIAP-->>iOS: token
iOS-->>Dart: token result
Dart-->>App: token
App->>Dart: showExternalPurchaseCustomLinkNoticeIOS(noticeType)
Dart->>iOS: invoke method channel
iOS->>OpenIAP: present notice sheet (returns externalPurchaseToken)
OpenIAP-->>iOS: externalPurchaseToken
iOS-->>Dart: notice result (including externalPurchaseToken)
Dart-->>App: notice result
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @hyochan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates the latest OpenIAP updates and introduces robust support for Apple's new ExternalPurchaseCustomLink API for iOS 18.1+. This functionality allows apps with the appropriate entitlement to manage custom external purchase links, including checking eligibility, generating tokens for Apple's reporting server, and displaying required disclosure notices, thereby providing a complete and compliant flow for external purchases. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #613 +/- ##
==========================================
+ Coverage 67.17% 67.68% +0.50%
==========================================
Files 7 7
Lines 1447 1479 +32
==========================================
+ Hits 972 1001 +29
- Misses 475 478 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request adds support for Apple's ExternalPurchaseCustomLink API for iOS 18.1+, including native Swift implementation, Dart wrappers, and documentation updates. The changes are well-structured and follow the existing patterns in the codebase. I have identified a couple of issues. One is an inconsistency in error handling for one of the new APIs, where errors are silently swallowed. The other is a more significant issue regarding incorrect and inconsistent iOS version documentation for some existing external purchase APIs. I've provided suggestions to address these points to improve robustness and correctness.
lib/types.dart
Outdated
| /// Present external purchase notice sheet (iOS 15.4+). | ||
| /// Uses ExternalPurchase.presentNoticeSheet() which returns a token when user continues. | ||
| /// Reference: https://developer.apple.com/documentation/storekit/externalpurchase/presentnoticesheet() | ||
| Future<ExternalPurchaseNoticeResultIOS> presentExternalPurchaseNoticeSheetIOS(); |
There was a problem hiding this comment.
There are significant inconsistencies in the documented iOS versions for presentExternalPurchaseNoticeSheetIOS and the related canPresentExternalPurchaseNoticeIOS.
-
presentExternalPurchaseNoticeSheetIOS:- This Dart documentation states
iOS 15.4+. - The native Swift implementation in
FlutterInappPurchasePlugin.swiftchecks foriOS 18.2+. - Apple's official documentation states
ExternalPurchase.presentNoticeSheet()is available from iOS 17.5+.
- This Dart documentation states
-
canPresentExternalPurchaseNoticeIOS(line 4702):- The Dart documentation states
iOS 17.4+. - The native Swift implementation also checks for
iOS 18.2+. - Apple's official documentation for
ExternalPurchase.canPresentstates iOS 17.5+.
- The Dart documentation states
These discrepancies are misleading and can cause runtime errors. Please correct the version numbers in both the Dart documentation and the Swift availability checks to align with Apple's official documentation (iOS 17.5+).
There was a problem hiding this comment.
The iOS version numbers in lib/types.dart are auto-generated from the OpenIAP schema and cannot be edited manually (per CLAUDE.md guidelines). The Swift implementation uses iOS 18.2+ because that's when the OpenIAP native module requires this feature.
The version discrepancy between Dart docs and Apple's official documentation is an upstream issue in the openiap-dart package that generates these types. This should be addressed in the OpenIAP schema repository rather than in this Flutter package.
For this PR, the implementation follows the native OpenIAP library's requirements (iOS 18.2+).
There was a problem hiding this comment.
After researching Apple's official documentation and developer forums:
The correct iOS version appears to be iOS 17.4+, not iOS 17.5+.
According to Apple Developer Forums and SDK release notes:
ExternalPurchase.canPresentandExternalPurchase.presentNoticeSheet()became fully functional with token support starting iOS 17.4- On iOS 15.4 - 17.3, these APIs exist but don't provide tokens and return false
- The
linkToExternalPurchase()API is available on iOS 17.4+ for EU DMA compliance
Sources:
- Apple Developer Forums - ExternalPurchase.canPresent - discusses "iOS 17.4+, EU" implementation
- Apple Developer Forums - How to handle external purchases on iOS 15.4 - explains iOS 15.4 vs 17.4 differences
- iOS 17.4 SDK Release Notes
The types are auto-generated from the OpenIAP schema. I've opened an issue to verify the exact version requirements with Apple's documentation team, but based on current evidence, iOS 17.4+ is more accurate than iOS 17.5+.
Could you share the source for iOS 17.5+? I'd like to verify if there's a specific API change between 17.4 and 17.5.
…eCustomLink - Throw PurchaseError instead of returning false on error in isEligibleForExternalPurchaseCustomLinkIOS for clearer error handling - Add comprehensive test coverage for ExternalPurchaseCustomLink APIs: - isEligibleForExternalPurchaseCustomLinkIOS - getExternalPurchaseCustomLinkTokenIOS - showExternalPurchaseCustomLinkNoticeIOS Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Summary
isEligibleForExternalPurchaseCustomLinkIOS()- Check eligibilitygetExternalPurchaseCustomLinkTokenIOS(tokenType)- Get token for reportingshowExternalPurchaseCustomLinkNoticeIOS(noticeType)- Show disclosure noticeChanges
OpenIAP Versions
Test plan
flutter analyzepassesflutter testpasses (198 tests)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.