Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] copy changes

Priyanshu Dangare4100e51c9c67
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index edb11b9c95..7d8ef23e19 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -441,13 +441,10 @@
"uncategorized": "Uncategorized",
"videoSmallCase": "video",
"photoSmallCase": "photo",
- "videosSmallCase": "videos",
- "photosSmallCase": "photos",
- "itemsSmallCase": "items",
"singleFileDeleteHighlight": "It will be deleted from all albums.",
- "singleFileInBothLocalAndRemote": "This {fileType} is saved on this device and backed up to Ente. It will be removed from all albums.",
- "singleFileInRemoteOnly": "This {fileType} is backed up to Ente. It will be removed from all albums.",
- "singleFileDeleteFromDevice": "This {fileType} is saved on this device only.",
+ "singleFileInBothLocalAndRemote": "This {fileType} is available on your device and Ente.",
+ "singleFileInRemoteOnly": "This {fileType} will be deleted from all albums. You can recover it from Trash.",
+ "singleFileDeleteFromDevice": "{fileType} not backed up. Permanently delete from device?",
"deleteFileQuestion": "Delete {fileType}?",
"@deleteFileQuestion": {
"placeholders": {
@@ -456,22 +453,6 @@
}
}
},
- "deletePhotosQuestion": "{count, plural, one {Delete photo?} other {Delete {count} photos?}}",
- "@deletePhotosQuestion": {
- "placeholders": {
- "count": {
- "type": "int"
- }
- }
- },
- "deleteVideosQuestion": "{count, plural, one {Delete video?} other {Delete {count} videos?}}",
- "@deleteVideosQuestion": {
- "placeholders": {
- "count": {
- "type": "int"
- }
- }
- },
"deleteItemsQuestion": "{count, plural, one {Delete item?} other {Delete {count} items?}}",
"@deleteItemsQuestion": {
"placeholders": {
@@ -480,7 +461,7 @@
}
}
},
- "selectedFilesSavedOnDeviceOnly": "These {fileTypes} are saved on this device only.",
+ "selectedFilesSavedOnDeviceOnly": "{fileTypes} not backed up. Permanently delete from device?",
"@selectedFilesSavedOnDeviceOnly": {
"placeholders": {
"fileTypes": {
@@ -488,7 +469,7 @@
}
}
},
- "selectedFilesBackedUpToEnte": "These {fileTypes} are backed up to Ente. They will be removed from all albums.",
+ "selectedFilesBackedUpToEnte": "These {fileTypes} will be deleted from all albums. You can recover them from Trash.",
"@selectedFilesBackedUpToEnte": {
"placeholders": {
"fileTypes": {
@@ -496,7 +477,7 @@
}
}
},
- "someSelectedFilesBackedUpToEnte": "Some {fileTypes} are backed up to Ente. They will be removed from all albums.",
+ "someSelectedFilesBackedUpToEnte": "These {fileTypes} are available on device and Ente.",
"@someSelectedFilesBackedUpToEnte": {
"placeholders": {
"fileTypes": {
diff --git a/mobile/apps/photos/lib/utils/delete_file_util.dart b/mobile/apps/photos/lib/utils/delete_file_util.dart
index 5a36014460..47c956eb25 100644
--- a/mobile/apps/photos/lib/utils/delete_file_util.dart
+++ b/mobile/apps/photos/lib/utils/delete_file_util.dart
@@ -1091,39 +1091,24 @@ class DeleteConfirmationSheetState extends State<DeleteConfirmationSheet> {
@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context);
- // Dialog copy
- final title = widget.hasPhotos && widget.hasVideos
- ? l10n.deleteItemsQuestion(count: widget.count)
- : widget.hasVideos
- ? l10n.deleteVideosQuestion(count: widget.count)
- : l10n.deletePhotosQuestion(count: widget.count);
- final fileType = widget.hasVideos
- ? l10n.videoSmallCase
- : l10n.photoSmallCase;
- final fileTypes = widget.hasPhotos && widget.hasVideos
- ? l10n.itemsSmallCase
- : widget.hasVideos
- ? l10n.videosSmallCase
- : l10n.photosSmallCase;
+ final title = l10n.deleteItemsQuestion(count: widget.count);
final body = widget.count == 1 && widget.isLocal && widget.isRemote
- ? l10n.singleFileInBothLocalAndRemote(fileType: fileType)
+ ? l10n.singleFileInBothLocalAndRemote(fileType: "item")
: widget.count == 1 && widget.isRemote
- ? l10n.singleFileInRemoteOnly(fileType: fileType)
+ ? l10n.singleFileInRemoteOnly(fileType: "item")
: widget.count == 1 && widget.isLocal
- ? l10n.singleFileDeleteFromDevice(fileType: fileType)
+ ? l10n.singleFileDeleteFromDevice(fileType: "Item")
: widget.isLocal && widget.isRemote
- ? l10n.someSelectedFilesBackedUpToEnte(fileTypes: fileTypes)
+ ? l10n.someSelectedFilesBackedUpToEnte(fileTypes: "items")
: widget.isRemote
- ? l10n.selectedFilesBackedUpToEnte(fileTypes: fileTypes)
- : l10n.selectedFilesSavedOnDeviceOnly(fileTypes: fileTypes);
- // Default delete target
+ ? l10n.selectedFilesBackedUpToEnte(fileTypes: "items")
+ : l10n.selectedFilesSavedOnDeviceOnly(fileTypes: "Items");
final deletePreference = (widget.isLocal && !widget.isRemote)
? DeletePreference.DeleteFromLocalOnly
: (widget.isRemote && !widget.isLocal)
? DeletePreference.DeleteFromRemoteOnly
: localSettings.getDeletePreference() ??
DeletePreference.DeleteFromBoth;
- // Shared delete runner
Future<void> onDelete(Future<void> Function() callback) async {
try {
await callback();
diff --git a/mobile/apps/photos/test/utils/delete_file_util_test.dart b/mobile/apps/photos/test/utils/delete_file_util_test.dart
index 6c2aa7f17c..d8beab0159 100644
--- a/mobile/apps/photos/test/utils/delete_file_util_test.dart
+++ b/mobile/apps/photos/test/utils/delete_file_util_test.dart
@@ -94,13 +94,10 @@ void main() {
expect(find.byType(BottomSheetComponent), findsOneWidget);
_expectDeleteWarningIllustration('assets/warning-red.png');
expect(
- find.text(
- 'This photo is saved on this device and backed up to Ente. '
- 'It will be removed from all albums.',
- ),
+ find.text('This item is available on your device and Ente.'),
findsOneWidget,
);
- expect(find.text('Delete photo?'), findsOneWidget);
+ expect(find.text('Delete item?'), findsOneWidget);
expect(find.byType(RadioComponent), findsNothing);
expect(find.byType(MenuGroupComponent), findsNothing);
expect(find.byType(MenuComponent), findsNothing);
@@ -137,6 +134,54 @@ void main() {
},
);
+ testWidgets('plural delete sheet copy matches deletion context', (
+ tester,
+ ) async {
+ final mixedFiles = [
+ _file(generatedID: 17, uploadedID: 27, localID: 'local-17'),
+ _file(generatedID: 18, uploadedID: 28, localID: 'local-18'),
+ ];
+ final mixedSelection = SelectedFiles()..selectAll(mixedFiles.toSet());
+ await _pumpDeleteSheet(
+ tester,
+ selectedFiles: mixedSelection,
+ split: FilesSplit(
+ pendingUploads: const [],
+ ownedByCurrentUser: mixedFiles,
+ ownedByOtherUsers: const [],
+ ),
+ );
+ expect(find.text('Delete 2 items?'), findsOneWidget);
+ expect(
+ find.text('These items are available on device and Ente.'),
+ findsOneWidget,
+ );
+ await tester.tap(find.byTooltip('Close'));
+ await tester.pumpAndSettle();
+ final remoteFiles = [
+ _file(generatedID: 19, uploadedID: 29),
+ _file(generatedID: 20, uploadedID: 30),
+ ];
+ final remoteSelection = SelectedFiles()..selectAll(remoteFiles.toSet());
+ await _pumpDeleteSheet(
+ tester,
+ selectedFiles: remoteSelection,
+ split: FilesSplit(
+ pendingUploads: const [],
+ ownedByCurrentUser: remoteFiles,
+ ownedByOtherUsers: const [],
+ ),
+ );
+ expect(find.text('Delete 2 items?'), findsOneWidget);
+ expect(
+ find.text(
+ 'These items will be deleted from all albums. '
+ 'You can recover them from Trash.',
+ ),
+ findsOneWidget,
+ );
+ });
+
testWidgets(
'mixed delete from Ente choice uses the remote delete path and clears selection',
(tester) async {
@@ -254,12 +299,13 @@ void main() {
expect(
find.text(
- 'This photo is backed up to Ente. It will be removed from all albums.',
+ 'This item will be deleted from all albums. '
+ 'You can recover it from Trash.',
),
findsOneWidget,
);
_expectDeleteWarningIllustration('assets/warning-red.png');
- expect(find.text('Delete photo?'), findsOneWidget);
+ expect(find.text('Delete item?'), findsOneWidget);
expect(find.text('They will be deleted from all albums.'), findsNothing);
expect(find.byType(ButtonComponent), findsOneWidget);
final deleteButton = tester.widget<ButtonComponent>(
@@ -290,11 +336,11 @@ void main() {
);
expect(
- find.text('This photo is saved on this device only.'),
+ find.text('Item not backed up. Permanently delete from device?'),
findsOneWidget,
);
_expectDeleteWarningIllustration('assets/warning-red.png');
- expect(find.text('Delete photo?'), findsOneWidget);
+ expect(find.text('Delete item?'), findsOneWidget);
expect(find.text('They will be deleted from all albums.'), findsNothing);
expect(find.byType(ButtonComponent), findsOneWidget);
final deleteButton = tester.widget<ButtonComponent>(