Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/in_app_purchase/in_app_purchase_ios/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.3

* Add price symbol to platform interface object ProductDetail.

## 0.1.2+1

* Fix wrong data type when cancelling user credentials dialog.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ class AppStoreProductDetails extends ProductDetails {
required double rawPrice,
required String currencyCode,
required this.skProduct,
required String currencySymbol,
}) : super(
id: id,
title: title,
description: description,
price: price,
rawPrice: rawPrice,
currencyCode: currencyCode,
currencySymbol: currencySymbol,
);

/// Points back to the [SKProductWrapper] object that was used to generate
Expand All @@ -41,6 +43,9 @@ class AppStoreProductDetails extends ProductDetails {
price: product.priceLocale.currencySymbol + product.price,
rawPrice: double.parse(product.price),
currencyCode: product.priceLocale.currencyCode,
currencySymbol: product.priceLocale.currencySymbol.isNotEmpty
? product.priceLocale.currencySymbol
: product.priceLocale.currencyCode,
skProduct: product,
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/in_app_purchase/in_app_purchase_ios/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: in_app_purchase_ios
description: An implementation for the iOS platform of the Flutter `in_app_purchase` plugin. This uses the iOS StoreKit Framework.
repository: https://github.com/flutter/plugins/tree/master/packages/in_app_purchase/in_app_purchase_ios
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
version: 0.1.2+1
version: 0.1.3

environment:
sdk: ">=2.12.0 <3.0.0"
Expand All @@ -18,7 +18,7 @@ dependencies:
collection: ^1.15.0
flutter:
sdk: flutter
in_app_purchase_platform_interface: ^1.0.0
in_app_purchase_platform_interface: ^1.1.0
json_annotation: ^4.0.1
meta: ^1.3.0
test: ^1.16.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ class FakeIOSPlatform {
Map<String, dynamic> productWrapperMap =
buildProductMap(dummyProductWrapper);
productWrapperMap['productIdentifier'] = validID;
if (validID == '456') {
productWrapperMap['priceLocale'] = buildLocaleMap(noSymbolLocale);
}
validProducts[validID] = SKProductWrapper.fromJson(productWrapperMap);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ void main() {
expect(products[1].id, '456');
expect(response.notFoundIDs, ['789']);
expect(response.error, isNull);
expect(response.productDetails.first.currencySymbol, r'$');
expect(response.productDetails[1].currencySymbol, 'EUR');
});

test(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ void main() {

test('LocaleWrapper should have property values consistent with map', () {
final SKPriceLocaleWrapper wrapper =
SKPriceLocaleWrapper.fromJson(buildLocaleMap(dummyLocale));
expect(wrapper, equals(dummyLocale));
SKPriceLocaleWrapper.fromJson(buildLocaleMap(dollarLocale));
expect(wrapper, equals(dollarLocale));
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ final SKPaymentTransactionWrapper dummyTransaction =
error: dummyError,
);

final SKPriceLocaleWrapper dummyLocale = SKPriceLocaleWrapper(
final SKPriceLocaleWrapper dollarLocale = SKPriceLocaleWrapper(
currencySymbol: '\$',
currencyCode: 'USD',
countryCode: 'US',
);

final SKPriceLocaleWrapper noSymbolLocale = SKPriceLocaleWrapper(
currencySymbol: '',
currencyCode: 'EUR',
countryCode: 'UK',
);

final SKProductSubscriptionPeriodWrapper dummySubscription =
SKProductSubscriptionPeriodWrapper(
numberOfUnits: 1,
Expand All @@ -47,7 +53,7 @@ final SKProductSubscriptionPeriodWrapper dummySubscription =

final SKProductDiscountWrapper dummyDiscount = SKProductDiscountWrapper(
price: '1.0',
priceLocale: dummyLocale,
priceLocale: dollarLocale,
numberOfPeriods: 1,
paymentMode: SKProductDiscountPaymentMode.payUpFront,
subscriptionPeriod: dummySubscription,
Expand All @@ -57,7 +63,7 @@ final SKProductWrapper dummyProductWrapper = SKProductWrapper(
productIdentifier: 'id',
localizedTitle: 'title',
localizedDescription: 'description',
priceLocale: dummyLocale,
priceLocale: dollarLocale,
subscriptionGroupIdentifier: 'com.group',
price: '1.0',
subscriptionPeriod: dummySubscription,
Expand Down