瀏覽代碼

Add deep link to manage payments

Vishnu Mohandas 4 年之前
父節點
當前提交
0420796660
共有 1 個文件被更改,包括 54 次插入24 次删除
  1. 54 24
      lib/ui/subscription_page.dart

+ 54 - 24
lib/ui/subscription_page.dart

@@ -17,6 +17,7 @@ import 'package:photos/utils/date_time_util.dart';
 import 'package:photos/utils/dialog_util.dart';
 import 'package:photos/utils/dialog_util.dart';
 import 'package:photos/utils/toast_util.dart';
 import 'package:photos/utils/toast_util.dart';
 import 'package:progress_dialog/progress_dialog.dart';
 import 'package:progress_dialog/progress_dialog.dart';
+import 'package:url_launcher/url_launcher.dart';
 
 
 class SubscriptionPage extends StatefulWidget {
 class SubscriptionPage extends StatefulWidget {
   const SubscriptionPage({Key key}) : super(key: key);
   const SubscriptionPage({Key key}) : super(key: key);
@@ -218,36 +219,65 @@ class _SubscriptionPageState extends State<SubscriptionPage> {
             ),
             ),
           ),
           ),
         ),
         ),
+        Expanded(child: Container()),
+        Align(
+          alignment: Alignment.center,
+          child: GestureDetector(
+            onTap: () {
+              showDialog(
+                context: context,
+                builder: (builder) {
+                  return LearnMoreWidget();
+                },
+              );
+            },
+            child: Container(
+              padding: EdgeInsets.all(80),
+              child: RichText(
+                text: TextSpan(
+                  text: "learn more",
+                  style: TextStyle(
+                    color: Colors.blue,
+                    fontFamily: 'Ubuntu',
+                  ),
+                ),
+              ),
+            ),
+          ),
+        ),
       ]);
       ]);
-    }
-    widgets.addAll([
-      Expanded(child: Container()),
-      Align(
-        alignment: Alignment.center,
-        child: GestureDetector(
-          onTap: () {
-            showDialog(
-              context: context,
-              builder: (builder) {
-                return LearnMoreWidget();
-              },
-            );
-          },
-          child: Container(
-            padding: EdgeInsets.all(80),
-            child: RichText(
-              text: TextSpan(
-                text: "learn more",
-                style: TextStyle(
-                  color: Colors.blue,
-                  fontFamily: 'Ubuntu',
+    } else {
+      widgets.addAll([
+        Expanded(child: Container()),
+        Align(
+          alignment: Alignment.center,
+          child: GestureDetector(
+            onTap: () {
+              if (Platform.isAndroid) {
+                launch(
+                    "https://play.google.com/store/account/subscriptions?sku=" +
+                        _currentSubscription.productID +
+                        "&package=io.ente.photos");
+              } else {
+                launch("https://apps.apple.com/account/billing");
+              }
+            },
+            child: Container(
+              padding: EdgeInsets.all(80),
+              child: RichText(
+                text: TextSpan(
+                  text: "payment details",
+                  style: TextStyle(
+                    color: Colors.blue,
+                    fontFamily: 'Ubuntu',
+                  ),
                 ),
                 ),
               ),
               ),
             ),
             ),
           ),
           ),
         ),
         ),
-      ),
-    ]);
+      ]);
+    }
     return SingleChildScrollView(
     return SingleChildScrollView(
       child: Container(
       child: Container(
         height: pageSize - (appBarSize + notifySize),
         height: pageSize - (appBarSize + notifySize),