1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-25 12:28:50 +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(
minSupportedMobileVersion:
Version.parse(response["min_supported_mobile_version"]),
termsURL: response["terms_url"],
passwordPolicy: PasswordPolicy(
allowMailInPassword: passwordPolicy["allow_email_in_password"],
allowNameInPassword: passwordPolicy["allow_name_in_password"],

View File

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

View File

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

View File

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

View File

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

View File

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