mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-03 19:54:12 +00:00 
			
		
		
		
	Terms of use are not hard coded anymore
This commit is contained in:
		@@ -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"],
 | 
			
		||||
 
 | 
			
		||||
@@ -24,7 +24,6 @@ void main() {
 | 
			
		||||
    apiServerUri: "/",
 | 
			
		||||
    apiServerSecure: false,
 | 
			
		||||
    clientName: "ComunicFlutter",
 | 
			
		||||
    termsOfServicesURL: "http://devweb.local/comunic/current/about.php?cgu",
 | 
			
		||||
  ));
 | 
			
		||||
 | 
			
		||||
  HttpOverrides.global = new MyHttpOverride();
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,6 @@ void main() {
 | 
			
		||||
    apiServerUri: "/",
 | 
			
		||||
    apiServerSecure: true,
 | 
			
		||||
    clientName: "ComunicFlutter",
 | 
			
		||||
    termsOfServicesURL: "https://about.communiquons.org/about/terms/",
 | 
			
		||||
  ));
 | 
			
		||||
 | 
			
		||||
  subMain();
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user