make it possible to hide flame warning

This commit is contained in:
otsmr 2026-07-29 14:44:04 +02:00
parent e8e3254278
commit 0291a4c3a2
8 changed files with 53 additions and 3 deletions

View file

@ -4273,6 +4273,18 @@ abstract class AppLocalizations {
/// In en, this message translates to: /// In en, this message translates to:
/// **'All memories are up to date.'** /// **'All memories are up to date.'**
String get settingsStorageSyncUpToDate; String get settingsStorageSyncUpToDate;
/// No description provided for @restoreLostFlames.
///
/// In en, this message translates to:
/// **'Restore your {count} lost flames'**
String restoreLostFlames(int count);
/// No description provided for @settingsShowRestoreFlameTitle.
///
/// In en, this message translates to:
/// **'Show flame restore warning'**
String get settingsShowRestoreFlameTitle;
} }
class _AppLocalizationsDelegate class _AppLocalizationsDelegate

View file

@ -2475,4 +2475,13 @@ class AppLocalizationsDe extends AppLocalizations {
@override @override
String get settingsStorageSyncUpToDate => String get settingsStorageSyncUpToDate =>
'Alle Memories sind auf dem neuesten Stand.'; 'Alle Memories sind auf dem neuesten Stand.';
@override
String restoreLostFlames(int count) {
return 'Stelle deine $count verlorenen Flammen wieder her';
}
@override
String get settingsShowRestoreFlameTitle =>
'Hinweis zur Flammen-Wiederherstellung anzeigen';
} }

View file

@ -2453,4 +2453,12 @@ class AppLocalizationsEn extends AppLocalizations {
@override @override
String get settingsStorageSyncUpToDate => 'All memories are up to date.'; String get settingsStorageSyncUpToDate => 'All memories are up to date.';
@override
String restoreLostFlames(int count) {
return 'Restore your $count lost flames';
}
@override
String get settingsShowRestoreFlameTitle => 'Show flame restore warning';
} }

@ -1 +1 @@
Subproject commit 34c835db2de08af962b39fb79ec11341b8847926 Subproject commit c5f554b36deab290c091ae46b3af1255f74c6b98

View file

@ -93,6 +93,9 @@ class UserData {
@JsonKey(defaultValue: true) @JsonKey(defaultValue: true)
bool typingIndicators = true; bool typingIndicators = true;
@JsonKey(defaultValue: true)
bool showRestoreFlame = true;
String? myBestFriendGroupId; String? myBestFriendGroupId;
DateTime? signalLastSignedPreKeyUpdated; DateTime? signalLastSignedPreKeyUpdated;

View file

@ -60,6 +60,7 @@ UserData _$UserDataFromJson(Map<String, dynamic> json) =>
..autoStoreAllSendUnlimitedMediaFiles = ..autoStoreAllSendUnlimitedMediaFiles =
json['autoStoreAllSendUnlimitedMediaFiles'] as bool? ?? false json['autoStoreAllSendUnlimitedMediaFiles'] as bool? ?? false
..typingIndicators = json['typingIndicators'] as bool? ?? true ..typingIndicators = json['typingIndicators'] as bool? ?? true
..showRestoreFlame = json['showRestoreFlame'] as bool? ?? true
..myBestFriendGroupId = json['myBestFriendGroupId'] as String? ..myBestFriendGroupId = json['myBestFriendGroupId'] as String?
..signalLastSignedPreKeyUpdated = ..signalLastSignedPreKeyUpdated =
json['signalLastSignedPreKeyUpdated'] == null json['signalLastSignedPreKeyUpdated'] == null
@ -151,6 +152,7 @@ Map<String, dynamic> _$UserDataToJson(UserData instance) => <String, dynamic>{
'autoStoreAllSendUnlimitedMediaFiles': 'autoStoreAllSendUnlimitedMediaFiles':
instance.autoStoreAllSendUnlimitedMediaFiles, instance.autoStoreAllSendUnlimitedMediaFiles,
'typingIndicators': instance.typingIndicators, 'typingIndicators': instance.typingIndicators,
'showRestoreFlame': instance.showRestoreFlame,
'myBestFriendGroupId': instance.myBestFriendGroupId, 'myBestFriendGroupId': instance.myBestFriendGroupId,
'signalLastSignedPreKeyUpdated': instance.signalLastSignedPreKeyUpdated 'signalLastSignedPreKeyUpdated': instance.signalLastSignedPreKeyUpdated
?.toIso8601String(), ?.toIso8601String(),

View file

@ -107,6 +107,9 @@ class _RestoreFlameCompState extends State<RestoreFlameComp> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (!userService.currentUser.showRestoreFlame) {
return const SizedBox.shrink();
}
if (_group == null || !isItPossibleToRestoreFlames(_group!)) { if (_group == null || !isItPossibleToRestoreFlames(_group!)) {
return Container(); return Container();
} }
@ -115,7 +118,7 @@ class _RestoreFlameCompState extends State<RestoreFlameComp> {
contentPadding: const EdgeInsets.symmetric(horizontal: 16), contentPadding: const EdgeInsets.symmetric(horizontal: 16),
onTap: _restoreFlames, onTap: _restoreFlames,
title: Text( title: Text(
'Restore your ${_group!.maxFlameCounter} lost flames', context.lang.restoreLostFlames(_group!.maxFlameCounter),
style: const TextStyle(fontWeight: FontWeight.w500), style: const TextStyle(fontWeight: FontWeight.w500),
), ),
trailing: const SizedBox( trailing: const SizedBox(
@ -134,7 +137,7 @@ class _RestoreFlameCompState extends State<RestoreFlameComp> {
emoji: '🔥', emoji: '🔥',
), ),
), ),
text: 'Restore your ${_group!.maxFlameCounter} lost flames', text: context.lang.restoreLostFlames(_group!.maxFlameCounter),
); );
} }
} }

View file

@ -24,6 +24,12 @@ class _ChatSettingsViewState extends State<ChatSettingsView> {
}); });
} }
Future<void> setShowRestoreFlame(bool value) async {
await UserService.update((u) {
u.showRestoreFlame = value;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -55,6 +61,13 @@ class _ChatSettingsViewState extends State<ChatSettingsView> {
.automaticallyMarkEqualMediaFilesAsOpened, .automaticallyMarkEqualMediaFilesAsOpened,
onChanged: setAutomaticallyMarkEqualMediaFilesAsOpened, onChanged: setAutomaticallyMarkEqualMediaFilesAsOpened,
), ),
SwitchListTile.adaptive(
title: Text(
context.lang.settingsShowRestoreFlameTitle,
),
value: userService.currentUser.showRestoreFlame,
onChanged: setShowRestoreFlame,
),
], ],
); );
}, },