Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] add animation to more options and add descriptions to localizations

Priyanshu Dangare7aad6825bbb6
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index 10a4260fbf..b54fad7e2d 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -443,10 +443,20 @@
"photoSmallCase": "photo",
"singleFileDeleteHighlight": "It will be deleted from all albums.",
"singleFileInBothLocalAndRemote": "This item is available on your device and Ente.",
+ "@singleFileInBothLocalAndRemote": {
+ "description": "Delete confirmation message for a single item that exists both on the device and in Ente."
+ },
"singleFileInRemoteOnly": "This item will be deleted from all albums. You can recover it from Trash.",
+ "@singleFileInRemoteOnly": {
+ "description": "Delete confirmation message for a single item that exists only in Ente."
+ },
"singleFileDeleteFromDevice": "Item not backed up. Permanently delete from device?",
+ "@singleFileDeleteFromDevice": {
+ "description": "Delete confirmation message for a single item that exists only on the device."
+ },
"deleteItemsQuestion": "{count, plural, one {Delete item?} other {Delete {count} items?}}",
"@deleteItemsQuestion": {
+ "description": "Delete confirmation title for one or more selected items.",
"placeholders": {
"count": {
"type": "int"
@@ -454,8 +464,17 @@
}
},
"selectedFilesSavedOnDeviceOnly": "Items not backed up. Permanently delete from device?",
+ "@selectedFilesSavedOnDeviceOnly": {
+ "description": "Delete confirmation message for selected items that exist only on the device."
+ },
"selectedFilesBackedUpToEnte": "These items will be deleted from all albums. You can recover them from Trash.",
+ "@selectedFilesBackedUpToEnte": {
+ "description": "Delete confirmation message for selected items that are backed up to Ente."
+ },
"someSelectedFilesBackedUpToEnte": "These items are available on device and Ente.",
+ "@someSelectedFilesBackedUpToEnte": {
+ "description": "Delete confirmation message for selected items that exist both on the device and in Ente."
+ },
"deleteFromEnte": "Delete from Ente",
"yesDelete": "Yes, delete",
"movedToTrash": "Moved to trash",
@@ -463,7 +482,13 @@
"deleteFromDevice": "Delete from device",
"deleteFromBoth": "Delete from both",
"moreOptions": "More options",
+ "@moreOptions": {
+ "description": "Button label for showing additional delete options."
+ },
"setAsMyDefaultChoice": "Set as my default choice",
+ "@setAsMyDefaultChoice": {
+ "description": "Checkbox label for saving the selected delete action as the default choice."
+ },
"newAlbum": "New album",
"albums": "Albums",
"ente": "Ente",
@@ -648,6 +673,14 @@
"noDeviceThatCanBeDeleted": "You've no files on this device that can be deleted",
"removeDuplicates": "Remove duplicates",
"removeDuplicatesDesc": "Review and remove files that are exact duplicates.",
+ "mediaManagementHintTitle": "Tired of confirming every delete?",
+ "@mediaManagementHintTitle": {
+ "description": "Title of a sheet prompting Android users to enable media management permission."
+ },
+ "mediaManagementHintMessage": "Turn on media management for Ente in settings, and the prompts stop.",
+ "@mediaManagementHintMessage": {
+ "description": "Message explaining that enabling Android media management permission avoids repeated delete confirmations."
+ },
"viewLargeFiles": "Large files",
"viewLargeFilesDesc": "View files that are consuming the most amount of storage.",
"deleteSuggestions": "Delete suggestions",
diff --git a/mobile/apps/photos/lib/utils/delete_file_util.dart b/mobile/apps/photos/lib/utils/delete_file_util.dart
index 64aade8761..b297a4ba4f 100644
--- a/mobile/apps/photos/lib/utils/delete_file_util.dart
+++ b/mobile/apps/photos/lib/utils/delete_file_util.dart
@@ -768,9 +768,8 @@ Future<void> showMediaManagementHintSheet(BuildContext context) async {
context: context,
useRootNavigator: Platform.isIOS,
builder: (sheetContext) => BottomSheetComponent(
- title: "Tired of confirming every delete?",
- message:
- "Turn on media management for Ente in settings, and the prompts stop.",
+ title: l10n.mediaManagementHintTitle,
+ message: l10n.mediaManagementHintMessage,
illustration: Image.asset("assets/ducky_smart_feature.png"),
closeTooltip: l10n.close,
closeResult: true,
@@ -1100,59 +1099,89 @@ class DeleteConfirmationSheetState extends State<DeleteConfirmationSheet> {
actionsTopSpacing: Spacing.xxl,
actions: [
// Expanded target choices
- if (_isMoreOptionsShown) ...[
- ButtonComponent(
- label: l10n.deleteFromDevice,
- variant: ButtonComponentVariant.secondary,
- onTap: () async {
- if (_isSetAsDefaultSelected) {
- await localSettings.setDeletePreference(.DeleteFromLocalOnly);
- }
- await _onDelete(context, widget.onDeleteFromLocal);
- },
- ),
- ButtonComponent(
- label: l10n.deleteFromEnte,
- variant: ButtonComponentVariant.secondary,
- onTap: () async {
- if (_isSetAsDefaultSelected) {
- await localSettings.setDeletePreference(.DeleteFromRemoteOnly);
- }
- await _onDelete(context, widget.onDeleteFromRemote);
+ AnimatedSize(
+ duration: const Duration(milliseconds: 200),
+ curve: Curves.easeOut,
+ alignment: Alignment.bottomCenter,
+ child: AnimatedSwitcher(
+ duration: const Duration(milliseconds: 200),
+ switchInCurve: Curves.easeOut,
+ switchOutCurve: Curves.easeOut,
+ transitionBuilder: (child, animation) {
+ return FadeTransition(opacity: animation, child: child);
},
- ),
- ButtonComponent(
- label: l10n.deleteFromBoth,
- variant: ButtonComponentVariant.critical,
- onTap: () async {
- if (_isSetAsDefaultSelected) {
- await localSettings.setDeletePreference(.DeleteFromBoth);
- }
- await _onDelete(context, widget.onDeleteFromBoth);
- },
- ),
- ] else ...[
- // Preferred target shortcut
- ButtonComponent(
- key: const ValueKey('DeleteConfirmationSheet.default'),
- label: switch (deletePreference) {
- DeletePreference.DeleteFromRemoteOnly => l10n.deleteFromEnte,
- DeletePreference.DeleteFromLocalOnly => l10n.deleteFromDevice,
- DeletePreference.DeleteFromBoth => l10n.deleteFromBoth,
- },
- variant: ButtonComponentVariant.critical,
- onTap: () async {
- switch (deletePreference) {
- case DeletePreference.DeleteFromRemoteOnly:
- await _onDelete(context, widget.onDeleteFromRemote);
- case DeletePreference.DeleteFromLocalOnly:
- await _onDelete(context, widget.onDeleteFromLocal);
- case DeletePreference.DeleteFromBoth:
- await _onDelete(context, widget.onDeleteFromBoth);
- }
+ layoutBuilder: (currentChild, previousChildren) {
+ return Stack(
+ alignment: Alignment.bottomCenter,
+ children: [...previousChildren, ?currentChild],
+ );
},
+ child: (_isMoreOptionsShown)
+ ? Column(
+ spacing: Spacing.md,
+ children: [
+ ButtonComponent(
+ label: l10n.deleteFromDevice,
+ variant: ButtonComponentVariant.secondary,
+ onTap: () async {
+ if (_isSetAsDefaultSelected) {
+ await localSettings.setDeletePreference(
+ .DeleteFromLocalOnly,
+ );
+ }
+ await _onDelete(context, widget.onDeleteFromLocal);
+ },
+ ),
+ ButtonComponent(
+ label: l10n.deleteFromEnte,
+ variant: ButtonComponentVariant.secondary,
+ onTap: () async {
+ if (_isSetAsDefaultSelected) {
+ await localSettings.setDeletePreference(
+ .DeleteFromRemoteOnly,
+ );
+ }
+ await _onDelete(context, widget.onDeleteFromRemote);
+ },
+ ),
+ ButtonComponent(
+ label: l10n.deleteFromBoth,
+ variant: ButtonComponentVariant.critical,
+ onTap: () async {
+ if (_isSetAsDefaultSelected) {
+ await localSettings.setDeletePreference(
+ .DeleteFromBoth,
+ );
+ }
+ await _onDelete(context, widget.onDeleteFromBoth);
+ },
+ ),
+ ],
+ )
+ :
+ // Preferred target shortcut
+ ButtonComponent(
+ label: switch (deletePreference) {
+ DeletePreference.DeleteFromRemoteOnly =>
+ l10n.deleteFromEnte,
+ DeletePreference.DeleteFromLocalOnly =>
+ l10n.deleteFromDevice,
+ DeletePreference.DeleteFromBoth => l10n.deleteFromBoth,
+ },
+ variant: ButtonComponentVariant.critical,
+ onTap: () async {
+ switch (deletePreference) {
+ case DeletePreference.DeleteFromRemoteOnly:
+ await _onDelete(context, widget.onDeleteFromRemote);
+ case DeletePreference.DeleteFromLocalOnly:
+ await _onDelete(context, widget.onDeleteFromLocal);
+ case DeletePreference.DeleteFromBoth:
+ await _onDelete(context, widget.onDeleteFromBoth);
+ }
+ },
+ ),
),
- ],
+ ),
// Preference control
if (widget.isLocal && widget.isRemote)
ConstrainedBox(