-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[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
Changes from 10 commits
dec92ba
614e68e
fe4873b
52fa727
0804bb3
8c03e8a
8471499
d2f5836
a681eed
80bf552
aba0a61
52302b3
0cbcd7c
96fc326
2d73870
ea93c81
272adf4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -691,6 +691,8 @@ protocol InAppPurchase2API { | |||||
| completion: @escaping (Result<SK2ProductPurchaseResultMessage, Error>) -> Void) | ||||||
| func isWinBackOfferEligible( | ||||||
| productId: String, offerId: String, completion: @escaping (Result<Bool, Error>) -> Void) | ||||||
| func isIntroductoryOfferEligible( | ||||||
| productId: String, completion: @escaping (Result<Bool, Error>) -> Void) | ||||||
| func transactions(completion: @escaping (Result<[SK2TransactionMessage], Error>) -> Void) | ||||||
| func finish(id: Int64, completion: @escaping (Result<Void, Error>) -> Void) | ||||||
| func startListeningToTransactions() throws | ||||||
|
|
@@ -787,6 +789,26 @@ class InAppPurchase2APISetup { | |||||
| } else { | ||||||
| isWinBackOfferEligibleChannel.setMessageHandler(nil) | ||||||
| } | ||||||
| let isIntroductoryOfferEligibleChannel = FlutterBasicMessageChannel( | ||||||
| name: | ||||||
| "dev.flutter.pigeon.in_app_purchase_storekit.InAppPurchase2API.isIntroductoryOfferEligible\(channelSuffix)", | ||||||
| binaryMessenger: binaryMessenger, codec: codec) | ||||||
| if let api = api { | ||||||
| isIntroductoryOfferEligibleChannel.setMessageHandler { message, reply in | ||||||
| let args = message as! [Any?] | ||||||
| let productIdArg = args[0] as! String | ||||||
| api.isIntroductoryOfferEligible(productId: productIdArg) { result in | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @LouiseHsu it looks like the extension where Lines 7 to 8 in 80bf552
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?)
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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!
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah it looks like the 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? |
||||||
| switch result { | ||||||
| case .success(let res): | ||||||
| reply(wrapResult(res)) | ||||||
| case .failure(let error): | ||||||
| reply(wrapError(error)) | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } else { | ||||||
| isIntroductoryOfferEligibleChannel.setMessageHandler(nil) | ||||||
| } | ||||||
| let transactionsChannel = FlutterBasicMessageChannel( | ||||||
| name: | ||||||
| "dev.flutter.pigeon.in_app_purchase_storekit.InAppPurchase2API.transactions\(channelSuffix)", | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.