Skip to content
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
3 changes: 2 additions & 1 deletion packages/in_app_purchase/in_app_purchase/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
37 changes: 7 additions & 30 deletions packages/in_app_purchase/in_app_purchase/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions packages/in_app_purchase/in_app_purchase/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down