From c43cc13498a1a1c4f3d1b8af2add9ce7c15bd6d0 Mon Sep 17 00:00:00 2001 From: Jeroen Weener Date: Tue, 23 May 2023 22:19:34 +0200 Subject: [PATCH] [in_app_purchase] Bump `in_app_purchase_android` dependency to 3.0.0 (#4065) Bumps `in_app_purchase_android` to 3.0.0. This PR is the final step for closing flutter/flutter#110909. --- .../in_app_purchase/CHANGELOG.md | 3 +- .../in_app_purchase/example/lib/main.dart | 37 ++++--------------- .../in_app_purchase/example/pubspec.yaml | 2 +- .../in_app_purchase/pubspec.yaml | 4 +- 4 files changed, 12 insertions(+), 34 deletions(-) diff --git a/packages/in_app_purchase/in_app_purchase/CHANGELOG.md b/packages/in_app_purchase/in_app_purchase/CHANGELOG.md index c049d007a9..b77b4f6443 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.1.6 +* Bumps minimum in_app_purchase_android version to 0.3.0. * Updates minimum supported SDK version to Flutter 3.3/Dart 2.18. * Aligns Dart and Flutter SDK constraints. diff --git a/packages/in_app_purchase/in_app_purchase/example/lib/main.dart b/packages/in_app_purchase/in_app_purchase/example/lib/main.dart index 21268d4e7e..d43f0f5fd1 100644 --- a/packages/in_app_purchase/in_app_purchase/example/lib/main.dart +++ b/packages/in_app_purchase/in_app_purchase/example/lib/main.dart @@ -261,16 +261,14 @@ class _MyAppState extends State<_MyApp> { subtitle: Text( productDetails.description, ), - trailing: previousPurchase != null + trailing: previousPurchase != null && Platform.isIOS ? IconButton( onPressed: () => confirmPriceChange(context), icon: const Icon(Icons.upgrade)) : TextButton( style: TextButton.styleFrom( backgroundColor: Colors.green[800], - // TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724 - // ignore: deprecated_member_use - primary: Colors.white, + foregroundColor: Colors.white, ), onPressed: () { late PurchaseParam purchaseParam; @@ -369,9 +367,7 @@ class _MyAppState extends State<_MyApp> { TextButton( style: TextButton.styleFrom( backgroundColor: Theme.of(context).primaryColor, - // TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724 - // ignore: deprecated_member_use - primary: Colors.white, + foregroundColor: Colors.white, ), onPressed: () => _inAppPurchase.restorePurchases(), child: const Text('Restore purchases'), @@ -462,29 +458,10 @@ class _MyAppState extends State<_MyApp> { } Future confirmPriceChange(BuildContext context) async { - if (Platform.isAndroid) { - final InAppPurchaseAndroidPlatformAddition androidAddition = - _inAppPurchase - .getPlatformAddition(); - final BillingResultWrapper priceChangeConfirmationResult = - await androidAddition.launchPriceChangeConfirmationFlow( - sku: 'purchaseId', - ); - if (context.mounted) { - if (priceChangeConfirmationResult.responseCode == BillingResponse.ok) { - ScaffoldMessenger.of(context).showSnackBar(const SnackBar( - content: Text('Price change accepted'), - )); - } else { - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - priceChangeConfirmationResult.debugMessage ?? - 'Price change failed with code ${priceChangeConfirmationResult.responseCode}', - ), - )); - } - } - } + // Price changes for Android are not handled by the application, but are + // instead handled by the Play Store. See + // https://developer.android.com/google/play/billing/price-changes for more + // information on price changes on Android. if (Platform.isIOS) { final InAppPurchaseStoreKitPlatformAddition iapStoreKitPlatformAddition = _inAppPurchase 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 e3c891e822..7592c5381e 100644 --- a/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml +++ b/packages/in_app_purchase/in_app_purchase/example/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: # The example app is bundled with the plugin so we use a path dependency on # the parent directory to use the current plugin's version. path: ../ - in_app_purchase_android: ^0.2.1 + in_app_purchase_android: ^0.3.0 in_app_purchase_storekit: ^0.3.4 shared_preferences: ^2.0.0 diff --git a/packages/in_app_purchase/in_app_purchase/pubspec.yaml b/packages/in_app_purchase/in_app_purchase/pubspec.yaml index d873338e28..48366cd0a8 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.5 +version: 3.1.6 environment: sdk: ">=2.18.0 <4.0.0" @@ -21,7 +21,7 @@ flutter: dependencies: flutter: sdk: flutter - in_app_purchase_android: ^0.2.3 + in_app_purchase_android: ^0.3.0 in_app_purchase_platform_interface: ^1.0.0 in_app_purchase_storekit: ^0.3.4