-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[in_app_purchase][iOS] fix iOS promotional offers (SKPaymentDiscountWrapper was not used properly) #6541
[in_app_purchase][iOS] fix iOS promotional offers (SKPaymentDiscountWrapper was not used properly) #6541
Changes from all commits
87b43a0
fa38cb5
cd50399
8d9aa09
62425f7
0bab6d1
8fe0cd7
badbd1d
32c0424
f90c3f5
3621201
ea5cbcf
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 |
---|---|---|
|
@@ -277,7 +277,7 @@ + (SKPaymentDiscount *)getSKPaymentDiscountFromMap:(NSDictionary *)map | |
return nil; | ||
} | ||
|
||
if (!timestamp || ![timestamp isKindOfClass:NSNumber.class] || [timestamp intValue] <= 0) { | ||
if (!timestamp || ![timestamp isKindOfClass:NSNumber.class] || [timestamp longLongValue] <= 0) { | ||
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. Nice catch. Can we add an XCUnitTest for this? Maybe have the timestamp to be a very big long long number? 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. Done. I've added XCUnitTest using current timestamp number value. It's enough to cause the |
||
if (error) { | ||
*error = @"When specifying a payment discount the 'timestamp' field is mandatory."; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,7 +75,10 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { | |
purchaseParam is AppStorePurchaseParam ? purchaseParam.quantity : 1, | ||
applicationUsername: purchaseParam.applicationUserName, | ||
simulatesAskToBuyInSandbox: purchaseParam is AppStorePurchaseParam && | ||
purchaseParam.simulatesAskToBuyInSandbox)); | ||
purchaseParam.simulatesAskToBuyInSandbox, | ||
paymentDiscount: purchaseParam is AppStorePurchaseParam | ||
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. We should test that the 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. I see your point, that in fact the bug was that the discount parameter was not sent trough the method channel. But I am not sure on how to construct such a test? 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. You might be able to intercept the method call in the 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. I got your idea. Thanks! Done in the last commit. |
||
? purchaseParam.discount | ||
: null)); | ||
|
||
return true; // There's no error feedback from iOS here to return. | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -405,7 +405,8 @@ class SKPaymentWrapper { | |
'applicationUsername': applicationUsername, | ||
'requestData': requestData, | ||
'quantity': quantity, | ||
'simulatesAskToBuyInSandbox': simulatesAskToBuyInSandbox | ||
'simulatesAskToBuyInSandbox': simulatesAskToBuyInSandbox, | ||
'paymentDiscount': paymentDiscount?.toMap(), | ||
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. We should have some test for the 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. Done. I've added a new test checking the values of the |
||
}; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: in_app_purchase_storekit | |
description: An implementation for the iOS platform of the Flutter `in_app_purchase` plugin. This uses the StoreKit Framework. | ||
repository: https://github.com/flutter/plugins/tree/main/packages/in_app_purchase/in_app_purchase_storekit | ||
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 | ||
version: 0.3.2+2 | ||
version: 0.3.3 | ||
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. This is a bugfix, so the version should be 0.3.2+3. 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. This adds a new field to the 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. Thanks for the correction there; I didn't look closely enough at the details and thought it was just populating something that was previously added but not wired up. |
||
|
||
environment: | ||
sdk: ">=2.14.0 <3.0.0" | ||
|
Uh oh!
There was an error while loading. Please reload this page.