Skip to content

Commit

Permalink
[in_app_purchase_platform_interface] Adds countryCode API (flutter#6548)
Browse files Browse the repository at this point in the history
Original pr flutter/packages#6540

Related to flutter#141627
  • Loading branch information
reidbaker authored Apr 17, 2024
1 parent 76c4a3d commit 0dd8de2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 1.4.0

* Adds `getCountryCode` API.
* Updates minimum supported SDK version to Flutter 3.13/Dart 3.1.

## 1.3.7
Expand Down Expand Up @@ -39,7 +40,7 @@

## 1.3.0

* Added new `PurchaseStatus` named `canceled` to distinguish between an error and user cancellation.
* Added new `PurchaseStatus` named `canceled` to distinguish between an error and user cancellation.

## 1.2.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,21 @@ abstract class InAppPurchasePlatform extends PlatformInterface {
/// [PurchaseDetails.verificationData].
Future<void> restorePurchases({String? applicationUserName}) =>
throw UnimplementedError('restorePurchases() has not been implemented.');

/// Returns the user's country.
///
/// Android:
/// Returns Play billing country code based on ISO-3166-1 alpha2 format.
///
/// See: https://developer.android.com/reference/com/android/billingclient/api/BillingConfig
/// See: https://unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html
///
/// iOS:
/// Returns the country code from SKStoreFrontWrapper.
///
/// See: https://developer.apple.com/documentation/storekit/skstorefront?language=objc
///
///
Future<String> countryCode() =>
throw UnimplementedError('countryCode() has not been implemented.');
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/in_app_purcha
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 1.3.7
version: 1.4.0

environment:
sdk: ^3.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,18 @@ void main() {
throwsUnimplementedError,
);
});

test(
'Default implementation of countryCode should throw unimplemented error',
() {
final ExtendsInAppPurchasePlatform inAppPurchasePlatform =
ExtendsInAppPurchasePlatform();

expect(
() => inAppPurchasePlatform.countryCode(),
throwsUnimplementedError,
);
});
});

group('$InAppPurchasePlatformAddition', () {
Expand Down

0 comments on commit 0dd8de2

Please sign in to comment.