mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 09:08:40 +00:00
ask before deleting image
This commit is contained in:
parent
bc2c998850
commit
6d86af155c
7 changed files with 216 additions and 138 deletions
|
|
@ -818,5 +818,7 @@
|
|||
"deleteChatAfterAMonth": "einem Monat.",
|
||||
"deleteChatAfterAYear": "einem Jahr.",
|
||||
"yourTwonlyScore": "Dein twonly-Score",
|
||||
"registrationClosed": "Aufgrund des aktuell sehr hohen Aufkommens haben wir die Registrierung vorübergehend deaktiviert, damit der Dienst zuverlässig bleibt. Bitte versuche es in ein paar Tagen noch einmal."
|
||||
"registrationClosed": "Aufgrund des aktuell sehr hohen Aufkommens haben wir die Registrierung vorübergehend deaktiviert, damit der Dienst zuverlässig bleibt. Bitte versuche es in ein paar Tagen noch einmal.",
|
||||
"dialogAskDeleteMediaFilePopTitle": "Bist du sicher, dass du dein Meisterwerk löschen möchtest?",
|
||||
"dialogAskDeleteMediaFilePopDelete": "Löschen"
|
||||
}
|
||||
|
|
@ -596,5 +596,7 @@
|
|||
"deleteChatAfterAMonth": "one month.",
|
||||
"deleteChatAfterAYear": "one year.",
|
||||
"yourTwonlyScore": "Your twonly-Score",
|
||||
"registrationClosed": "Due to the current high volume of registrations, we have temporarily disabled registration to ensure that the service remains reliable. Please try again in a few days."
|
||||
"registrationClosed": "Due to the current high volume of registrations, we have temporarily disabled registration to ensure that the service remains reliable. Please try again in a few days.",
|
||||
"dialogAskDeleteMediaFilePopTitle": "Are you sure you want to delete your masterpiece?",
|
||||
"dialogAskDeleteMediaFilePopDelete": "Delete"
|
||||
}
|
||||
|
|
@ -2683,6 +2683,18 @@ abstract class AppLocalizations {
|
|||
/// In en, this message translates to:
|
||||
/// **'Due to the current high volume of registrations, we have temporarily disabled registration to ensure that the service remains reliable. Please try again in a few days.'**
|
||||
String get registrationClosed;
|
||||
|
||||
/// No description provided for @dialogAskDeleteMediaFilePopTitle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Are you sure you want to delete your masterpiece?'**
|
||||
String get dialogAskDeleteMediaFilePopTitle;
|
||||
|
||||
/// No description provided for @dialogAskDeleteMediaFilePopDelete.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Delete'**
|
||||
String get dialogAskDeleteMediaFilePopDelete;
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
|
|
|
|||
|
|
@ -1481,4 +1481,11 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
@override
|
||||
String get registrationClosed =>
|
||||
'Aufgrund des aktuell sehr hohen Aufkommens haben wir die Registrierung vorübergehend deaktiviert, damit der Dienst zuverlässig bleibt. Bitte versuche es in ein paar Tagen noch einmal.';
|
||||
|
||||
@override
|
||||
String get dialogAskDeleteMediaFilePopTitle =>
|
||||
'Bist du sicher, dass du dein Meisterwerk löschen möchtest?';
|
||||
|
||||
@override
|
||||
String get dialogAskDeleteMediaFilePopDelete => 'Löschen';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1471,4 +1471,11 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
@override
|
||||
String get registrationClosed =>
|
||||
'Due to the current high volume of registrations, we have temporarily disabled registration to ensure that the service remains reliable. Please try again in a few days.';
|
||||
|
||||
@override
|
||||
String get dialogAskDeleteMediaFilePopTitle =>
|
||||
'Are you sure you want to delete your masterpiece?';
|
||||
|
||||
@override
|
||||
String get dialogAskDeleteMediaFilePopDelete => 'Delete';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class _FilterLayerState extends State<FilterLayer> {
|
|||
List<Widget> pages = [
|
||||
const FilterSkeleton(),
|
||||
const DateTimeFilter(),
|
||||
const LocationFilter(),
|
||||
// const LocationFilter(),
|
||||
const FilterSkeleton(),
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -264,6 +264,40 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
];
|
||||
}
|
||||
|
||||
Future<bool?> _showBackDialog() {
|
||||
return showDialog<bool>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
context.lang.dialogAskDeleteMediaFilePopTitle,
|
||||
),
|
||||
actions: [
|
||||
FilledButton(
|
||||
child: Text(context.lang.dialogAskDeleteMediaFilePopDelete),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, true);
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text(context.lang.cancel),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, false);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> askToCloseThenClose() async {
|
||||
final shouldPop = await _showBackDialog() ?? false;
|
||||
if (mounted && shouldPop) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
}
|
||||
|
||||
List<Widget> get actionsAtTheTop {
|
||||
if (layers.isNotEmpty &&
|
||||
layers.last.isEditing &&
|
||||
|
|
@ -275,7 +309,14 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
FontAwesomeIcons.xmark,
|
||||
tooltipText: context.lang.close,
|
||||
onPressed: () async {
|
||||
final nonImageFilterLayer = layers.where(
|
||||
(x) => x is! BackgroundLayerData && x is! FilterLayerData,
|
||||
);
|
||||
if (nonImageFilterLayer.isEmpty) {
|
||||
Navigator.pop(context, false);
|
||||
} else {
|
||||
await askToCloseThenClose();
|
||||
}
|
||||
},
|
||||
),
|
||||
Expanded(child: Container()),
|
||||
|
|
@ -446,7 +487,13 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
Widget build(BuildContext context) {
|
||||
pixelRatio = MediaQuery.of(context).devicePixelRatio;
|
||||
|
||||
return Scaffold(
|
||||
return PopScope<bool?>(
|
||||
canPop: false,
|
||||
onPopInvokedWithResult: (bool didPop, bool? result) async {
|
||||
if (didPop) return;
|
||||
await askToCloseThenClose();
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor:
|
||||
widget.sharedFromGallery ? null : Colors.white.withAlpha(0),
|
||||
resizeToAvoidBottomInset: false,
|
||||
|
|
@ -595,6 +642,7 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
|
|||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue