Initial commit
Some checks failed
Main Deploy Workflow / deploy_web (push) Has been cancelled
Main Deploy Workflow / deploy_playstore_internal (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled

This commit is contained in:
2026-09-11 15:59:56 -03:00
commit 0037b0b9cf
651 changed files with 199705 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
// SPDX-FileCopyrightText: 2019-Present Christian Kußowski
// SPDX-FileCopyrightText: 2019-Present Contributors to FluffyChat
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import 'package:tatchat/config/app_config.dart';
import 'package:tatchat/l10n/l10n.dart';
import 'package:tatchat/utils/platform_infos.dart';
import 'package:tatchat/widgets/adaptive_dialogs/adaptive_dialog_action.dart';
import 'package:material_ui/material_ui.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_launcher/url_launcher_string.dart';
abstract class UpdateNotifier {
static const String versionStoreKey = 'last_known_version';
static Future<void> showUpdateDialog(BuildContext context) async {
final l10n = L10n.of(context);
final currentVersion = await PlatformInfos.getVersion();
final store = await SharedPreferences.getInstance();
final storedVersion = store.getString(versionStoreKey);
if (!context.mounted) return;
if (currentVersion != storedVersion) {
if (storedVersion != null) {
showAdaptiveDialog(
barrierDismissible: true,
context: context,
builder: (context) => AlertDialog.adaptive(
title: Text(
l10n.updateInstalled(currentVersion),
style: TextStyle(fontWeight: FontWeight.bold),
),
content: Text(l10n.possibleByYou),
actions: [
AdaptiveDialogAction(
bigButtons: true,
onPressed: () => launchUrlString(AppConfig.helpUrl),
child: Row(
mainAxisSize: .min,
spacing: 4,
children: [
Icon(
Icons.favorite,
color: Theme.of(context).colorScheme.error,
),
Text(
l10n.support,
style: TextStyle(
color: Theme.of(context).colorScheme.error,
),
),
],
),
),
AdaptiveDialogAction(
bigButtons: true,
onPressed: () => launchUrlString(AppConfig.changelogUrl),
child: Text(l10n.changelog),
),
AdaptiveDialogAction(
bigButtons: true,
onPressed: () => Navigator.of(context).pop(),
child: Text(l10n.close),
),
],
),
);
}
await store.setString(versionStoreKey, currentVersion);
}
}
}