mirror of
https://github.com/flutter/packages.git
synced 2025-07-01 23:51:55 +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.
|
||||
* Aligns Dart and Flutter SDK constraints.
|
||||
|
||||
|
@ -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<void> confirmPriceChange(BuildContext context) async {
|
||||
if (Platform.isAndroid) {
|
||||
final InAppPurchaseAndroidPlatformAddition androidAddition =
|
||||
_inAppPurchase
|
||||
.getPlatformAddition<InAppPurchaseAndroidPlatformAddition>();
|
||||
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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user