1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 12:59:21 +00:00

Can open Term Of Service from Create Account Page.

This commit is contained in:
Pierre HUBERT 2019-11-02 18:16:16 +01:00
parent 0162224b7f
commit 32a32224ca
3 changed files with 28 additions and 13 deletions

View File

@ -7,11 +7,13 @@ import 'package:comunic/models/config.dart';
void main() { void main() {
Config.set(Config( Config.set(Config(
apiServerName: "devweb.local", apiServerName: "devweb.local",
apiServerUri: "/comunic/api/", apiServerUri: "/comunic/api/",
apiServerSecure: false, apiServerSecure: false,
serviceName: "ComunicFlutter", serviceName: "ComunicFlutter",
serviceToken: "G9sZCBmb3IgVWJ1bnR1CkNvbW1lbnRbbmVdPeCkieCkrOCkq")); serviceToken: "G9sZCBmb3IgVWJ1bnR1CkNvbW1lbnRbbmVdPeCkieCkrOCkq",
termOfServicesURL: "http://devweb.local/comunic/current/about.php?cgu",
));
subMain(); subMain();
} }

View File

@ -11,18 +11,21 @@ class Config {
final bool apiServerSecure; final bool apiServerSecure;
final String serviceName; final String serviceName;
final String serviceToken; final String serviceToken;
final String termOfServicesURL;
const Config( const Config({
{@required this.apiServerName, @required this.apiServerName,
@required this.apiServerUri, @required this.apiServerUri,
@required this.apiServerSecure, @required this.apiServerSecure,
@required this.serviceName, @required this.serviceName,
@required this.serviceToken}) @required this.serviceToken,
: assert(apiServerName != null), @required this.termOfServicesURL,
}) : assert(apiServerName != null),
assert(apiServerUri != null), assert(apiServerUri != null),
assert(apiServerSecure != null), assert(apiServerSecure != null),
assert(serviceName != null), assert(serviceName != null),
assert(serviceToken != null); assert(serviceToken != null),
assert(termOfServicesURL != null);
/// Get and set static configuration /// Get and set static configuration
static Config _config; static Config _config;

View File

@ -1,6 +1,8 @@
import 'package:comunic/models/config.dart';
import 'package:comunic/utils/input_utils.dart'; import 'package:comunic/utils/input_utils.dart';
import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/intl_utils.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
/// Create account route /// Create account route
/// ///
@ -132,6 +134,10 @@ class __CreateAccountRouteBodyState extends State<_CreateAccountRouteBody> {
) )
: null, : null,
controlAffinity: ListTileControlAffinity.leading, controlAffinity: ListTileControlAffinity.leading,
secondary: IconButton(
icon: Icon(Icons.open_in_new),
onPressed: _openTOS,
),
), ),
// Submit button // Submit button
@ -161,6 +167,10 @@ class __CreateAccountRouteBodyState extends State<_CreateAccountRouteBody> {
return; return;
} }
} }
void _openTOS() {
launch(config().termOfServicesURL);
}
} }
class _InputEntry extends StatelessWidget { class _InputEntry extends StatelessWidget {