-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[in_app_purchase_storekit] isIntroductoryOfferEligible implementation #9499
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
[in_app_purchase_storekit] isIntroductoryOfferEligible implementation #9499
Conversation
..._app_purchase/in_app_purchase_storekit/lib/src/store_kit_2_wrappers/sk2_product_wrapper.dart
Show resolved
Hide resolved
...ages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart
Show resolved
Hide resolved
...hase_storekit/Sources/in_app_purchase_storekit/StoreKit2/InAppPurchasePlugin+StoreKit2.swift
Outdated
Show resolved
Hide resolved
…kages into feature_isIntroductoryEligible
| isIntroductoryOfferEligibleChannel.setMessageHandler { message, reply in | ||
| let args = message as! [Any?] | ||
| let productIdArg = args[0] as! String | ||
| api.isIntroductoryOfferEligible(productId: productIdArg) { result in |
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.
Hi @LouiseHsu it looks like the extension where isIntroductoryOfferEligible is defined has this availability annotation:
Lines 7 to 8 in 80bf552
| @available(iOS 15.0, macOS 12.0, *) | |
| extension InAppPurchasePlugin: InAppPurchase2API { |
Does this mean if the developer's app's target iOS version is < 15.0 they'll get a compile time error from the plugin code (even if they're not using these new APIs at all?)
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.
No, availability annotation on extensions will compile fine on lower device version, it just cannot reference any code inside that extension!
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.
Ah it looks like the InAppPurchase2API calls are all placed inside an available check:
if #available(iOS 15.0, macOS 12.0, *) {
InAppPurchase2APISetup.setUp(binaryMessenger: messenger, api: instance)
}
So I guess if the application target's min iOS version is lower than 15 the caller would get a runtime error if they try to access methods defined in that extension, since the method channel is not set up?
...hase_storekit/Sources/in_app_purchase_storekit/StoreKit2/InAppPurchasePlugin+StoreKit2.swift
Outdated
Show resolved
Hide resolved
...ages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart
Outdated
Show resolved
Hide resolved
…kages into feature_isIntroductoryEligible
|
@LouiseHsu could you check PR please? |
LouiseHsu
left a comment
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.
lgtm, sorry for the delay!
flutter/packages@e4fd6c0...2c52f24 2025-07-07 pataridzegivi@gmail.com [in_app_purchase_storekit] isIntroductoryOfferEligible implementation (flutter/packages#9499) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…#171705) flutter/packages@e4fd6c0...2c52f24 2025-07-07 pataridzegivi@gmail.com [in_app_purchase_storekit] isIntroductoryOfferEligible implementation (flutter/packages#9499) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…#171705) flutter/packages@e4fd6c0...2c52f24 2025-07-07 pataridzegivi@gmail.com [in_app_purchase_storekit] isIntroductoryOfferEligible implementation (flutter/packages#9499) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…flutter#9499) Added `isEligibleForIntroOffer` method support https://developer.apple.com/documentation/storekit/product/subscriptioninfo/iseligibleforintrooffer ## Pre-Review Checklist [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
…#171705) flutter/packages@e4fd6c0...2c52f24 2025-07-07 pataridzegivi@gmail.com [in_app_purchase_storekit] isIntroductoryOfferEligible implementation (flutter/packages#9499) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Added
isEligibleForIntroOffermethod supporthttps://developer.apple.com/documentation/storekit/product/subscriptioninfo/iseligibleforintrooffer
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3