π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add delete confirmation dialogs and localization strings for file and collection deletions
AmanRajSinghMourya4becfa28bc47
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arbindex b031e16754..5999755f4a 100644--- a/mobile/apps/locker/lib/l10n/app_en.arb+++ b/mobile/apps/locker/lib/l10n/app_en.arb@@ -677,5 +677,58 @@},"locker": "Locker","unnamed": "Unnamed",- "collectionLabel": "Collection"+ "collectionLabel": "Collection",+ "areYouSure": "Are you sure?",+ "yesDeleteCollection": "Yes, delete collection",+ "yesDeleteFile": "Yes, delete file",+ "deleteCollectionDialogBody": "This action is immediate and cannot be undone.\nThe {collectionName} will be deleted permanently.",+ "@deleteCollectionDialogBody": {+ "description": "Confirmation message body for deleting a single collection",+ "placeholders": {+ "collectionName": {+ "type": "String",+ "example": "My Documents"+ }+ }+ },+ "deleteMultipleCollectionsDialogBody": "This action is immediate and cannot be undone.\n{count, plural, =1{1 collection} other{{count} collections}} will be deleted permanently.",+ "@deleteMultipleCollectionsDialogBody": {+ "description": "Confirmation message body for deleting multiple collections",+ "placeholders": {+ "count": {+ "type": "int",+ "example": "3"+ }+ }+ },+ "deleteMultipleFilesDialogBody": "This action is immediate and cannot be undone.\n{count, plural, =1{1 file} other{{count} files}} will be deleted permanently.",+ "@deleteMultipleFilesDialogBody": {+ "description": "Confirmation message body for deleting multiple files",+ "placeholders": {+ "count": {+ "type": "int",+ "example": "3"+ }+ }+ },+ "yesDeleteCollections": "Yes, delete {count, plural, =1{collection} other{collections}}",+ "@yesDeleteCollections": {+ "description": "Button label for confirming deletion of one or more collections",+ "placeholders": {+ "count": {+ "type": "int",+ "example": "3"+ }+ }+ },+ "yesDeleteFiles": "Yes, delete {count, plural, =1{file} other{files}}",+ "@yesDeleteFiles": {+ "description": "Button label for confirming deletion of one or more files",+ "placeholders": {+ "count": {+ "type": "int",+ "example": "3"+ }+ }+ }}diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dartindex 2d1c85fb6a..26766c5076 100644--- a/mobile/apps/locker/lib/l10n/app_localizations.dart+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart@@ -2097,6 +2097,54 @@ abstract class AppLocalizations {/// In en, this message translates to:/// **'Collection'**String get collectionLabel;++ /// No description provided for @areYouSure.+ ///+ /// In en, this message translates to:+ /// **'Are you sure?'**+ String get areYouSure;++ /// No description provided for @yesDeleteCollection.+ ///+ /// In en, this message translates to:+ /// **'Yes, delete collection'**+ String get yesDeleteCollection;++ /// No description provided for @yesDeleteFile.+ ///+ /// In en, this message translates to:+ /// **'Yes, delete file'**+ String get yesDeleteFile;++ /// Confirmation message body for deleting a single collection+ ///+ /// In en, this message translates to:+ /// **'This action is immediate and cannot be undone.\nThe {collectionName} will be deleted permanently.'**+ String deleteCollectionDialogBody(String collectionName);++ /// Confirmation message body for deleting multiple collections+ ///+ /// In en, this message translates to:+ /// **'This action is immediate and cannot be undone.\n{count, plural, =1{1 collection} other{{count} collections}} will be deleted permanently.'**+ String deleteMultipleCollectionsDialogBody(int count);++ /// Confirmation message body for deleting multiple files+ ///+ /// In en, this message translates to:+ /// **'This action is immediate and cannot be undone.\n{count, plural, =1{1 file} other{{count} files}} will be deleted permanently.'**+ String deleteMultipleFilesDialogBody(int count);++ /// Button label for confirming deletion of one or more collections+ ///+ /// In en, this message translates to:+ /// **'Yes, delete {count, plural, =1{collection} other{collections}}'**+ String yesDeleteCollections(int count);++ /// Button label for confirming deletion of one or more files+ ///+ /// In en, this message translates to:+ /// **'Yes, delete {count, plural, =1{file} other{files}}'**+ String yesDeleteFiles(int count);}class _AppLocalizationsDelegatediff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dartindex d64559aad6..d8d0dd43dc 100644--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart@@ -1204,4 +1204,62 @@ class AppLocalizationsEn extends AppLocalizations {@overrideString get collectionLabel => 'Collection';++ @override+ String get areYouSure => 'Are you sure?';++ @override+ String get yesDeleteCollection => 'Yes, delete collection';++ @override+ String get yesDeleteFile => 'Yes, delete file';++ @override+ String deleteCollectionDialogBody(String collectionName) {+ return 'This action is immediate and cannot be undone.\nThe $collectionName will be deleted permanently.';+ }++ @override+ String deleteMultipleCollectionsDialogBody(int count) {+ String _temp0 = intl.Intl.pluralLogic(+ count,+ locale: localeName,+ other: '$count collections',+ one: '1 collection',+ );+ return 'This action is immediate and cannot be undone.\n$_temp0 will be deleted permanently.';+ }++ @override+ String deleteMultipleFilesDialogBody(int count) {+ String _temp0 = intl.Intl.pluralLogic(+ count,+ locale: localeName,+ other: '$count files',+ one: '1 file',+ );+ return 'This action is immediate and cannot be undone.\n$_temp0 will be deleted permanently.';+ }++ @override+ String yesDeleteCollections(int count) {+ String _temp0 = intl.Intl.pluralLogic(+ count,+ locale: localeName,+ other: 'collections',+ one: 'collection',+ );+ return 'Yes, delete $_temp0';+ }++ @override+ String yesDeleteFiles(int count) {+ String _temp0 = intl.Intl.pluralLogic(+ count,+ locale: localeName,+ other: 'files',+ one: 'file',+ );+ return 'Yes, delete $_temp0';+ }}diff --git a/mobile/apps/locker/lib/ui/components/delete_confirmation_dialog.dart b/mobile/apps/locker/lib/ui/components/delete_confirmation_dialog.dartindex 1e5c7e2ee0..84ae6b47f1 100644--- a/mobile/apps/locker/lib/ui/components/delete_confirmation_dialog.dart+++ b/mobile/apps/locker/lib/ui/components/delete_confirmation_dialog.dart@@ -9,7 +9,6 @@ Future<ButtonResult?> showDeleteConfirmationDialog(required String title,required String body,required String deleteButtonLabel,- required int fileCount,}) {return showModalBottomSheet<ButtonResult>(context: context,@@ -20,7 +19,6 @@ Future<ButtonResult?> showDeleteConfirmationDialog(title: title,body: body,deleteButtonLabel: deleteButtonLabel,- fileCount: fileCount,);},);@@ -30,13 +28,11 @@ class _DeleteConfirmationBottomSheet extends StatelessWidget {final String title;final String body;final String deleteButtonLabel;- final int fileCount;const _DeleteConfirmationBottomSheet({required this.title,required this.body,required this.deleteButtonLabel,- required this.fileCount,});@override@@ -84,13 +80,13 @@ class _DeleteConfirmationBottomSheet extends StatelessWidget {Image.asset('assets/delete_icon.png'),const SizedBox(height: 24),Text(- "Are you sure?",+ title,style: textTheme.h3Bold,textAlign: TextAlign.center,),const SizedBox(height: 12),Text(- "This action is immediate and cannot be undone.\n $fileCount files will be deleted permanently.",+ body,style: textTheme.body.copyWith(color: colorScheme.textMuted,),@@ -113,16 +109,16 @@ class _DeleteConfirmationBottomSheet extends StatelessWidget {),elevation: 0,),- icon: HugeIcon(+ icon: const HugeIcon(icon: HugeIcons.strokeRoundedFileUpload,- color: colorScheme.backdropBase,+ color: Colors.white,size: 20,strokeWidth: 1.9,),label: Text(- "Yes, delete files",+ deleteButtonLabel,style: textTheme.bodyBold.copyWith(- color: colorScheme.backdropBase,+ color: Colors.white,),),),diff --git a/mobile/apps/locker/lib/ui/components/file_popup_menu_widget.dart b/mobile/apps/locker/lib/ui/components/file_popup_menu_widget.dartindex e0c395cbfa..f0101c41ed 100644--- a/mobile/apps/locker/lib/ui/components/file_popup_menu_widget.dart+++ b/mobile/apps/locker/lib/ui/components/file_popup_menu_widget.dart@@ -193,10 +193,9 @@ class FilePopupMenuWidget extends StatelessWidget {Future<void> _showDeleteConfirmationDialog(BuildContext context) async {final result = await showDeleteConfirmationDialog(context,- title: context.l10n.deleteFile,- body: context.l10n.deleteFileConfirmation(file.displayName),- deleteButtonLabel: context.l10n.delete,- fileCount: 1,+ title: context.l10n.areYouSure,+ body: context.l10n.deleteMultipleCollectionsDialogBody(1),+ deleteButtonLabel: context.l10n.yesDeleteFiles(1),);if (result?.action == ButtonAction.first && context.mounted) {diff --git a/mobile/apps/locker/lib/ui/pages/collection_page.dart b/mobile/apps/locker/lib/ui/pages/collection_page.dartindex 6b13fe8842..6ccadc50f2 100644--- a/mobile/apps/locker/lib/ui/pages/collection_page.dart+++ b/mobile/apps/locker/lib/ui/pages/collection_page.dart@@ -251,6 +251,8 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>side: BorderSide(color: colorScheme.strokeFaint),),elevation: 15,+ padding: const EdgeInsetsGeometry.all(0),+ menuPadding: const EdgeInsets.all(0),shadowColor: Colors.black.withValues(alpha: 0.08),child: Container(height: 48,@@ -262,7 +264,7 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>padding: const EdgeInsets.all(12),child: HugeIcon(icon: HugeIcons.strokeRoundedMoreVertical,- color: colorScheme.iconColor,+ color: colorScheme.textBase,),),onSelected: (value) {@@ -297,11 +299,12 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>items.add(PopupMenuItem<String>(value: 'rename',+ height: 0,padding: EdgeInsets.zero,child: MenuItemWidget(icon: HugeIcon(icon: HugeIcons.strokeRoundedPencilEdit02,- color: colorScheme.iconColor,+ color: colorScheme.textBase,size: 20,),label: context.l10n.edit,@@ -316,6 +319,7 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>PopupMenuItem<String>(value: 'delete',padding: EdgeInsets.zero,+ height: 0,child: MenuItemWidget(icon: HugeIcon(icon: HugeIcons.strokeRoundedDelete02,@@ -336,10 +340,11 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>PopupMenuItem<String>(value: 'leave_collection',padding: EdgeInsets.zero,+ height: 0,child: MenuItemWidget(icon: HugeIcon(icon: HugeIcons.strokeRoundedDelete02,- color: colorScheme.iconColor,+ color: colorScheme.textBase,size: 20,),label: context.l10n.leaveCollection,@@ -393,7 +398,7 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>padding: const EdgeInsets.all(12),child: HugeIcon(icon: HugeIcons.strokeRoundedShare08,- color: colorScheme.iconColor,+ color: colorScheme.textBase,),),),diff --git a/mobile/apps/locker/lib/utils/collection_actions.dart b/mobile/apps/locker/lib/utils/collection_actions.dartindex bb7beae3e1..d20b498f7c 100644--- a/mobile/apps/locker/lib/utils/collection_actions.dart+++ b/mobile/apps/locker/lib/utils/collection_actions.dart@@ -20,6 +20,7 @@ import "package:locker/services/collections/collections_api_client.dart";import 'package:locker/services/collections/collections_service.dart';import 'package:locker/services/collections/models/collection.dart';import "package:locker/services/configuration.dart";+import "package:locker/ui/components/delete_confirmation_dialog.dart";import "package:locker/ui/components/input_dialog_sheet.dart";import 'package:locker/utils/snack_bar_utils.dart';import 'package:logging/logging.dart';@@ -124,9 +125,10 @@ class CollectionActions {final dialogChoice = await showChoiceDialog(context,- title: "Delete collections",- body: "Delete ${collections.length} collections?",- firstButtonLabel: context.l10n.delete,+ title: context.l10n.areYouSure,+ body:+ context.l10n.deleteMultipleCollectionsDialogBody(collections.length),+ firstButtonLabel: context.l10n.yesDeleteCollections(collections.length),secondButtonLabel: context.l10n.cancel,firstButtonType: ButtonType.critical,isCritical: true,@@ -191,17 +193,16 @@ class CollectionActions {final collectionName = collection.name ?? 'this collection';- final dialogChoice = await showChoiceDialog(+ final result = await showDeleteConfirmationDialog(context,- title: context.l10n.deleteCollection,- body: context.l10n.deleteCollectionConfirmation(collectionName),- firstButtonLabel: context.l10n.delete,- secondButtonLabel: context.l10n.cancel,- firstButtonType: ButtonType.critical,- isCritical: true,+ title: context.l10n.areYouSure,+ body: context.l10n.deleteCollectionDialogBody(collectionName),+ deleteButtonLabel: context.l10n.yesDeleteCollections(1),);- if (dialogChoice?.action != ButtonAction.first) return;+ if (result?.action != ButtonAction.first && context.mounted) {+ return;+ }final progressDialog =createProgressDialog(context, context.l10n.pleaseWait);