Skip to content

feat: sync with openiap v1.3.12#608

Merged
hyochan merged 7 commits intomainfrom
feat/openiap-sync-1.3.12
Jan 17, 2026
Merged

feat: sync with openiap v1.3.12#608
hyochan merged 7 commits intomainfrom
feat/openiap-sync-1.3.12

Conversation

@hyochan
Copy link
Copy Markdown
Owner

@hyochan hyochan commented Jan 16, 2026

Summary

  • Sync with openiap v1.3.12 (gql: 1.3.12, apple: 1.3.10, google: 1.3.22)
  • Add new cross-platform DiscountOffer and SubscriptionOffer types
  • Add _parseSubscriptionOffers helper to convert legacy offer details
  • New discountOffers and subscriptionOffers fields on Product types

Changes

Types (auto-generated from openiap-gql)

  • New DiscountOffer type with cross-platform fields
  • New SubscriptionOffer type with cross-platform fields
  • Platform-specific fields use Android/IOS suffixes

lib/helpers.dart

  • Add _parseSubscriptionOffers function to convert legacy ProductSubscriptionAndroidOfferDetails to new SubscriptionOffer type
  • Update ProductSubscriptionAndroid parsing to include subscriptionOffers field

test/types_platform_test.dart

  • Update test to include required subscriptionOffers field

Test plan

  • flutter analyze passes (no issues found)
  • flutter test passes (176 tests)

🤖 Generated with Claude Code

- Update openiap-versions.json (gql: 1.3.12, apple: 1.3.10, google: 1.3.22)
- Regenerate Dart types with new cross-platform offer types
- Add _parseSubscriptionOffers helper to convert legacy offer details
- Add subscriptionOffers field to ProductSubscriptionAndroid parsing
- Update test to include required subscriptionOffers field

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 16, 2026

Warning

Rate limit exceeded

@hyochan has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 52 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 4fac74e and a127bd4.

⛔ Files ignored due to path filters (1)
  • example/macos/Podfile.lock is excluded by !**/*.lock
📒 Files selected for processing (25)
  • android/src/main/kotlin/io/github/hyochan/flutter_inapp_purchase/AndroidInappPurchasePlugin.kt
  • docs/docs/api/types.md
  • docs/docs/guides/subscription-offers.md
  • docs/static/llms-full.txt
  • docs/static/llms.txt
  • example/lib/src/screens/all_products_screen.dart
  • example/lib/src/screens/subscription_flow_screen.dart
  • lib/flutter_inapp_purchase.dart
  • lib/helpers.dart
  • lib/types.dart
  • lib/utils.dart
  • macos/Classes/FlutterIapHelper.swift
  • macos/Classes/FlutterInappPurchasePlugin.swift
  • openiap-versions.json
  • test/builders_unit_test.dart
  • test/errors_unit_test.dart
  • test/fetch_products_all_test.dart
  • test/flutter_inapp_purchase_active_subscriptions_test.dart
  • test/flutter_inapp_purchase_channel_test.dart
  • test/helpers_unit_test.dart
  • test/ios_methods_test.dart
  • test/ios_module_methods_test.dart
  • test/standardized_offer_types_test.dart
  • test/subscription_info_parse_test.dart
  • test/types_platform_test.dart

Note

Other AI code review bot(s) detected

CodeRabbit 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.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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 significantly enhances the openiap integration by updating core dependencies and introducing a standardized, cross-platform approach to handling product discount and subscription offers. The changes aim to unify the representation of offer details, making it easier to manage and display pricing information consistently across Android and iOS, while also preparing for future feature expansions.

Highlights

  • Dependency Updates: Updated openiap dependencies to their latest versions: gql to 1.3.12, apple to 1.3.10, and google to 1.3.22.
  • New Cross-Platform Offer Types: Introduced new cross-platform DiscountOffer and SubscriptionOffer types for consistent handling of product and subscription offers across platforms.
  • Legacy Offer Conversion: Added a new helper function, _parseSubscriptionOffers, to convert legacy Android subscription offer details into the new standardized SubscriptionOffer format.
  • Product Type Enhancements: Extended Product types with new discountOffers and subscriptionOffers fields to provide access to the standardized offer structures.
  • Deprecation of Old Types: Deprecated older, platform-specific offer types and fields (e.g., DiscountIOS, ProductAndroidOneTimePurchaseOfferDetail) in favor of the new cross-platform types.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 67.36842% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.15%. Comparing base (4fac74e) to head (a127bd4).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/flutter_inapp_purchase.dart 63.04% 17 Missing ⚠️
lib/helpers.dart 70.21% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #608      +/-   ##
==========================================
+ Coverage   67.01%   67.15%   +0.13%     
==========================================
  Files           7        7              
  Lines        1419     1440      +21     
==========================================
+ Hits          951      967      +16     
- Misses        468      473       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request synchronizes with openiap v1.3.12, introducing new cross-platform DiscountOffer and SubscriptionOffer types to unify in-app purchase offers across iOS and Android. The changes are well-structured, including a new helper function to parse legacy Android offers and updates to product types and tests. My review identified a few opportunities for improvement. The new _parseSubscriptionOffers helper in lib/helpers.dart could be refactored for better readability and to reduce duplication. Additionally, in the auto-generated lib/types.dart, I've noted that the fromJson factories for enums could be simplified, and some toJson methods contain redundant list serialization logic, which could be improved in the code generator. Overall, these changes are a positive step towards a more unified and maintainable API.

Comment on lines +149 to +165
factory DiscountOfferType.fromJson(String value) {
switch (value) {
case 'introductory':
case 'INTRODUCTORY':
case 'Introductory':
return DiscountOfferType.Introductory;
case 'promotional':
case 'PROMOTIONAL':
case 'Promotional':
return DiscountOfferType.Promotional;
case 'one-time':
case 'ONE_TIME':
case 'OneTime':
return DiscountOfferType.OneTime;
}
throw ArgumentError('Unknown DiscountOfferType value: $value');
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The fromJson factory method is a bit verbose. It can be simplified by converting the input value to a consistent format (e.g., lowercase and replacing underscores with hyphens) before the switch statement. This would reduce the number of case labels and make the code more maintainable.

Since this is an auto-generated file, this feedback applies to the script that generates this code.

  factory DiscountOfferType.fromJson(String value) {
    final lowerCaseValue = value.toLowerCase().replaceAll('_', '-');
    switch (lowerCaseValue) {
      case 'introductory':
        return DiscountOfferType.Introductory;
      case 'promotional':
        return DiscountOfferType.Promotional;
      case 'one-time':
        return DiscountOfferType.OneTime;
    }
    throw ArgumentError('Unknown DiscountOfferType value: $value');
  }

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 96329b6.

The code generator now normalizes the input value before the switch statement:

factory DiscountOfferType.fromJson(String value) {
  final normalized = value.toLowerCase().replaceAll('_', '-');
  switch (normalized) {
    case 'introductory':
      return DiscountOfferType.Introductory;
    case 'promotional':
      return DiscountOfferType.Promotional;
    case 'one-time':
      return DiscountOfferType.OneTime;
  }
  throw ArgumentError('Unknown DiscountOfferType value: $value');
}

This applies to all enums in the generated file. Thanks for the feedback!

hyochan and others added 6 commits January 17, 2026 08:31
- Combine duplicate pricingPhaseList.isNotEmpty checks
- Remove redundant priceAmountMicros parsing
- Use final for type declaration (no reassignment needed)
- Remove redundant else-if branch for offer type determination

Addresses Gemini code review feedback on PR #608.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add comprehensive test suite for SubscriptionOffer, DiscountOffer types
- Update subscription_flow_screen to display standardized offers
- Update all_products_screen to show discount offer count badge
- Update docs/api/types.md with standardized offer documentation
- Update llms.txt and llms-full.txt with new type definitions

New test coverage for:
- DiscountOffer serialization/deserialization
- SubscriptionOffer serialization (cross-platform, Android, iOS fields)
- PaymentMode and DiscountOfferType enums
- SubscriptionPeriod and SubscriptionPeriodUnit
- Product types with standardized offers

Co-Authored-By: Claude Opus 4.5 <[email protected]>
…chaseProps)

- Update FlutterIapHelper.swift to use decodeVerifyPurchaseProps
- Update FlutterInappPurchasePlugin.swift to call new method
- Update subscription-offers.md with standardized offer examples
- macOS build now succeeds with OpenIAP apple 1.3.10

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Fix missing getAvailableItems in horizon flavor.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add SubscriptionProductReplacementParamsAndroid and SubscriptionReplacementModeAndroid imports
- Parse subscriptionProductReplacementParams in requestPurchase method
- Pass subscriptionProductReplacementParams to buildRequestPurchaseProps
- Add KEY_SUBSCRIPTION_PRODUCT_REPLACEMENT_PARAMS constant

This enables item-level subscription replacement (Google Play Billing 8.1.0+)
as an alternative to the deprecated replacementModeAndroid.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@hyochan hyochan merged commit 15c64da into main Jan 17, 2026
6 checks passed
@hyochan hyochan deleted the feat/openiap-sync-1.3.12 branch January 17, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant