From caf1e1856a7db1fdce5f54cc550fdcfc28d25f95 Mon Sep 17 00:00:00 2001 From: Vishnu Mohandas Date: Tue, 26 Jan 2021 17:35:23 +0530 Subject: [PATCH] Fix subscription page issues on iOS --- lib/ui/subscription_page.dart | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib/ui/subscription_page.dart b/lib/ui/subscription_page.dart index b2002ace4..338d6a2d1 100644 --- a/lib/ui/subscription_page.dart +++ b/lib/ui/subscription_page.dart @@ -31,7 +31,7 @@ class _SubscriptionPageState extends State { .instance.purchaseUpdatedStream .listen((event) async { for (final e in event) { - if (e.status == PurchaseStatus.purchased && e.pendingCompletePurchase) { + if (e.status == PurchaseStatus.purchased) { final dialog = createProgressDialog(context, "verifying purchase..."); await dialog.show(); try { @@ -51,14 +51,9 @@ class _SubscriptionPageState extends State { await InAppPurchaseConnection.instance.completePurchase(e); Bus.instance.fire(UserAuthenticatedEvent()); await dialog.hide(); - Navigator.pop(context); AlertDialog alert = AlertDialog( - title: Text("success"), - content: Column( - children: [ - Text("thank you, your photos and videos will now be backed up"), - ], - ), + title: Text("thank you"), + content: Text("your photos and videos will now be backed up"), actions: [ FlatButton( child: Text("ok"), @@ -68,6 +63,7 @@ class _SubscriptionPageState extends State { ), ], ); + Navigator.pop(context); showDialog( context: context, @@ -75,7 +71,7 @@ class _SubscriptionPageState extends State { return alert; }, ); - } else if (Platform.isIOS) { + } else if (Platform.isIOS && e.pendingCompletePurchase) { await InAppPurchaseConnection.instance.completePurchase(e); } } @@ -180,7 +176,7 @@ class _SubscriptionPageState extends State { child: Text( "we offer a 14 day free trial, you can cancel anytime", style: TextStyle( - color: Colors.white54, + color: Colors.white, height: 1.2, ), ),