diff --git a/lib/config.dart b/lib/config.dart new file mode 100644 index 0000000000000000000000000000000000000000..ccf766c887d92f8d4ba916bbc37ab14caa0e0212 --- /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 1e02d1a8f162f36fbd941cde33ed93cf623f8fe4..1ad3333874a3684ff7b82584d1c4a2da85ea2959 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(