1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-25 06:19:22 +00:00

Terms of use are not hard coded anymore

This commit is contained in:
Pierre HUBERT 2021-02-20 09:35:03 +01:00
parent 0cd9371460
commit a32e968992
6 changed files with 7 additions and 11 deletions

View File

@ -23,6 +23,7 @@ class ServerConfigurationHelper {
_config = ServerConfig( _config = ServerConfig(
minSupportedMobileVersion: minSupportedMobileVersion:
Version.parse(response["min_supported_mobile_version"]), Version.parse(response["min_supported_mobile_version"]),
termsURL: response["terms_url"],
passwordPolicy: PasswordPolicy( passwordPolicy: PasswordPolicy(
allowMailInPassword: passwordPolicy["allow_email_in_password"], allowMailInPassword: passwordPolicy["allow_email_in_password"],
allowNameInPassword: passwordPolicy["allow_name_in_password"], allowNameInPassword: passwordPolicy["allow_name_in_password"],

View File

@ -24,7 +24,6 @@ void main() {
apiServerUri: "/", apiServerUri: "/",
apiServerSecure: false, apiServerSecure: false,
clientName: "ComunicFlutter", clientName: "ComunicFlutter",
termsOfServicesURL: "http://devweb.local/comunic/current/about.php?cgu",
)); ));
HttpOverrides.global = new MyHttpOverride(); HttpOverrides.global = new MyHttpOverride();

View File

@ -11,7 +11,6 @@ void main() {
apiServerUri: "/", apiServerUri: "/",
apiServerSecure: true, apiServerSecure: true,
clientName: "ComunicFlutter", clientName: "ComunicFlutter",
termsOfServicesURL: "https://about.communiquons.org/about/terms/",
)); ));
subMain(); subMain();

View File

@ -11,19 +11,15 @@ class Config {
final bool apiServerSecure; final bool apiServerSecure;
final String clientName; final String clientName;
final String termsOfServicesURL;
const Config({ const Config({
@required this.apiServerName, @required this.apiServerName,
@required this.apiServerUri, @required this.apiServerUri,
@required this.apiServerSecure, @required this.apiServerSecure,
@required this.clientName, @required this.clientName,
@required this.termsOfServicesURL,
}) : assert(apiServerName != null), }) : assert(apiServerName != null),
assert(apiServerUri != null), assert(apiServerUri != null),
assert(apiServerSecure != null), assert(apiServerSecure != null),
assert(clientName != null), assert(clientName != null);
assert(termsOfServicesURL != null);
/// Get and set static configuration /// Get and set static configuration
static Config _config; static Config _config;

View File

@ -59,14 +59,17 @@ class ServerDataConservationPolicy {
class ServerConfig { class ServerConfig {
final Version minSupportedMobileVersion; final Version minSupportedMobileVersion;
final String termsURL;
final PasswordPolicy passwordPolicy; final PasswordPolicy passwordPolicy;
final ServerDataConservationPolicy dataConservationPolicy; final ServerDataConservationPolicy dataConservationPolicy;
const ServerConfig({ const ServerConfig({
@required this.minSupportedMobileVersion, @required this.minSupportedMobileVersion,
@required this.termsURL,
@required this.passwordPolicy, @required this.passwordPolicy,
@required this.dataConservationPolicy, @required this.dataConservationPolicy,
}) : assert(minSupportedMobileVersion != null), }) : assert(minSupportedMobileVersion != null),
assert(termsURL != null),
assert(passwordPolicy != null), assert(passwordPolicy != null),
assert(dataConservationPolicy != null); assert(dataConservationPolicy != null);
} }

View File

@ -1,5 +1,5 @@
import 'package:comunic/helpers/account_helper.dart'; import 'package:comunic/helpers/account_helper.dart';
import 'package:comunic/models/config.dart'; import 'package:comunic/helpers/server_config_helper.dart';
import 'package:comunic/models/new_account.dart'; import 'package:comunic/models/new_account.dart';
import 'package:comunic/ui/widgets/new_password_input_widget.dart'; import 'package:comunic/ui/widgets/new_password_input_widget.dart';
import 'package:comunic/utils/input_utils.dart'; import 'package:comunic/utils/input_utils.dart';
@ -226,9 +226,7 @@ class __CreateAccountRouteBodyState extends State<_CreateAccountRouteBody> {
_accountCreated(); _accountCreated();
} }
void _openTOS() { void _openTOS() => launch(ServerConfigurationHelper.config.termsURL);
launch(config().termsOfServicesURL);
}
void _showCreateAccountError() async { void _showCreateAccountError() async {
await showCupertinoDialog( await showCupertinoDialog(