File tree 7 files changed +27
-7
lines changed
packages/in_app_purchase/in_app_purchase_ios 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
+
1
5
## 0.1.2+2
2
6
3
7
* 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 {
19
19
required double rawPrice,
20
20
required String currencyCode,
21
21
required this .skProduct,
22
+ required String currencySymbol,
22
23
}) : super (
23
24
id: id,
24
25
title: title,
25
26
description: description,
26
27
price: price,
27
28
rawPrice: rawPrice,
28
29
currencyCode: currencyCode,
30
+ currencySymbol: currencySymbol,
29
31
);
30
32
31
33
/// Points back to the [SKProductWrapper] object that was used to generate
@@ -41,6 +43,9 @@ class AppStoreProductDetails extends ProductDetails {
41
43
price: product.priceLocale.currencySymbol + product.price,
42
44
rawPrice: double .parse (product.price),
43
45
currencyCode: product.priceLocale.currencyCode,
46
+ currencySymbol: product.priceLocale.currencySymbol.isNotEmpty
47
+ ? product.priceLocale.currencySymbol
48
+ : product.priceLocale.currencyCode,
44
49
skProduct: product,
45
50
);
46
51
}
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: in_app_purchase_ios
2
2
description : An implementation for the iOS platform of the Flutter `in_app_purchase` plugin. This uses the iOS StoreKit Framework.
3
3
repository : https://github.com/flutter/plugins/tree/master/packages/in_app_purchase/in_app_purchase_ios
4
4
issue_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
6
6
7
7
environment :
8
8
sdk : " >=2.12.0 <3.0.0"
@@ -18,7 +18,7 @@ dependencies:
18
18
collection : ^1.15.0
19
19
flutter :
20
20
sdk : flutter
21
- in_app_purchase_platform_interface : ^1.0 .0
21
+ in_app_purchase_platform_interface : ^1.1 .0
22
22
json_annotation : ^4.0.1
23
23
meta : ^1.3.0
24
24
test : ^1.16.0
Original file line number Diff line number Diff line change @@ -40,6 +40,9 @@ class FakeIOSPlatform {
40
40
Map <String , dynamic > productWrapperMap =
41
41
buildProductMap (dummyProductWrapper);
42
42
productWrapperMap['productIdentifier' ] = validID;
43
+ if (validID == '456' ) {
44
+ productWrapperMap['priceLocale' ] = buildLocaleMap (noSymbolLocale);
45
+ }
43
46
validProducts[validID] = SKProductWrapper .fromJson (productWrapperMap);
44
47
}
45
48
Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ void main() {
49
49
expect (products[1 ].id, '456' );
50
50
expect (response.notFoundIDs, ['789' ]);
51
51
expect (response.error, isNull);
52
+ expect (response.productDetails.first.currencySymbol, r'$' );
53
+ expect (response.productDetails[1 ].currencySymbol, 'EUR' );
52
54
});
53
55
54
56
test (
Original file line number Diff line number Diff line change @@ -119,8 +119,8 @@ void main() {
119
119
120
120
test ('LocaleWrapper should have property values consistent with map' , () {
121
121
final SKPriceLocaleWrapper wrapper =
122
- SKPriceLocaleWrapper .fromJson (buildLocaleMap (dummyLocale ));
123
- expect (wrapper, equals (dummyLocale ));
122
+ SKPriceLocaleWrapper .fromJson (buildLocaleMap (dollarLocale ));
123
+ expect (wrapper, equals (dollarLocale ));
124
124
});
125
125
});
126
126
Original file line number Diff line number Diff line change @@ -33,12 +33,18 @@ final SKPaymentTransactionWrapper dummyTransaction =
33
33
error: dummyError,
34
34
);
35
35
36
- final SKPriceLocaleWrapper dummyLocale = SKPriceLocaleWrapper (
36
+ final SKPriceLocaleWrapper dollarLocale = SKPriceLocaleWrapper (
37
37
currencySymbol: '\$ ' ,
38
38
currencyCode: 'USD' ,
39
39
countryCode: 'US' ,
40
40
);
41
41
42
+ final SKPriceLocaleWrapper noSymbolLocale = SKPriceLocaleWrapper (
43
+ currencySymbol: '' ,
44
+ currencyCode: 'EUR' ,
45
+ countryCode: 'UK' ,
46
+ );
47
+
42
48
final SKProductSubscriptionPeriodWrapper dummySubscription =
43
49
SKProductSubscriptionPeriodWrapper (
44
50
numberOfUnits: 1 ,
@@ -47,7 +53,7 @@ final SKProductSubscriptionPeriodWrapper dummySubscription =
47
53
48
54
final SKProductDiscountWrapper dummyDiscount = SKProductDiscountWrapper (
49
55
price: '1.0' ,
50
- priceLocale: dummyLocale ,
56
+ priceLocale: dollarLocale ,
51
57
numberOfPeriods: 1 ,
52
58
paymentMode: SKProductDiscountPaymentMode .payUpFront,
53
59
subscriptionPeriod: dummySubscription,
@@ -57,7 +63,7 @@ final SKProductWrapper dummyProductWrapper = SKProductWrapper(
57
63
productIdentifier: 'id' ,
58
64
localizedTitle: 'title' ,
59
65
localizedDescription: 'description' ,
60
- priceLocale: dummyLocale ,
66
+ priceLocale: dollarLocale ,
61
67
subscriptionGroupIdentifier: 'com.group' ,
62
68
price: '1.0' ,
63
69
subscriptionPeriod: dummySubscription,
You can’t perform that action at this time.
0 commit comments