From 0815840a9c3c05aa4fc023ef8cffc0e1102ba54c Mon Sep 17 00:00:00 2001 From: estevez-dev Date: Fri, 23 Aug 2019 14:13:58 +0300 Subject: [PATCH] WIP #412 --- lib/main.dart | 12 ++++++++++ lib/purchase.page.dart | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 lib/purchase.page.dart diff --git a/lib/main.dart b/lib/main.dart index c7b74b9..17754e4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -86,6 +86,7 @@ part 'entity_widgets/controls/media_player_widgets.dart'; part 'entity_widgets/controls/fan_controls.dart'; part 'entity_widgets/controls/alarm_control_panel_controls.dart'; part 'settings.page.dart'; +part 'purchase.page.dart'; part 'panel.page.dart'; part 'home_assistant.class.dart'; part 'log.page.dart'; @@ -148,6 +149,7 @@ class HAClientApp extends StatelessWidget { "/": (context) => MainPage(title: 'HA Client', homeAssistant: homeAssistant,), "/connection-settings": (context) => ConnectionSettingsPage(title: "Settings"), "/configuration": (context) => PanelPage(title: "Configuration"), + "/putchase": (context) => PurchasePage(title: "Support app development"), "/log-view": (context) => LogViewPage(title: "Log"), "/login": (_) => WebviewScaffold( url: "${Connection().oauthUrl}", @@ -532,6 +534,15 @@ class _MainPageState extends State with WidgetsBindingObserver, Ticker }, ), Divider(), + new ListTile( + leading: Icon(Icons.insert_drive_file), + title: Text("Support app development"), + onTap: () { + Navigator.of(context).pop(); + Navigator.of(context).pushNamed('/putchase'); + }, + ), + Divider(), new ListTile( leading: Icon(Icons.help), title: Text("Help"), @@ -872,6 +883,7 @@ class _MainPageState extends State with WidgetsBindingObserver, Ticker _showEntityPageSubscription?.cancel(); _showErrorSubscription?.cancel(); _startAuthSubscription?.cancel(); + _subscription?.cancel(); _reloadUISubscription?.cancel(); //TODO disconnect //widget.homeAssistant?.disconnect(); diff --git a/lib/purchase.page.dart b/lib/purchase.page.dart new file mode 100644 index 0000000..9889c48 --- /dev/null +++ b/lib/purchase.page.dart @@ -0,0 +1,53 @@ +part of 'main.dart'; + +class PurchasePage extends StatefulWidget { + PurchasePage({Key key, this.title}) : super(key: key); + + final String title; + + @override + _PurchasePageState createState() => new _PurchasePageState(); +} + +class _PurchasePageState extends State { + + + @override + void initState() { + super.initState(); + _loadProducts(); + } + + _loadProducts() async { + const Set _kIds = {'flat_white_a_month', 'lunch_a_month22'}; + final ProductDetailsResponse response = await InAppPurchaseConnection.instance.queryProductDetails(_kIds); + if (!response.notFoundIDs.isEmpty) { + Logger.d("Not found products: ${response.notFoundIDs}"); + } + List products = response.productDetails; + for (ProductDetails product in products) { + Logger.d("Product: ${product}"); + } + } + + @override + Widget build(BuildContext context) { + return new Scaffold( + appBar: new AppBar( + leading: IconButton(icon: Icon(Icons.arrow_back), onPressed: (){ + Navigator.pop(context); + }), + title: new Text(widget.title), + actions: [ + IconButton( + icon: Icon(Icons.content_copy), + onPressed: () { + // + }, + ) + ], + ), + body: Text("Hi!"), + ); + } +} \ No newline at end of file