diff --git a/lib/main_dev.dart b/lib/main_dev.dart index 5a819cf..944fc48 100644 --- a/lib/main_dev.dart +++ b/lib/main_dev.dart @@ -7,11 +7,13 @@ import 'package:comunic/models/config.dart'; void main() { Config.set(Config( - apiServerName: "devweb.local", - apiServerUri: "/comunic/api/", - apiServerSecure: false, - serviceName: "ComunicFlutter", - serviceToken: "G9sZCBmb3IgVWJ1bnR1CkNvbW1lbnRbbmVdPeCkieCkrOCkq")); + apiServerName: "devweb.local", + apiServerUri: "/comunic/api/", + apiServerSecure: false, + serviceName: "ComunicFlutter", + serviceToken: "G9sZCBmb3IgVWJ1bnR1CkNvbW1lbnRbbmVdPeCkieCkrOCkq", + termOfServicesURL: "http://devweb.local/comunic/current/about.php?cgu", + )); subMain(); } diff --git a/lib/models/config.dart b/lib/models/config.dart index 249468b..fdac4af 100644 --- a/lib/models/config.dart +++ b/lib/models/config.dart @@ -11,18 +11,21 @@ class Config { final bool apiServerSecure; final String serviceName; final String serviceToken; + final String termOfServicesURL; - const Config( - {@required this.apiServerName, - @required this.apiServerUri, - @required this.apiServerSecure, - @required this.serviceName, - @required this.serviceToken}) - : assert(apiServerName != null), + const Config({ + @required this.apiServerName, + @required this.apiServerUri, + @required this.apiServerSecure, + @required this.serviceName, + @required this.serviceToken, + @required this.termOfServicesURL, + }) : assert(apiServerName != null), assert(apiServerUri != null), assert(apiServerSecure != null), assert(serviceName != null), - assert(serviceToken != null); + assert(serviceToken != null), + assert(termOfServicesURL != null); /// Get and set static configuration static Config _config; diff --git a/lib/ui/routes/create_account_route.dart b/lib/ui/routes/create_account_route.dart index aa2dfe0..d9450c3 100644 --- a/lib/ui/routes/create_account_route.dart +++ b/lib/ui/routes/create_account_route.dart @@ -1,6 +1,8 @@ +import 'package:comunic/models/config.dart'; import 'package:comunic/utils/input_utils.dart'; import 'package:comunic/utils/intl_utils.dart'; import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher.dart'; /// Create account route /// @@ -132,6 +134,10 @@ class __CreateAccountRouteBodyState extends State<_CreateAccountRouteBody> { ) : null, controlAffinity: ListTileControlAffinity.leading, + secondary: IconButton( + icon: Icon(Icons.open_in_new), + onPressed: _openTOS, + ), ), // Submit button @@ -161,6 +167,10 @@ class __CreateAccountRouteBodyState extends State<_CreateAccountRouteBody> { return; } } + + void _openTOS() { + launch(config().termOfServicesURL); + } } class _InputEntry extends StatelessWidget {