Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] Add trash delete-all FAB

Priyanshu Dangare4353ad73c629
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
index 5690dcce85..979f2c3f45 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery_app_bar_widget.dart
@@ -52,7 +52,6 @@ import "package:photos/ui/viewer/gallery/hooks/edit_album_details_sheet.dart";
import "package:photos/ui/viewer/gallery/state/inherited_search_filter_data.dart";
import "package:photos/ui/viewer/hierarchicial_search/app_bar_filter_chips.dart";
import "package:photos/ui/viewer/location/edit_location_sheet.dart";
-import 'package:photos/utils/delete_file_util.dart';
import 'package:photos/utils/dialog_util.dart';
import 'package:photos/utils/magic_util.dart';
@@ -178,7 +177,6 @@ enum AlbumPopupAction {
downloadAlbum,
sortByMostRecent,
sortByMostRelevant,
- emptyTrash,
editLocation,
deleteLocation,
galleryGuestView,
@@ -670,8 +668,6 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
await onCleanUncategorizedClick(context);
} else if (value == AlbumPopupAction.downloadAlbum) {
await _downloadPublicAlbumToGallery(widget.files!);
- } else if (value == AlbumPopupAction.emptyTrash) {
- await emptyTrash(context);
} else if (value == AlbumPopupAction.editLocation) {
editLocation();
} else if (value == AlbumPopupAction.deleteLocation) {
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
index 08a421b07a..abe6bae9dc 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/trash_page.dart
@@ -1,12 +1,14 @@
import "dart:io";
import "package:collection/collection.dart";
+import "package:ente_components/components/buttons/fab_component.dart";
import "package:ente_components/ente_components.dart";
import "package:ente_photos_platform/ente_photos_platform.dart"
show DeviceTrashClient;
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:ente_strings/extensions.dart";
import 'package:flutter/material.dart';
+import "package:hugeicons/hugeicons.dart";
import "package:photo_manager/photo_manager.dart";
import "package:photos/core/constants.dart";
import "package:photos/core/event_bus.dart";
@@ -27,6 +29,7 @@ import "package:photos/ui/viewer/gallery/gallery_app_bar_widget.dart";
import "package:photos/ui/viewer/gallery/state/gallery_boundaries_provider.dart";
import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";
import "package:photos/ui/viewer/gallery/state/selection_state.dart";
+import "package:photos/utils/delete_file_util.dart";
import "package:photos/utils/device_info.dart";
Future<void> showTrashPage(BuildContext context) async {
@@ -140,6 +143,23 @@ class _TrashPageState extends State<_TrashPage> {
],
),
),
+ floatingActionButton: Padding(
+ padding: const EdgeInsets.only(bottom: 4),
+ child: FABComponent(
+ label: l10n.deleteAll,
+ icon: const HugeIcon(icon: HugeIcons.strokeRoundedDelete02),
+ shouldShowSuccessConfirmation: false,
+ shouldShowSuccessState: false,
+ shouldSurfaceExecutionStates: false,
+ onTap: () async {
+ await emptyTrash(context, _isOnEnteTrash);
+ },
+ ),
+ ),
+ floatingActionButtonLocation:
+ FloatingActionButtonLocation.centerFloat,
+ floatingActionButtonAnimator:
+ FloatingActionButtonAnimator.noAnimation,
),
),
);
diff --git a/mobile/apps/photos/lib/utils/delete_file_util.dart b/mobile/apps/photos/lib/utils/delete_file_util.dart
index 0ad18b6b78..c0de6e5ba5 100644
--- a/mobile/apps/photos/lib/utils/delete_file_util.dart
+++ b/mobile/apps/photos/lib/utils/delete_file_util.dart
@@ -3,6 +3,7 @@ import 'dart:io';
import 'dart:math';
import 'package:ente_components/ente_components.dart';
+import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:ente_strings/ente_strings.dart";
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';