Skip to content
Snippets Groups Projects
Commit 7ca0e586 authored by igorwork's avatar igorwork Committed by Markin Igor
Browse files

Add config.

parent d7ede746
No related branches found
No related tags found
1 merge request!1Mobile app initial implementation.
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
const String APP_HOST = "https://demo1.vereign.com";
\ No newline at end of file
...@@ -5,6 +5,8 @@ import 'package:url_launcher/url_launcher.dart'; ...@@ -5,6 +5,8 @@ import 'package:url_launcher/url_launcher.dart';
import 'dart:developer'; import 'dart:developer';
import 'dart:convert'; import 'dart:convert';
import '../config.dart';
class Home extends StatefulWidget { class Home extends StatefulWidget {
Home({@required this.mode, @required this.invokerURL, @required this.setMode}); Home({@required this.mode, @required this.invokerURL, @required this.setMode});
final String mode; final String mode;
...@@ -19,12 +21,10 @@ String clientId = "222222"; ...@@ -19,12 +21,10 @@ String clientId = "222222";
String clientSecret = "22222222"; String clientSecret = "22222222";
String redirectURL = "app://com.vereign.app/oauth2"; String redirectURL = "app://com.vereign.app/oauth2";
String authEndpoint = "https://gospodinbodurov.dev.vereign.com/api/oauth2/authorize"; String authEndpoint = "$APP_HOST/api/oauth2/authorize";
String tokenEndpoint = "https://gospodinbodurov.dev.vereign.com/api/oauth2/token"; String tokenEndpoint = "$APP_HOST/api/oauth2/token";
class _HomeState extends State<Home> { 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 @override
initState() { initState() {
super.initState(); super.initState();
...@@ -84,7 +84,7 @@ class _HomeState extends State<Home> { ...@@ -84,7 +84,7 @@ class _HomeState extends State<Home> {
} }
openVereign() { openVereign() {
FlutterWebBrowser.openWebPage(url: 'https://gospodinbodurov.dev.vereign.com', androidToolbarColor: Color(0xFFd51d32)); FlutterWebBrowser.openWebPage(url: APP_HOST, androidToolbarColor: Color(0xFFd51d32));
} }
startOAuth() { startOAuth() {
...@@ -115,14 +115,13 @@ class _HomeState extends State<Home> { ...@@ -115,14 +115,13 @@ class _HomeState extends State<Home> {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
// children: _links.map((link) => _urlButton(context, link)).toList(),
children: <Widget>[ children: <Widget>[
_urlButton(context, _links[0], "Open Dashboard", openVereign), _urlButton(context, "Open Dashboard", openVereign),
_urlButton(context, _links[1], "Authorize with Vereign", startOAuth), _urlButton(context, "Authorize with Vereign", startOAuth),
] ]
)))); ))));
} }
Widget _urlButton(BuildContext context, String url, String title, listener) { Widget _urlButton(BuildContext context, String title, listener) {
return Container( return Container(
padding: EdgeInsets.all(20.0), padding: EdgeInsets.all(20.0),
child: FlatButton( child: FlatButton(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment