mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 08:15:16 +00:00
Show deprecation warning
This commit is contained in:
28
lib/ui/dialogs/deprecation_dialog.dart
Normal file
28
lib/ui/dialogs/deprecation_dialog.dart
Normal file
@ -0,0 +1,28 @@
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Deprecation dialog
|
||||
///
|
||||
/// @author Pierre Hubert
|
||||
|
||||
/// Show a dialog to warn the user this version of the application is deprecated
|
||||
Future<void> showDeprecationDialog(BuildContext context) async {
|
||||
await showDialog(context: context, builder: (c) => _DeprecationDialog());
|
||||
}
|
||||
|
||||
class _DeprecationDialog extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(tr("Deprecated application version")),
|
||||
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.")),
|
||||
actions: [
|
||||
MaterialButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text(tr("OK")),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ import 'package:comunic/helpers/events_helper.dart';
|
||||
import 'package:comunic/helpers/server_config_helper.dart';
|
||||
import 'package:comunic/helpers/version_helper.dart';
|
||||
import 'package:comunic/helpers/websocket_helper.dart';
|
||||
import 'package:comunic/ui/dialogs/deprecation_dialog.dart';
|
||||
import 'package:comunic/ui/routes/login_route.dart';
|
||||
import 'package:comunic/ui/routes/main_route/main_route.dart';
|
||||
import 'package:comunic/ui/routes/main_route/smartphone_route.dart';
|
||||
@ -62,6 +63,9 @@ class _InitializeWidgetState extends SafeState<InitializeWidget> {
|
||||
try {
|
||||
await ServerConfigurationHelper.ensureLoaded();
|
||||
|
||||
if (ServerConfigurationHelper.config.minSupportedMobileVersion > VersionHelper.version)
|
||||
await showDeprecationDialog(context);
|
||||
|
||||
if (!AccountHelper.isUserIDLoaded) {
|
||||
_popToMainRoute();
|
||||
_openLoginPage();
|
||||
|
Reference in New Issue
Block a user