From 7ca0e58641c9a711136144ed4fc9e82c43315642 Mon Sep 17 00:00:00 2001
From: igorwork <markin.io210@gmail.com>
Date: Fri, 19 Jul 2019 18:38:00 +0300
Subject: [PATCH] Add config.

---
 lib/config.dart       |  1 +
 lib/screens/home.dart | 17 ++++++++---------
 2 files changed, 9 insertions(+), 9 deletions(-)
 create mode 100644 lib/config.dart

diff --git a/lib/config.dart b/lib/config.dart
new file mode 100644
index 0000000..ccf766c
--- /dev/null
+++ b/lib/config.dart
@@ -0,0 +1 @@
+const String APP_HOST = "https://demo1.vereign.com";
\ No newline at end of file
diff --git a/lib/screens/home.dart b/lib/screens/home.dart
index 1e02d1a..1ad3333 100644
--- a/lib/screens/home.dart
+++ b/lib/screens/home.dart
@@ -5,6 +5,8 @@ import 'package:url_launcher/url_launcher.dart';
 import 'dart:developer';
 import 'dart:convert';
 
+import '../config.dart';
+
 class Home extends StatefulWidget {
   Home({@required this.mode, @required this.invokerURL, @required this.setMode});
   final String mode;
@@ -19,12 +21,10 @@ String clientId = "222222";
 String clientSecret = "22222222";
 
 String redirectURL = "app://com.vereign.app/oauth2";
-String authEndpoint = "https://gospodinbodurov.dev.vereign.com/api/oauth2/authorize";
-String tokenEndpoint = "https://gospodinbodurov.dev.vereign.com/api/oauth2/token";
+String authEndpoint = "$APP_HOST/api/oauth2/authorize";
+String tokenEndpoint = "$APP_HOST/api/oauth2/token";
 
 class _HomeState extends State<Home> {
-  final _links = ['vereign://app.vereign.com', 'vereign://app.vereign.com/oauth2', 'testredirect://app.vereign.com', 'https://igormarkin.dev.vereign.com', 'https://gospodinbodurov.dev.vereign.com'];
-
   @override
   initState() {
     super.initState();
@@ -84,7 +84,7 @@ class _HomeState extends State<Home> {
   }
 
   openVereign() {
-    FlutterWebBrowser.openWebPage(url: 'https://gospodinbodurov.dev.vereign.com', androidToolbarColor: Color(0xFFd51d32));
+    FlutterWebBrowser.openWebPage(url: APP_HOST, androidToolbarColor: Color(0xFFd51d32));
   }
 
   startOAuth() {
@@ -115,14 +115,13 @@ class _HomeState extends State<Home> {
                 child: Column(
                   mainAxisAlignment: MainAxisAlignment.center,
                   crossAxisAlignment: CrossAxisAlignment.stretch,
-//                  children: _links.map((link) => _urlButton(context, link)).toList(),
                   children: <Widget>[
-                    _urlButton(context, _links[0], "Open Dashboard", openVereign),
-                    _urlButton(context, _links[1], "Authorize with Vereign", startOAuth),
+                    _urlButton(context, "Open Dashboard", openVereign),
+                    _urlButton(context, "Authorize with Vereign", startOAuth),
                   ]
                 ))));
   }
-  Widget _urlButton(BuildContext context, String url, String title, listener) {
+  Widget _urlButton(BuildContext context, String title, listener) {
     return Container(
         padding: EdgeInsets.all(20.0),
         child: FlatButton(
-- 
GitLab