File tree Expand file tree Collapse file tree 7 files changed +27
-7
lines changed
packages/in_app_purchase/in_app_purchase_ios Expand file tree Collapse file tree 7 files changed +27
-7
lines changed Original file line number Diff line number Diff line change 1+ ## 0.1.3
2+
3+ * Add price symbol to platform interface object ProductDetail.
4+
15## 0.1.2+2
26
37* Fix crash when retrieveReceiptWithError gives an error.
Original file line number Diff line number Diff line change @@ -19,13 +19,15 @@ class AppStoreProductDetails extends ProductDetails {
1919 required double rawPrice,
2020 required String currencyCode,
2121 required this .skProduct,
22+ required String currencySymbol,
2223 }) : super (
2324 id: id,
2425 title: title,
2526 description: description,
2627 price: price,
2728 rawPrice: rawPrice,
2829 currencyCode: currencyCode,
30+ currencySymbol: currencySymbol,
2931 );
3032
3133 /// Points back to the [SKProductWrapper] object that was used to generate
@@ -41,6 +43,9 @@ class AppStoreProductDetails extends ProductDetails {
4143 price: product.priceLocale.currencySymbol + product.price,
4244 rawPrice: double .parse (product.price),
4345 currencyCode: product.priceLocale.currencyCode,
46+ currencySymbol: product.priceLocale.currencySymbol.isNotEmpty
47+ ? product.priceLocale.currencySymbol
48+ : product.priceLocale.currencyCode,
4449 skProduct: product,
4550 );
4651 }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: in_app_purchase_ios
22description : An implementation for the iOS platform of the Flutter `in_app_purchase` plugin. This uses the iOS StoreKit Framework.
33repository : https://github.com/flutter/plugins/tree/master/packages/in_app_purchase/in_app_purchase_ios
44issue_tracker : https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
5- version : 0.1.2+2
5+ version : 0.1.3
66
77environment :
88 sdk : " >=2.12.0 <3.0.0"
@@ -18,7 +18,7 @@ dependencies:
1818 collection : ^1.15.0
1919 flutter :
2020 sdk : flutter
21- in_app_purchase_platform_interface : ^1.0 .0
21+ in_app_purchase_platform_interface : ^1.1 .0
2222 json_annotation : ^4.0.1
2323 meta : ^1.3.0
2424 test : ^1.16.0
Original file line number Diff line number Diff line change @@ -40,6 +40,9 @@ class FakeIOSPlatform {
4040 Map <String , dynamic > productWrapperMap =
4141 buildProductMap (dummyProductWrapper);
4242 productWrapperMap['productIdentifier' ] = validID;
43+ if (validID == '456' ) {
44+ productWrapperMap['priceLocale' ] = buildLocaleMap (noSymbolLocale);
45+ }
4346 validProducts[validID] = SKProductWrapper .fromJson (productWrapperMap);
4447 }
4548
Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ void main() {
4949 expect (products[1 ].id, '456' );
5050 expect (response.notFoundIDs, ['789' ]);
5151 expect (response.error, isNull);
52+ expect (response.productDetails.first.currencySymbol, r'$' );
53+ expect (response.productDetails[1 ].currencySymbol, 'EUR' );
5254 });
5355
5456 test (
Original file line number Diff line number Diff line change @@ -119,8 +119,8 @@ void main() {
119119
120120 test ('LocaleWrapper should have property values consistent with map' , () {
121121 final SKPriceLocaleWrapper wrapper =
122- SKPriceLocaleWrapper .fromJson (buildLocaleMap (dummyLocale ));
123- expect (wrapper, equals (dummyLocale ));
122+ SKPriceLocaleWrapper .fromJson (buildLocaleMap (dollarLocale ));
123+ expect (wrapper, equals (dollarLocale ));
124124 });
125125 });
126126
Original file line number Diff line number Diff line change @@ -33,12 +33,18 @@ final SKPaymentTransactionWrapper dummyTransaction =
3333 error: dummyError,
3434);
3535
36- final SKPriceLocaleWrapper dummyLocale = SKPriceLocaleWrapper (
36+ final SKPriceLocaleWrapper dollarLocale = SKPriceLocaleWrapper (
3737 currencySymbol: '\$ ' ,
3838 currencyCode: 'USD' ,
3939 countryCode: 'US' ,
4040);
4141
42+ final SKPriceLocaleWrapper noSymbolLocale = SKPriceLocaleWrapper (
43+ currencySymbol: '' ,
44+ currencyCode: 'EUR' ,
45+ countryCode: 'UK' ,
46+ );
47+
4248final SKProductSubscriptionPeriodWrapper dummySubscription =
4349 SKProductSubscriptionPeriodWrapper (
4450 numberOfUnits: 1 ,
@@ -47,7 +53,7 @@ final SKProductSubscriptionPeriodWrapper dummySubscription =
4753
4854final SKProductDiscountWrapper dummyDiscount = SKProductDiscountWrapper (
4955 price: '1.0' ,
50- priceLocale: dummyLocale ,
56+ priceLocale: dollarLocale ,
5157 numberOfPeriods: 1 ,
5258 paymentMode: SKProductDiscountPaymentMode .payUpFront,
5359 subscriptionPeriod: dummySubscription,
@@ -57,7 +63,7 @@ final SKProductWrapper dummyProductWrapper = SKProductWrapper(
5763 productIdentifier: 'id' ,
5864 localizedTitle: 'title' ,
5965 localizedDescription: 'description' ,
60- priceLocale: dummyLocale ,
66+ priceLocale: dollarLocale ,
6167 subscriptionGroupIdentifier: 'com.group' ,
6268 price: '1.0' ,
6369 subscriptionPeriod: dummySubscription,
You can’t perform that action at this time.
0 commit comments