Skip to content

Commit fe31e52

Browse files
authored
Handle restored purchases in iOS example app (flutter#4392)
1 parent 1ef4405 commit fe31e52

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

packages/in_app_purchase/in_app_purchase_ios/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## NEXT
1+
## 0.1.3+5
22

3+
* Updated example app to handle restored purchases properly.
34
* Update dev_dependency `build_runner` to ^2.0.0 and `json_serializable` to ^5.0.2.
45

56
## 0.1.3+4

packages/in_app_purchase/in_app_purchase_ios/example/lib/main.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ class _MyAppState extends State<_MyApp> {
399399
} else {
400400
if (purchaseDetails.status == PurchaseStatus.error) {
401401
handleError(purchaseDetails.error!);
402-
} else if (purchaseDetails.status == PurchaseStatus.purchased) {
402+
} else if (purchaseDetails.status == PurchaseStatus.purchased ||
403+
purchaseDetails.status == PurchaseStatus.restored) {
403404
bool valid = await _verifyPurchase(purchaseDetails);
404405
if (valid) {
405406
deliverProduct(purchaseDetails);

packages/in_app_purchase/in_app_purchase_ios/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: in_app_purchase_ios
22
description: An implementation for the iOS platform of the Flutter `in_app_purchase` plugin. This uses the iOS StoreKit Framework.
33
repository: https://github.com/flutter/plugins/tree/master/packages/in_app_purchase/in_app_purchase_ios
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+in_app_purchase%22
5-
version: 0.1.3+4
5+
version: 0.1.3+5
66

77
environment:
88
sdk: ">=2.14.0 <3.0.0"

0 commit comments

Comments
 (0)