π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Add trash to free up space (#11878)
Aman Rajd2bab422ebc4
diff --git a/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart b/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dartindex 7c5ede5479..dc94bff64f 100644--- a/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart+++ b/mobile/apps/photos/lib/ui/settings/backup/free_space_options.dart@@ -6,6 +6,7 @@ import "package:ente_pure_utils/ente_pure_utils.dart";import "package:ente_strings/ente_strings.dart";import "package:flutter/foundation.dart" show kDebugMode;import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";import "package:photos/models/duplicate_files.dart";import "package:photos/models/freeable_space_info.dart";import "package:photos/service_locator.dart";@@ -14,6 +15,7 @@ import "package:photos/services/deduplication_service.dart";import "package:photos/services/files_service.dart";import "package:photos/ui/components/models/button_type.dart";import "package:photos/ui/notification/toast.dart";+import "package:photos/ui/settings/components/settings_item.dart";import "package:photos/ui/settings/components/settings_page_scaffold.dart";import "package:photos/ui/tools/debug/app_storage_viewer.dart";import "package:photos/ui/tools/deduplicate_page.dart";@@ -21,6 +23,7 @@ import "package:photos/ui/tools/free_space_page.dart";import "package:photos/ui/tools/similar_images_page.dart";import "package:photos/ui/viewer/gallery/delete_suggestions_page.dart";import "package:photos/ui/viewer/gallery/large_files_page.dart";+import "package:photos/ui/viewer/gallery/trash_page.dart";import "package:photos/utils/dialog_util.dart";class FreeUpSpaceOptionsScreen extends StatefulWidget {@@ -45,91 +48,96 @@ class _FreeUpSpaceOptionsScreenState extends State<FreeUpSpaceOptionsScreen> {title: l10n.freeUpSpace,children: [_buildFreeSpaceOption(- context,- title: l10n.freeUpDeviceSpace,- onTap: () async => _onFreeUpDeviceSpaceTapped(),- ),- _description(- l10n.freeUpDeviceSpaceDesc +- (Platform.isIOS ? " ${l10n.freeUpDeviceSpaceDescICloud}" : ""),- ),- _buildFreeSpaceOption(- context,- title: l10n.removeDuplicates,- onTap: () async => _onRemoveDuplicatesTapped(),- ),- _description(l10n.removeDuplicatesDesc),- if (flagService.enableVectorDb) ...[- _buildFreeSpaceOption(- context,- title: l10n.similarImages,- onTap: () async {- await routeToPage(- context,- const SimilarImagesPage(debugScreen: kDebugMode),- );- },- ),- _description(l10n.useMLToFindSimilarImages),- ],- _buildFreeSpaceOption(- context,- title: l10n.viewLargeFiles,+ title: l10n.trash,+ subtitle: l10n.restoreOrPermanentlyDeleteItems,+ icon: HugeIcons.strokeRoundedDelete01,onTap: () async {- await routeToPage(context, LargeFilesPagePage());+ await routeToPage(context, TrashPage());},),- _description(l10n.viewLargeFilesDesc),+ const SizedBox(height: Spacing.sm),_buildFreeSpaceOption(- context,- title: l10n.deleteSuggestions,- onTap: () async => _onDeleteSuggestionsTapped(),+ title: l10n.freeUpDeviceSpace,+ subtitle:+ l10n.freeUpDeviceSpaceDesc ++ (Platform.isIOS ? " ${l10n.freeUpDeviceSpaceDescICloud}" : ""),+ icon: HugeIcons.strokeRoundedSmartPhone01,+ onTap: () async => _onFreeUpDeviceSpaceTapped(),+ ),+ const SizedBox(height: Spacing.lg),+ Text(+ l10n.review,+ style: TextStyles.display3.copyWith(+ color: context.componentColors.textBase,+ ),),- _description(l10n.deleteSuggestionsDesc),+ const SizedBox(height: Spacing.sm),+ _buildReviewOptions(context, l10n),+ const SizedBox(height: Spacing.lg),_buildFreeSpaceOption(- context,title: l10n.manageDeviceStorage,+ subtitle: l10n.manageDeviceStorageDesc,+ icon: HugeIcons.strokeRoundedDatabase,onTap: () async {await routeToPage(context, const AppStorageViewer());},),- _description(l10n.manageDeviceStorageDesc),],);}- Widget _description(String text) {- return Padding(- padding: const EdgeInsets.only(- left: Spacing.lg,- right: Spacing.lg,- top: Spacing.sm,- bottom: Spacing.lg,- ),- child: Text(- text,- style: TextStyles.mini.copyWith(- color: context.componentColors.textLight,+ Widget _buildReviewOptions(BuildContext context, StringsLocalizations l10n) {+ final options = <Widget>[+ if (flagService.enableVectorDb)+ _buildFreeSpaceOption(+ title: l10n.similarImages,+ subtitle: l10n.useMLToFindSimilarImages,+ icon: HugeIcons.strokeRoundedImageCrop,+ onTap: () async {+ await routeToPage(+ context,+ const SimilarImagesPage(debugScreen: kDebugMode),+ );+ },),+ _buildFreeSpaceOption(+ title: l10n.removeDuplicates,+ subtitle: l10n.removeDuplicatesDesc,+ icon: HugeIcons.strokeRoundedCopy01,+ onTap: () async => _onRemoveDuplicatesTapped(),),- );+ _buildFreeSpaceOption(+ title: l10n.viewLargeFiles,+ subtitle: l10n.viewLargeFilesDesc,+ icon: HugeIcons.strokeRoundedFile02,+ onTap: () async {+ await routeToPage(context, LargeFilesPagePage());+ },+ ),+ _buildFreeSpaceOption(+ title: l10n.deleteSuggestions,+ subtitle: l10n.deleteSuggestionsDesc,+ icon: HugeIcons.strokeRoundedDelete01,+ onTap: () async => _onDeleteSuggestionsTapped(),+ ),+ ];++ return MenuGroupComponent(items: options);}- MenuComponent _buildFreeSpaceOption(- BuildContext context, {+ SettingsItem _buildFreeSpaceOption({required String title,+ required String subtitle,+ required List<List<dynamic>> icon,required Future<void> Function() onTap,}) {- final colors = context.componentColors;- return MenuComponent(+ return SettingsItem(title: title,- trailing: Icon(- Icons.chevron_right_outlined,- color: colors.textLight,- size: IconSizes.medium,- ),+ subtitle: subtitle,+ icon: icon,showOnlyLoadingState: true,onTap: onTap,+ subtitleMaxLines: 2,);}diff --git a/mobile/apps/photos/lib/ui/settings/search/settings_search_registry.dart b/mobile/apps/photos/lib/ui/settings/search/settings_search_registry.dartindex f8794c2e4d..19af1a34b9 100644--- a/mobile/apps/photos/lib/ui/settings/search/settings_search_registry.dart+++ b/mobile/apps/photos/lib/ui/settings/search/settings_search_registry.dart@@ -568,6 +568,20 @@ class SettingsSearchRegistry {);items.addAll([+ SettingsSearchItem(+ title: l10n.trash,+ subtitle: l10n.freeUpSpace,+ sectionPath: l10n.freeUpSpace,+ icon: HugeIcons.strokeRoundedDelete01,+ routeBuilder: (_) => const FreeUpSpaceOptionsScreen(),+ isSubPage: true,+ keywords: [+ "trash",+ "recently deleted",+ "restore",+ "permanently delete",+ ],+ ),SettingsSearchItem(title: l10n.freeUpDeviceSpace,subtitle: l10n.freeUpSpace,diff --git a/mobile/packages/strings/lib/l10n/arb/strings_en.arb b/mobile/packages/strings/lib/l10n/arb/strings_en.arbindex a8b7183c01..cbf65805a3 100644--- a/mobile/packages/strings/lib/l10n/arb/strings_en.arb+++ b/mobile/packages/strings/lib/l10n/arb/strings_en.arb@@ -1040,7 +1040,7 @@"deleteSharedAlbumDialogBody": "The album will be deleted for everyone\n\nYou will lose access to shared photos in this album that are owned by others","deleteShareLinkConfirmation": "People with this link will no longer be able to access the item.","deleteSuggestions": "Delete suggestions",- "deleteSuggestionsDesc": "Review files that have been suggested for deletion.",+ "deleteSuggestionsDesc": "View items suggested for deletion","deleteSuggestionSent": "Delete suggestion sent","deleteTagMessage": "Are you sure you want to delete this tag? This action is irreversible.","deleteTagTitle": "Delete tag?",@@ -1775,8 +1775,8 @@"count": {}}},- "freeUpDeviceSpaceDesc": "Save space on your device by clearing files that have already been backed up.",- "freeUpDeviceSpaceDescICloud": "Files in iCloud shared albums cannot be cleared.",+ "freeUpDeviceSpaceDesc": "Remove backed up items.",+ "freeUpDeviceSpaceDescICloud": "Files in iCloud shared albums cannot be cleared","@freeUpDeviceSpaceDescICloud": {"description": "Here 'cleared' means 'deleted' from the device"},@@ -2281,7 +2281,7 @@},"manage": "Manage","manageDeviceStorage": "Manage device cache",- "manageDeviceStorageDesc": "Review and clear local cache storage.",+ "manageDeviceStorageDesc": "Review and clear local storage","manageFamily": "Manage family","manageLink": "Manage link","manageParticipants": "Manage",@@ -3154,8 +3154,8 @@"description": "Description for remove contact confirmation dialog"},"removeContactPhoto": "Remove contact photo",- "removeDuplicates": "Remove duplicates",- "removeDuplicatesDesc": "Review and remove files that are exact duplicates.",+ "removeDuplicates": "Duplicates",+ "removeDuplicatesDesc": "Remove exact duplicates","removeFromAlbum": "Remove from album","removeFromAlbumTitle": "Remove from album?","removeFromFamily": "Remove from family",@@ -4084,6 +4084,7 @@},"totalSize": "Total size","trash": "Trash",+ "restoreOrPermanentlyDeleteItems": "Restore or permanently delete items","trashClearedSuccessfully": "Trash cleared successfully","trashCode": "Trash code?","trashCodeMessage": "Are you sure you want to trash code for {account}?",@@ -4313,7 +4314,7 @@"useAsCover": "Use as cover","usedSpace": "Used space","usedYourCode": "used your code",- "useMLToFindSimilarImages": "Review and remove images that look similar to each other.",+ "useMLToFindSimilarImages": "Remove items that look similar","useOffline": "Use without backups","useRecoveryKey": "Use recovery key","@useRecoveryKey": {@@ -4392,7 +4393,7 @@"description": "Number of viewers that were successfully added."},"viewLargeFiles": "Large files",- "viewLargeFilesDesc": "View files that are consuming the most amount of storage.",+ "viewLargeFilesDesc": "Identify items using the most space","viewLogs": "View logs","@viewLogs": {"description": "Button to view logs"