From 95a38e9e8dc8b62891c720f0f9b8768d4c4f9b8f Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 17 Apr 2021 09:09:03 +0200 Subject: [PATCH] Add links to privacy policy and terms of use of the terms --- lib/helpers/server_config_helper.dart | 1 + lib/models/server_config.dart | 3 +++ lib/ui/routes/settings/application_settings.dart | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/lib/helpers/server_config_helper.dart b/lib/helpers/server_config_helper.dart index 52f4db8..785d487 100644 --- a/lib/helpers/server_config_helper.dart +++ b/lib/helpers/server_config_helper.dart @@ -27,6 +27,7 @@ class ServerConfigurationHelper { minSupportedMobileVersion: Version.parse(response["min_supported_mobile_version"]), termsURL: response["terms_url"], + privacyPolicyURL: response["privacy_policy_url"], playStoreURL: response["play_store_url"], androidDirectDownloadURL: response["android_direct_download_url"], notificationsPolicy: NotificationsPolicy( diff --git a/lib/models/server_config.dart b/lib/models/server_config.dart index 23d2c1a..5a637c6 100644 --- a/lib/models/server_config.dart +++ b/lib/models/server_config.dart @@ -135,6 +135,7 @@ class AccountInformationPolicy { class ServerConfig { final Version minSupportedMobileVersion; final String termsURL; + final String privacyPolicyURL; final String playStoreURL; final String androidDirectDownloadURL; final NotificationsPolicy notificationsPolicy; @@ -146,6 +147,7 @@ class ServerConfig { const ServerConfig({ @required this.minSupportedMobileVersion, @required this.termsURL, + @required this.privacyPolicyURL, @required this.playStoreURL, @required this.androidDirectDownloadURL, @required this.notificationsPolicy, @@ -155,6 +157,7 @@ class ServerConfig { @required this.accountInformationPolicy, }) : assert(minSupportedMobileVersion != null), assert(termsURL != null), + assert(privacyPolicyURL != null), assert(playStoreURL != null), assert(androidDirectDownloadURL != null), assert(notificationsPolicy != null), diff --git a/lib/ui/routes/settings/application_settings.dart b/lib/ui/routes/settings/application_settings.dart index 6fea300..336b09b 100644 --- a/lib/ui/routes/settings/application_settings.dart +++ b/lib/ui/routes/settings/application_settings.dart @@ -1,10 +1,12 @@ import 'package:comunic/helpers/preferences_helper.dart'; +import 'package:comunic/helpers/server_config_helper.dart'; import 'package:comunic/ui/widgets/async_screen_widget.dart'; import 'package:comunic/ui/widgets/settings/header_spacer_section.dart'; import 'package:comunic/utils/intl_utils.dart'; import 'package:comunic/utils/ui_utils.dart'; import 'package:flutter/material.dart'; import 'package:settings_ui/settings_ui.dart'; +import 'package:url_launcher/url_launcher.dart'; /// Application settings /// @@ -57,6 +59,14 @@ class _ApplicationSettingsState extends State { SettingsSection _buildGeneralSection() => SettingsSection( title: tr("General"), tiles: [ + SettingsTile( + title: tr("Privacy policy"), + onPressed: (c) => launch(srvConfig.privacyPolicyURL), + ), + SettingsTile( + title: tr("Terms"), + onPressed: (c) => launch(srvConfig.termsURL), + ), SettingsTile( title: tr("About this application"), subtitle: tr("Learn more about us"),