Skip to content

[in_app_purchase_platform_interface] Adds countryCode API #6548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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