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

Add download link on deprecation dialog

This commit is contained in:
Pierre HUBERT 2021-02-20 09:59:21 +01:00
parent a32e968992
commit 1ea286f3ef
3 changed files with 22 additions and 2 deletions

View File

@ -24,6 +24,8 @@ class ServerConfigurationHelper {
minSupportedMobileVersion: minSupportedMobileVersion:
Version.parse(response["min_supported_mobile_version"]), Version.parse(response["min_supported_mobile_version"]),
termsURL: response["terms_url"], termsURL: response["terms_url"],
playStoreURL: response["play_store_url"],
androidDirectDownloadURL: response["android_direct_download_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

@ -60,16 +60,22 @@ class ServerDataConservationPolicy {
class ServerConfig { class ServerConfig {
final Version minSupportedMobileVersion; final Version minSupportedMobileVersion;
final String termsURL; final String termsURL;
final String playStoreURL;
final String androidDirectDownloadURL;
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.termsURL,
@required this.playStoreURL,
@required this.androidDirectDownloadURL,
@required this.passwordPolicy, @required this.passwordPolicy,
@required this.dataConservationPolicy, @required this.dataConservationPolicy,
}) : assert(minSupportedMobileVersion != null), }) : assert(minSupportedMobileVersion != null),
assert(termsURL != null), assert(termsURL != null),
assert(playStoreURL != null),
assert(androidDirectDownloadURL != null),
assert(passwordPolicy != null), assert(passwordPolicy != null),
assert(dataConservationPolicy != null); assert(dataConservationPolicy != null);
} }

View File

@ -1,5 +1,7 @@
import 'package:comunic/helpers/server_config_helper.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';
/// Deprecation dialog /// Deprecation dialog
/// ///
@ -16,11 +18,21 @@ class _DeprecationDialog extends StatelessWidget {
return AlertDialog( return AlertDialog(
title: Text(tr("Deprecated application version")), title: Text(tr("Deprecated application version")),
content: Text(tr( content: Text(tr(
"This version of the mobile application is deprecated. You might still be able to use it, but some features will not work. We recommend you to update to the latest version of the application.")), "This version of the Comunic application is deprecated. You might still be able to use it, but some features may not work. We recommend you to update to the latest version of the application.")),
actions: [ actions: [
MaterialButton(
onPressed: () =>
launch(ServerConfigurationHelper.config.playStoreURL),
child: Text(tr("Go to the Play Store")),
),
MaterialButton(
onPressed: () =>
launch(ServerConfigurationHelper.config.androidDirectDownloadURL),
child: Text(tr("Download update outside Play Store")),
),
MaterialButton( MaterialButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
child: Text(tr("OK")), child: Text(tr("Use the old application anyway")),
) )
], ],
); );