mirror of
https://github.com/flutter/packages.git
synced 2025-07-03 00:49:32 +08:00
[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.
This commit is contained in:
@ -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.
|
* Updates minimum supported SDK version to Flutter 3.3/Dart 2.18.
|
||||||
* Aligns Dart and Flutter SDK constraints.
|
* Aligns Dart and Flutter SDK constraints.
|
||||||
|
|
||||||
|
@ -261,16 +261,14 @@ class _MyAppState extends State<_MyApp> {
|
|||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
productDetails.description,
|
productDetails.description,
|
||||||
),
|
),
|
||||||
trailing: previousPurchase != null
|
trailing: previousPurchase != null && Platform.isIOS
|
||||||
? IconButton(
|
? IconButton(
|
||||||
onPressed: () => confirmPriceChange(context),
|
onPressed: () => confirmPriceChange(context),
|
||||||
icon: const Icon(Icons.upgrade))
|
icon: const Icon(Icons.upgrade))
|
||||||
: TextButton(
|
: TextButton(
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
backgroundColor: Colors.green[800],
|
backgroundColor: Colors.green[800],
|
||||||
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
|
foregroundColor: Colors.white,
|
||||||
// ignore: deprecated_member_use
|
|
||||||
primary: Colors.white,
|
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
late PurchaseParam purchaseParam;
|
late PurchaseParam purchaseParam;
|
||||||
@ -369,9 +367,7 @@ class _MyAppState extends State<_MyApp> {
|
|||||||
TextButton(
|
TextButton(
|
||||||
style: TextButton.styleFrom(
|
style: TextButton.styleFrom(
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
|
foregroundColor: Colors.white,
|
||||||
// ignore: deprecated_member_use
|
|
||||||
primary: Colors.white,
|
|
||||||
),
|
),
|
||||||
onPressed: () => _inAppPurchase.restorePurchases(),
|
onPressed: () => _inAppPurchase.restorePurchases(),
|
||||||
child: const Text('Restore purchases'),
|
child: const Text('Restore purchases'),
|
||||||
@ -462,29 +458,10 @@ class _MyAppState extends State<_MyApp> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> confirmPriceChange(BuildContext context) async {
|
Future<void> confirmPriceChange(BuildContext context) async {
|
||||||
if (Platform.isAndroid) {
|
// Price changes for Android are not handled by the application, but are
|
||||||
final InAppPurchaseAndroidPlatformAddition androidAddition =
|
// instead handled by the Play Store. See
|
||||||
_inAppPurchase
|
// https://developer.android.com/google/play/billing/price-changes for more
|
||||||
.getPlatformAddition<InAppPurchaseAndroidPlatformAddition>();
|
// information on price changes on Android.
|
||||||
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}',
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (Platform.isIOS) {
|
if (Platform.isIOS) {
|
||||||
final InAppPurchaseStoreKitPlatformAddition iapStoreKitPlatformAddition =
|
final InAppPurchaseStoreKitPlatformAddition iapStoreKitPlatformAddition =
|
||||||
_inAppPurchase
|
_inAppPurchase
|
||||||
|
@ -16,7 +16,7 @@ dependencies:
|
|||||||
# The example app is bundled with the plugin so we use a path dependency on
|
# 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.
|
# the parent directory to use the current plugin's version.
|
||||||
path: ../
|
path: ../
|
||||||
in_app_purchase_android: ^0.2.1
|
in_app_purchase_android: ^0.3.0
|
||||||
in_app_purchase_storekit: ^0.3.4
|
in_app_purchase_storekit: ^0.3.4
|
||||||
shared_preferences: ^2.0.0
|
shared_preferences: ^2.0.0
|
||||||
|
|
||||||
|
@ -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.
|
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
|
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
|
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:
|
environment:
|
||||||
sdk: ">=2.18.0 <4.0.0"
|
sdk: ">=2.18.0 <4.0.0"
|
||||||
@ -21,7 +21,7 @@ flutter:
|
|||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: 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_platform_interface: ^1.0.0
|
||||||
in_app_purchase_storekit: ^0.3.4
|
in_app_purchase_storekit: ^0.3.4
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user