Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

show discard alert sheet

AmanRajSinghMouryad7fb39008140
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/edit_album_details_sheet.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/edit_album_details_sheet.dart
index d5577882c9..4f49c0078a 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/edit_album_details_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/edit_album_details_sheet.dart
@@ -128,6 +128,7 @@ class _EditAlbumDetailsSheetState extends State<EditAlbumDetailsSheet> {
return BottomSheetComponent(
title: strings.editDetails,
closeTooltip: strings.close,
+ onClose: _onClose,
contentSpacing: Spacing.xxl,
actionsTopSpacing: Spacing.xxl,
isKeyboardAware: true,
@@ -184,6 +185,33 @@ class _EditAlbumDetailsSheetState extends State<EditAlbumDetailsSheet> {
);
}
+ void _onClose() {
+ if (!_hasChanges) {
+ return;
+ }
+ FocusScope.of(context).unfocus();
+ showBottomSheetComponent<bool>(
+ context: context,
+ builder: (_) => BottomSheetComponent(
+ title: context.strings.unsavedNoteChangesTitle,
+ message: context.strings.albumEditsWillNotBeSaved,
+ illustration: Image.asset("assets/warning-red.png"),
+ actions: [
+ ButtonComponent(
+ label: context.strings.discardChanges,
+ variant: ButtonComponentVariant.critical,
+ onTap: () => Navigator.of(context).pop(true),
+ ),
+ ],
+ ),
+ ).then((shouldDiscard) {
+ if (!mounted || shouldDiscard != true) {
+ return;
+ }
+ Navigator.of(context).pop();
+ });
+ }
+
Future<void> _selectCover() async {
final selection = await widget.onSelectCover();
if (!mounted || selection == null) {
diff --git a/mobile/packages/strings/lib/l10n/arb/strings_en.arb b/mobile/packages/strings/lib/l10n/arb/strings_en.arb
index 276e4f04f8..c4bd5c60f7 100644
--- a/mobile/packages/strings/lib/l10n/arb/strings_en.arb
+++ b/mobile/packages/strings/lib/l10n/arb/strings_en.arb
@@ -208,6 +208,7 @@
"after1Week": "After 1 week",
"after1Year": "After 1 year",
"albumDescriptionHint": "Enter a description for this album",
+ "albumEditsWillNotBeSaved": "Your edits to this album won't be saved.",
"albumLayout": "Album layout",
"albumOwner": "Owner",
"@albumOwner": {