From 642f5d620ae4781622e17a507784f5583d8dd889 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Mon, 15 Apr 2024 10:51:07 -0400 Subject: [PATCH 01/18] Add changelog and version bump --- .../in_app_purchase/CHANGELOG.md | 3 ++- .../in_app_purchase/lib/in_app_purchase.dart | 17 +++++++++++++++++ .../in_app_purchase/pubspec.yaml | 6 +++--- .../in_app_purchase_android/CHANGELOG.md | 4 ++++ .../src/in_app_purchase_android_platform.dart | 12 ++++++++++++ ..._app_purchase_android_platform_addition.dart | 1 + .../in_app_purchase_android/pubspec.yaml | 4 ++-- .../CHANGELOG.md | 5 +++-- .../lib/src/in_app_purchase_platform.dart | 17 +++++++++++++++++ .../pubspec.yaml | 2 +- .../in_app_purchase_storekit/CHANGELOG.md | 4 ++++ .../src/in_app_purchase_storekit_platform.dart | 8 ++++++++ .../in_app_purchase_storekit/pubspec.yaml | 4 ++-- 13 files changed, 76 insertions(+), 11 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md index 728a85ebf487..1b93ac0d1511 100644 --- a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 3.2.0 +* Adds getCountryCode api. * Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. * Updates support matrix in README to indicate that iOS 11 is no longer supported. * Clients on versions of Flutter that still support iOS 11 can continue to use this diff --git a/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart b/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart index c7a48b48dc22..55493971f45f 100644 --- a/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart +++ b/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart @@ -209,4 +209,21 @@ class InAppPurchase implements InAppPurchasePlatformAdditionProvider { InAppPurchasePlatform.instance.restorePurchases( applicationUserName: applicationUserName, ); + + /// Returns the users 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 countryCode() => + throw UnimplementedError('countryCode() has not been implemented.'); } diff --git a/packages/in_app_purchase/in_app_purchase/pubspec.yaml b/packages/in_app_purchase/in_app_purchase/pubspec.yaml index 2d5d3624ab72..880d0aa0d2ad 100644 --- a/packages/in_app_purchase/in_app_purchase/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase description: A Flutter plugin for in-app purchases. Exposes APIs for making in-app purchases through the App Store and Google Play. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 3.1.13 +version: 3.2.0 environment: sdk: ^3.1.0 @@ -21,8 +21,8 @@ flutter: dependencies: flutter: sdk: flutter - in_app_purchase_android: ^0.3.0 - in_app_purchase_platform_interface: ^1.0.0 + in_app_purchase_android: ^0.3.4 + in_app_purchase_platform_interface: ^1.4.0 in_app_purchase_storekit: ^0.3.4 dev_dependencies: diff --git a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md index b1115c133fa1..dfde812f6567 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.4 + +* Adds getCountryCode api. + ## 0.3.3 * Converts data objects in internal platform communication to Pigeon. diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart index 9663aa414d5d..a96bebc1ea0f 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart @@ -11,6 +11,7 @@ import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_inte import '../billing_client_wrappers.dart'; import '../in_app_purchase_android.dart'; +import 'billing_client_wrappers/billing_config_wrapper.dart'; /// [IAPError.code] code for failed purchases. const String kPurchaseErrorCode = 'purchase_error'; @@ -311,4 +312,15 @@ class InAppPurchaseAndroidPlatform extends InAppPurchasePlatform { ]; } } + + /// 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 + @override + Future getCountryCode() async { + final BillingConfigWrapper billingConfig = await billingClientManager + .runWithClient((BillingClient client) => client.getBillingConfig()); + return billingConfig.countryCode; + } } diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart index e8c6f07a0bc7..c0ca171ad6d2 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform_addition.dart @@ -167,6 +167,7 @@ class InAppPurchaseAndroidPlatformAddition /// /// 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 + @Deprecated('Use InAppPurchasePlatfrom.getCountryCode') Future getCountryCode() async { final BillingConfigWrapper billingConfig = await _billingClientManager .runWithClient((BillingClient client) => client.getBillingConfig()); diff --git a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml index 125aede3ff72..91b8f61208b1 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase_android description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 0.3.3 +version: 0.3.4 environment: sdk: ^3.1.0 @@ -20,7 +20,7 @@ dependencies: collection: ^1.15.0 flutter: sdk: flutter - in_app_purchase_platform_interface: ^1.3.0 + in_app_purchase_platform_interface: ^1.4.0 json_annotation: ^4.8.0 dev_dependencies: diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md index 6baaa7f722dd..90127aa0677d 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md @@ -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 @@ -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 diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart b/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart index 18c6828b11d1..c967d027bc04 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart @@ -194,4 +194,21 @@ abstract class InAppPurchasePlatform extends PlatformInterface { /// [PurchaseDetails.verificationData]. Future restorePurchases({String? applicationUserName}) => throw UnimplementedError('restorePurchases() has not been implemented.'); + + /// Returns the users 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 countryCode() => + throw UnimplementedError('countryCode() has not been implemented.'); } diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml index a85144696cf8..35fc0488d9d0 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml @@ -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 diff --git a/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md index fce36eb13a6b..70bad8485e9e 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.14 + +* Adds getCountryCode api. + ## 0.3.13+1 * Handle translation of errors nested in dictionaries. diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart index 9dbdc4785788..5d835dea0bac 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart @@ -153,6 +153,14 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { ); return productDetailsResponse; } + + /// Returns the country code from SKStoreFrontWrapper. + /// + /// See: https://developer.apple.com/documentation/storekit/skstorefront?language=objc + @override + Future getCountryCode() async { + return (await SKPaymentQueueWrapper().storefront())?.countryCode; + } } enum _TransactionRestoreState { diff --git a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml index 08ba026a014a..d20cdec6ff15 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase_storekit description: An implementation for the iOS and macOS platforms of the Flutter `in_app_purchase` plugin. This uses the StoreKit Framework. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_storekit issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 0.3.13+1 +version: 0.3.14 environment: sdk: ^3.2.3 @@ -23,7 +23,7 @@ dependencies: collection: ^1.15.0 flutter: sdk: flutter - in_app_purchase_platform_interface: ^1.3.0 + in_app_purchase_platform_interface: ^1.4.0 json_annotation: ^4.3.0 dev_dependencies: From ab226a45cfe7d859ea388040ab62f6cf97376f3a Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Mon, 15 Apr 2024 13:02:18 -0400 Subject: [PATCH 02/18] dependency override from package tool --- .../in_app_purchase/in_app_purchase/example/pubspec.yaml | 5 +++++ packages/in_app_purchase/in_app_purchase/pubspec.yaml | 5 +++++ .../in_app_purchase/in_app_purchase_android/CHANGELOG.md | 4 ---- .../in_app_purchase_android/example/pubspec.yaml | 5 +++++ .../lib/src/in_app_purchase_android_platform.dart | 1 - .../in_app_purchase/in_app_purchase_android/pubspec.yaml | 9 +++++++-- .../in_app_purchase_platform_interface/pubspec.yaml | 2 +- .../in_app_purchase_storekit/CHANGELOG.md | 4 ---- .../in_app_purchase_storekit/example/pubspec.yaml | 5 +++++ .../lib/src/in_app_purchase_storekit_platform.dart | 1 - .../in_app_purchase_storekit/pubspec.yaml | 9 +++++++-- 11 files changed, 35 insertions(+), 15 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml b/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml index 19cd0fd9ffe7..f5c143968daa 100644 --- a/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml @@ -28,3 +28,8 @@ dev_dependencies: flutter: uses-material-design: true + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins +dependency_overrides: + {in_app_purchase_android: {path: ../../../in_app_purchase/in_app_purchase_android}, in_app_purchase_platform_interface: {path: ../../../in_app_purchase/in_app_purchase_platform_interface}, in_app_purchase_storekit: {path: ../../../in_app_purchase/in_app_purchase_storekit}} diff --git a/packages/in_app_purchase/in_app_purchase/pubspec.yaml b/packages/in_app_purchase/in_app_purchase/pubspec.yaml index 880d0aa0d2ad..7eacb06949e3 100644 --- a/packages/in_app_purchase/in_app_purchase/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase/pubspec.yaml @@ -42,3 +42,8 @@ screenshots: path: doc/iap_ios.gif - description: 'Example of in-app purchase on android' path: doc/iap_android.gif + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins +dependency_overrides: + {in_app_purchase_android: {path: ../../in_app_purchase/in_app_purchase_android}, in_app_purchase_platform_interface: {path: ../../in_app_purchase/in_app_purchase_platform_interface}, in_app_purchase_storekit: {path: ../../in_app_purchase/in_app_purchase_storekit}} diff --git a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md index dfde812f6567..b1115c133fa1 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,7 +1,3 @@ -## 0.3.4 - -* Adds getCountryCode api. - ## 0.3.3 * Converts data objects in internal platform communication to Pigeon. diff --git a/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml index 9239f83a0a31..3ad6a49ef090 100644 --- a/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml @@ -28,3 +28,8 @@ dev_dependencies: flutter: uses-material-design: true + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins +dependency_overrides: + {in_app_purchase_android: {path: ../../../in_app_purchase/in_app_purchase_android}, in_app_purchase_platform_interface: {path: ../../../in_app_purchase/in_app_purchase_platform_interface}} diff --git a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart index a96bebc1ea0f..9b9e2f1b1ea2 100644 --- a/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_android/lib/src/in_app_purchase_android_platform.dart @@ -317,7 +317,6 @@ class InAppPurchaseAndroidPlatform extends InAppPurchasePlatform { /// /// 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 - @override Future getCountryCode() async { final BillingConfigWrapper billingConfig = await billingClientManager .runWithClient((BillingClient client) => client.getBillingConfig()); diff --git a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml index 91b8f61208b1..8915c9af3cc5 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase_android description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 0.3.4 +version: 0.3.3 environment: sdk: ^3.1.0 @@ -20,7 +20,7 @@ dependencies: collection: ^1.15.0 flutter: sdk: flutter - in_app_purchase_platform_interface: ^1.4.0 + in_app_purchase_platform_interface: ^1.3.0 json_annotation: ^4.8.0 dev_dependencies: @@ -35,3 +35,8 @@ dev_dependencies: topics: - in-app-purchase - payment + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins +dependency_overrides: + {in_app_purchase_platform_interface: {path: ../../in_app_purchase/in_app_purchase_platform_interface}} diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml index 35fc0488d9d0..a85144696cf8 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml @@ -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.4.0 +version: 1.3.7 environment: sdk: ^3.1.0 diff --git a/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md index 70bad8485e9e..fce36eb13a6b 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_storekit/CHANGELOG.md @@ -1,7 +1,3 @@ -## 0.3.14 - -* Adds getCountryCode api. - ## 0.3.13+1 * Handle translation of errors nested in dictionaries. diff --git a/packages/in_app_purchase/in_app_purchase_storekit/example/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_storekit/example/pubspec.yaml index 2062efd0fb70..a81524ac7527 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/example/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_storekit/example/pubspec.yaml @@ -27,3 +27,8 @@ dev_dependencies: flutter: uses-material-design: true + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins +dependency_overrides: + {in_app_purchase_platform_interface: {path: ../../../in_app_purchase/in_app_purchase_platform_interface}, in_app_purchase_storekit: {path: ../../../in_app_purchase/in_app_purchase_storekit}} diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart index 5d835dea0bac..8a3a75b38f55 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart @@ -157,7 +157,6 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { /// Returns the country code from SKStoreFrontWrapper. /// /// See: https://developer.apple.com/documentation/storekit/skstorefront?language=objc - @override Future getCountryCode() async { return (await SKPaymentQueueWrapper().storefront())?.countryCode; } diff --git a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml index d20cdec6ff15..63a2feeda2af 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml @@ -2,7 +2,7 @@ name: in_app_purchase_storekit description: An implementation for the iOS and macOS platforms of the Flutter `in_app_purchase` plugin. This uses the StoreKit Framework. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_storekit issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 -version: 0.3.14 +version: 0.3.13+1 environment: sdk: ^3.2.3 @@ -23,7 +23,7 @@ dependencies: collection: ^1.15.0 flutter: sdk: flutter - in_app_purchase_platform_interface: ^1.4.0 + in_app_purchase_platform_interface: ^1.3.0 json_annotation: ^4.3.0 dev_dependencies: @@ -37,3 +37,8 @@ dev_dependencies: topics: - in-app-purchase - payment + +# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. +# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins +dependency_overrides: + {in_app_purchase_platform_interface: {path: ../../in_app_purchase/in_app_purchase_platform_interface}} From c864572e947e29a0d2b64ff023e127ecd6465227 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Mon, 15 Apr 2024 13:06:35 -0400 Subject: [PATCH 03/18] Remove changelog --- packages/in_app_purchase/in_app_purchase/CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md index 1b93ac0d1511..728a85ebf487 100644 --- a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md @@ -1,6 +1,5 @@ -## 3.2.0 +## NEXT -* Adds getCountryCode api. * Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. * Updates support matrix in README to indicate that iOS 11 is no longer supported. * Clients on versions of Flutter that still support iOS 11 can continue to use this From f25d4a1909600fada4d93e9c6b41144400fda8e4 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Mon, 15 Apr 2024 13:10:59 -0400 Subject: [PATCH 04/18] use instance variable --- .../lib/src/in_app_purchase_storekit_platform.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart index 8a3a75b38f55..69395d4f6ccd 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart @@ -158,7 +158,7 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { /// /// See: https://developer.apple.com/documentation/storekit/skstorefront?language=objc Future getCountryCode() async { - return (await SKPaymentQueueWrapper().storefront())?.countryCode; + return (await _skPaymentQueueWrapper.storefront())?.countryCode; } } From 2b1b295db929906f7508cc05ef5d9e405e224996 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Mon, 15 Apr 2024 13:39:11 -0400 Subject: [PATCH 05/18] Add tests for new platfrom apis --- ...in_app_purchase_android_platform_test.dart | 19 +++++++++++++++++++ .../in_app_purchase_storekit_platform.dart | 1 + .../test/fakes/fake_storekit_platform.dart | 12 +++++++++++- ...n_app_purchase_storekit_platform_test.dart | 10 ++++++++++ 4 files changed, 41 insertions(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart index c4e92602d983..c03365654c48 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart @@ -9,10 +9,12 @@ import 'package:flutter/widgets.dart' as widgets; import 'package:flutter_test/flutter_test.dart'; import 'package:in_app_purchase_android/billing_client_wrappers.dart'; import 'package:in_app_purchase_android/in_app_purchase_android.dart'; +import 'package:in_app_purchase_android/src/billing_client_wrappers/billing_config_wrapper.dart'; import 'package:in_app_purchase_android/src/messages.g.dart'; import 'package:in_app_purchase_platform_interface/in_app_purchase_platform_interface.dart'; import 'package:mockito/mockito.dart'; +import 'billing_client_wrappers/billing_client_wrapper_test.dart'; import 'billing_client_wrappers/billing_client_wrapper_test.mocks.dart'; import 'billing_client_wrappers/product_details_wrapper_test.dart'; import 'billing_client_wrappers/purchase_wrapper_test.dart'; @@ -747,4 +749,21 @@ void main() { expect(await completer.future, equals(expectedBillingResult)); }); }); + + group('billingConfig', () { + test('getCountryCode success', () async { + const String expectedCountryCode = 'US'; + const BillingConfigWrapper expected = BillingConfigWrapper( + countryCode: expectedCountryCode, + responseCode: BillingResponse.ok, + debugMessage: 'dummy message'); + + when(mockApi.getBillingConfigAsync()) + .thenAnswer((_) async => platformBillingConfigFromWrapper(expected)); + final String countryCode = + await iapAndroidPlatform.getCountryCode(); + + expect(countryCode, equals(expectedCountryCode)); + }); + }); } diff --git a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart index 69395d4f6ccd..acdc4a2979c5 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/lib/src/in_app_purchase_storekit_platform.dart @@ -156,6 +156,7 @@ class InAppPurchaseStoreKitPlatform extends InAppPurchasePlatform { /// Returns the country code from SKStoreFrontWrapper. /// + /// Uses the ISO 3166-1 Alpha-3 country code representation. /// See: https://developer.apple.com/documentation/storekit/skstorefront?language=objc Future getCountryCode() async { return (await _skPaymentQueueWrapper.storefront())?.countryCode; diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart index 8fff5754eb77..4d1842931582 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart @@ -27,6 +27,8 @@ class FakeStoreKitPlatform implements TestInAppPurchaseApi { bool queueIsActive = false; Map discountReceived = {}; bool isPaymentQueueDelegateRegistered = false; + String _countryCode = 'USA'; + String _countryIdentifier = 'LL'; void reset() { transactionList = []; @@ -53,6 +55,8 @@ class FakeStoreKitPlatform implements TestInAppPurchaseApi { queueIsActive = false; discountReceived = {}; isPaymentQueueDelegateRegistered = false; + _countryCode = 'USA'; + _countryIdentifier = 'LL'; } SKPaymentTransactionWrapper createPendingTransaction(String id, @@ -163,9 +167,15 @@ class FakeStoreKitPlatform implements TestInAppPurchaseApi { } } + void setStoreFrontInfo({required String countryCode, required String identifier}) { + _countryCode = countryCode; + _countryIdentifier = identifier; + } + @override SKStorefrontMessage storefront() { - throw UnimplementedError(); + return SKStorefrontMessage( + countryCode: _countryCode, identifier: _countryIdentifier); } @override diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart index e268c23bdaa4..4dfb9626f0d2 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart @@ -570,4 +570,14 @@ void main() { expect(fakeStoreKitPlatform.queueIsActive, false); }); }); + + + group('billing configuration', () { + test('country_code', () async { + final String expectedCountryCode = 'CA'; + fakeStoreKitPlatform.setStoreFrontInfo(countryCode: expectedCountryCode, identifier: 'ABC'); + final String? countryCode = await iapStoreKitPlatform.getCountryCode(); + expect(countryCode, expectedCountryCode); + }); + }); } From 78ed2c6ad71588b4bcc85179d660731db76bebed Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Mon, 15 Apr 2024 14:19:20 -0400 Subject: [PATCH 06/18] Use const over final --- .../test/in_app_purchase_storekit_platform_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart index 4dfb9626f0d2..62ee664aa91f 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart @@ -574,7 +574,7 @@ void main() { group('billing configuration', () { test('country_code', () async { - final String expectedCountryCode = 'CA'; + const String expectedCountryCode = 'CA'; fakeStoreKitPlatform.setStoreFrontInfo(countryCode: expectedCountryCode, identifier: 'ABC'); final String? countryCode = await iapStoreKitPlatform.getCountryCode(); expect(countryCode, expectedCountryCode); From fa4630e9d1d785880ba4a2783a6a57c3c925e8b5 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Mon, 15 Apr 2024 15:05:47 -0400 Subject: [PATCH 07/18] Format --- .../test/in_app_purchase_android_platform_test.dart | 3 +-- .../test/fakes/fake_storekit_platform.dart | 3 ++- .../test/in_app_purchase_storekit_platform_test.dart | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart index c03365654c48..c5e5d628ef81 100644 --- a/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_android/test/in_app_purchase_android_platform_test.dart @@ -760,8 +760,7 @@ void main() { when(mockApi.getBillingConfigAsync()) .thenAnswer((_) async => platformBillingConfigFromWrapper(expected)); - final String countryCode = - await iapAndroidPlatform.getCountryCode(); + final String countryCode = await iapAndroidPlatform.getCountryCode(); expect(countryCode, equals(expectedCountryCode)); }); diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart index 4d1842931582..f5a755d83b55 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/fakes/fake_storekit_platform.dart @@ -167,7 +167,8 @@ class FakeStoreKitPlatform implements TestInAppPurchaseApi { } } - void setStoreFrontInfo({required String countryCode, required String identifier}) { + void setStoreFrontInfo( + {required String countryCode, required String identifier}) { _countryCode = countryCode; _countryIdentifier = identifier; } diff --git a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart index 62ee664aa91f..97d13509fdbb 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_storekit/test/in_app_purchase_storekit_platform_test.dart @@ -571,11 +571,11 @@ void main() { }); }); - group('billing configuration', () { test('country_code', () async { const String expectedCountryCode = 'CA'; - fakeStoreKitPlatform.setStoreFrontInfo(countryCode: expectedCountryCode, identifier: 'ABC'); + fakeStoreKitPlatform.setStoreFrontInfo( + countryCode: expectedCountryCode, identifier: 'ABC'); final String? countryCode = await iapStoreKitPlatform.getCountryCode(); expect(countryCode, expectedCountryCode); }); From 111daebd5e2e55b56185a970053a4f606a91b487 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Tue, 16 Apr 2024 14:10:35 -0400 Subject: [PATCH 08/18] Update packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com> --- .../in_app_purchase/in_app_purchase/lib/in_app_purchase.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart b/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart index 55493971f45f..8af047eb7340 100644 --- a/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart +++ b/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart @@ -210,7 +210,7 @@ class InAppPurchase implements InAppPurchasePlatformAdditionProvider { applicationUserName: applicationUserName, ); - /// Returns the users country. + /// Returns the user's country. /// /// Android: /// Returns Play billing country code based on ISO-3166-1 alpha2 format. From 24c2e26b2a7973cc057f93ff021229002549b303 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Tue, 16 Apr 2024 14:10:40 -0400 Subject: [PATCH 09/18] Update packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com> --- .../in_app_purchase_platform_interface/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md index 90127aa0677d..c33f22950491 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md @@ -1,6 +1,6 @@ ## 1.4.0 -* Adds getCountryCode api. +* Adds getCountryCode API. * Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. ## 1.3.7 From 4ba0db9164c6224ae0f76d76ce95b9baefb5677d Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Tue, 16 Apr 2024 14:10:44 -0400 Subject: [PATCH 10/18] Update packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart Co-authored-by: Gray Mackall <34871572+gmackall@users.noreply.github.com> --- .../lib/src/in_app_purchase_platform.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart b/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart index c967d027bc04..49065bf3b7b9 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart @@ -195,7 +195,7 @@ abstract class InAppPurchasePlatform extends PlatformInterface { Future restorePurchases({String? applicationUserName}) => throw UnimplementedError('restorePurchases() has not been implemented.'); - /// Returns the users country. + /// Returns the user's country. /// /// Android: /// Returns Play billing country code based on ISO-3166-1 alpha2 format. From 912ab088907c2d1949837390c4d377fd94080ed0 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Tue, 16 Apr 2024 14:43:15 -0400 Subject: [PATCH 11/18] Add default implementation, update in_app_purchase/in_app_purchase to have a test in addition to in_app_purchase_interface --- .../in_app_purchase/lib/in_app_purchase.dart | 3 +-- .../in_app_purchase/in_app_purchase/pubspec.yaml | 4 ++-- .../in_app_purchase/test/in_app_purchase_test.dart | 14 ++++++++++++++ .../CHANGELOG.md | 2 +- .../lib/src/in_app_purchase_platform.dart | 2 +- .../pubspec.yaml | 2 +- .../test/in_app_purchase_platform_test.dart | 12 ++++++++++++ 7 files changed, 32 insertions(+), 7 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart b/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart index 8af047eb7340..1cb3beda4e1f 100644 --- a/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart +++ b/packages/in_app_purchase/in_app_purchase/lib/in_app_purchase.dart @@ -224,6 +224,5 @@ class InAppPurchase implements InAppPurchasePlatformAdditionProvider { /// See: https://developer.apple.com/documentation/storekit/skstorefront?language=objc /// /// - Future countryCode() => - throw UnimplementedError('countryCode() has not been implemented.'); + Future countryCode() => InAppPurchasePlatform.instance.countryCode(); } diff --git a/packages/in_app_purchase/in_app_purchase/pubspec.yaml b/packages/in_app_purchase/in_app_purchase/pubspec.yaml index 7eacb06949e3..cca4c2ea3084 100644 --- a/packages/in_app_purchase/in_app_purchase/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase/pubspec.yaml @@ -5,8 +5,8 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ version: 3.2.0 environment: - sdk: ^3.1.0 - flutter: ">=3.13.0" + sdk: ^3.2.3 + flutter: ">=3.16.6" flutter: plugin: diff --git a/packages/in_app_purchase/in_app_purchase/test/in_app_purchase_test.dart b/packages/in_app_purchase/in_app_purchase/test/in_app_purchase_test.dart index 58f7398add16..6326b18f8fc6 100644 --- a/packages/in_app_purchase/in_app_purchase/test/in_app_purchase_test.dart +++ b/packages/in_app_purchase/in_app_purchase/test/in_app_purchase_test.dart @@ -55,6 +55,14 @@ void main() { ]); }); + test('countryCode', () async { + final String country = await inAppPurchase.countryCode(); + expect(country, 'USA'); + expect(fakePlatform.log, [ + isMethodCall('countryCode', arguments: null), + ]); + }); + test('purchaseStream', () async { final bool isEmptyStream = await inAppPurchase.purchaseStream.isEmpty; expect(isEmptyStream, true); @@ -192,4 +200,10 @@ class MockInAppPurchasePlatform extends Fake log.add(const MethodCall('restorePurchases')); return Future.value(); } + + @override + Future countryCode() { + log.add(const MethodCall('countryCode')); + return Future.value('USA'); + } } diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md index c33f22950491..11d14d945e75 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/CHANGELOG.md @@ -1,6 +1,6 @@ ## 1.4.0 -* Adds getCountryCode API. +* Adds `getCountryCode` API. * Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. ## 1.3.7 diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart b/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart index 49065bf3b7b9..7fd34538025a 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/lib/src/in_app_purchase_platform.dart @@ -209,6 +209,6 @@ abstract class InAppPurchasePlatform extends PlatformInterface { /// See: https://developer.apple.com/documentation/storekit/skstorefront?language=objc /// /// - Future countryCode() => + Future countryCode() => throw UnimplementedError('countryCode() has not been implemented.'); } diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml index a85144696cf8..35fc0488d9d0 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/pubspec.yaml @@ -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 diff --git a/packages/in_app_purchase/in_app_purchase_platform_interface/test/in_app_purchase_platform_test.dart b/packages/in_app_purchase/in_app_purchase_platform_interface/test/in_app_purchase_platform_test.dart index 0a79e99041d6..5ae13ade1bbc 100644 --- a/packages/in_app_purchase/in_app_purchase_platform_interface/test/in_app_purchase_platform_test.dart +++ b/packages/in_app_purchase/in_app_purchase_platform_interface/test/in_app_purchase_platform_test.dart @@ -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', () { From 008d9f685fc854cef595bf289534118641cedcd6 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Wed, 17 Apr 2024 11:38:07 -0400 Subject: [PATCH 12/18] Update version codes --- packages/in_app_purchase/in_app_purchase/pubspec.yaml | 7 +------ .../in_app_purchase_android/CHANGELOG.md | 2 +- .../in_app_purchase_android/pubspec.yaml | 10 ++-------- .../in_app_purchase_storekit/pubspec.yaml | 5 ----- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/pubspec.yaml b/packages/in_app_purchase/in_app_purchase/pubspec.yaml index cca4c2ea3084..3f31fcd2e414 100644 --- a/packages/in_app_purchase/in_app_purchase/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase/pubspec.yaml @@ -23,7 +23,7 @@ dependencies: sdk: flutter in_app_purchase_android: ^0.3.4 in_app_purchase_platform_interface: ^1.4.0 - in_app_purchase_storekit: ^0.3.4 + in_app_purchase_storekit: ^0.3.14 dev_dependencies: flutter_test: @@ -42,8 +42,3 @@ screenshots: path: doc/iap_ios.gif - description: 'Example of in-app purchase on android' path: doc/iap_android.gif - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins -dependency_overrides: - {in_app_purchase_android: {path: ../../in_app_purchase/in_app_purchase_android}, in_app_purchase_platform_interface: {path: ../../in_app_purchase/in_app_purchase_platform_interface}, in_app_purchase_storekit: {path: ../../in_app_purchase/in_app_purchase_storekit}} diff --git a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md index 20d700ac410d..444aee39be0b 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.3.4 -* Adds `countryCode` API. +* Adds `countryCode` API. ## 0.3.3+1 diff --git a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml index cb4070c43152..df503ae9d822 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml @@ -2,12 +2,11 @@ name: in_app_purchase_android description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 - version: 0.3.4 environment: - sdk: ^3.1.0 - flutter: ">=3.13.0" + sdk: ^3.2.3 + flutter: ">=3.16.6" flutter: plugin: @@ -36,8 +35,3 @@ dev_dependencies: topics: - in-app-purchase - payment - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins -dependency_overrides: - {in_app_purchase_platform_interface: {path: ../../in_app_purchase/in_app_purchase_platform_interface}} diff --git a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml index fd7d3467837e..d20cdec6ff15 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_storekit/pubspec.yaml @@ -37,8 +37,3 @@ dev_dependencies: topics: - in-app-purchase - payment - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins -dependency_overrides: - {in_app_purchase_platform_interface: {path: ../../in_app_purchase/in_app_purchase_platform_interface}} From 5938e263efbb39396f811591f39fd5fc07307802 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Wed, 17 Apr 2024 15:38:25 -0400 Subject: [PATCH 13/18] Remove dependency override for top line example --- .../in_app_purchase/in_app_purchase/example/pubspec.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml b/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml index f5c143968daa..19cd0fd9ffe7 100644 --- a/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml @@ -28,8 +28,3 @@ dev_dependencies: flutter: uses-material-design: true - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins -dependency_overrides: - {in_app_purchase_android: {path: ../../../in_app_purchase/in_app_purchase_android}, in_app_purchase_platform_interface: {path: ../../../in_app_purchase/in_app_purchase_platform_interface}, in_app_purchase_storekit: {path: ../../../in_app_purchase/in_app_purchase_storekit}} From 277949bca61f0986c8aef849f1828a541ab02c60 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Wed, 17 Apr 2024 15:39:25 -0400 Subject: [PATCH 14/18] Update changelog --- packages/in_app_purchase/in_app_purchase/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md index 728a85ebf487..2cd388006e8f 100644 --- a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md @@ -1,5 +1,6 @@ -## NEXT +## 3.2.0 +* Adds `countryCode` API. * Updates minimum supported SDK version to Flutter 3.13/Dart 3.1. * Updates support matrix in README to indicate that iOS 11 is no longer supported. * Clients on versions of Flutter that still support iOS 11 can continue to use this From 41a49407abbbf6f6395fd6ec575ebae799f57e52 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Wed, 17 Apr 2024 15:44:13 -0400 Subject: [PATCH 15/18] revert pubspec changes --- .../in_app_purchase_android/example/pubspec.yaml | 5 ----- .../in_app_purchase/in_app_purchase_android/pubspec.yaml | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml index 3ad6a49ef090..9239f83a0a31 100644 --- a/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/example/pubspec.yaml @@ -28,8 +28,3 @@ dev_dependencies: flutter: uses-material-design: true - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins -dependency_overrides: - {in_app_purchase_android: {path: ../../../in_app_purchase/in_app_purchase_android}, in_app_purchase_platform_interface: {path: ../../../in_app_purchase/in_app_purchase_platform_interface}} diff --git a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml index df503ae9d822..91b8f61208b1 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml @@ -5,8 +5,8 @@ issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+ version: 0.3.4 environment: - sdk: ^3.2.3 - flutter: ">=3.16.6" + sdk: ^3.1.0 + flutter: ">=3.13.0" flutter: plugin: From 7961981975b395f2f34b7587565e97d807a0b1b3 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Wed, 17 Apr 2024 15:45:05 -0400 Subject: [PATCH 16/18] revert pubspec changes --- .../in_app_purchase_storekit/example/pubspec.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase_storekit/example/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_storekit/example/pubspec.yaml index a81524ac7527..2062efd0fb70 100644 --- a/packages/in_app_purchase/in_app_purchase_storekit/example/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_storekit/example/pubspec.yaml @@ -27,8 +27,3 @@ dev_dependencies: flutter: uses-material-design: true - -# FOR TESTING AND INITIAL REVIEW ONLY. DO NOT MERGE. -# See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#changing-federated-plugins -dependency_overrides: - {in_app_purchase_platform_interface: {path: ../../../in_app_purchase/in_app_purchase_platform_interface}, in_app_purchase_storekit: {path: ../../../in_app_purchase/in_app_purchase_storekit}} From 7f17bbd818792862e73f9fef11ba4b96b8c10619 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Wed, 17 Apr 2024 16:04:40 -0400 Subject: [PATCH 17/18] formatting --- .../in_app_purchase/test/in_app_purchase_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase/test/in_app_purchase_test.dart b/packages/in_app_purchase/in_app_purchase/test/in_app_purchase_test.dart index 6326b18f8fc6..c4ed81988991 100644 --- a/packages/in_app_purchase/in_app_purchase/test/in_app_purchase_test.dart +++ b/packages/in_app_purchase/in_app_purchase/test/in_app_purchase_test.dart @@ -201,7 +201,7 @@ class MockInAppPurchasePlatform extends Fake return Future.value(); } - @override + @override Future countryCode() { log.add(const MethodCall('countryCode')); return Future.value('USA'); From 750131c54adfe08c8c87186a8e3b02cfdfac73f4 Mon Sep 17 00:00:00 2001 From: Reid Baker Date: Wed, 17 Apr 2024 16:06:37 -0400 Subject: [PATCH 18/18] Leave android alone --- packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md | 2 +- packages/in_app_purchase/in_app_purchase_android/pubspec.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md index 444aee39be0b..20d700ac410d 100644 --- a/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md +++ b/packages/in_app_purchase/in_app_purchase_android/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.3.4 -* Adds `countryCode` API. +* Adds `countryCode` API. ## 0.3.3+1 diff --git a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml index 91b8f61208b1..6950533f1caf 100644 --- a/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase_android/pubspec.yaml @@ -2,6 +2,7 @@ name: in_app_purchase_android description: An implementation for the Android platform of the Flutter `in_app_purchase` plugin. This uses the Android BillingClient APIs. repository: https://github.com/flutter/packages/tree/main/packages/in_app_purchase/in_app_purchase_android issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22 + version: 0.3.4 environment: