Skip to content

armgit / ente

Public Imported from GitHub
0

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

Skip dummy files in swipe-to-select operations

ashilkn6bd2ee718a80
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
index 9db4eff5f4..04ce6d71be 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart
@@ -480,9 +480,11 @@ class GalleryState extends State<Gallery> {
flagService.internalUser) {
// Dispose existing helper if present
_swipeHelper?.dispose();
- // Always create a new helper with the current file list
+ // Use allFilesWithDummies to match the rendered grid structure.
+ // This allows SwipeHelper to track pointer position through dummy
+ // placeholders while filtering them from selection operations.
_swipeHelper = SwipeToSelectHelper(
- allFiles: _allGalleryFiles,
+ allFiles: galleryGroups.allFilesWithDummies,
selectedFiles: widget.selectedFiles!,
);
}
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/swipe_to_select_helper.dart b/mobile/apps/photos/lib/ui/viewer/gallery/swipe_to_select_helper.dart
index aa151e97b9..a5bad48f8d 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/swipe_to_select_helper.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/swipe_to_select_helper.dart
@@ -1,5 +1,6 @@
import 'dart:math';
+import 'package:photos/models/file/dummy_file.dart';
import 'package:photos/models/file/file.dart';
import 'package:photos/models/selected_files.dart';
@@ -43,7 +44,8 @@ class SwipeToSelectHelper {
_selecting = forceSelecting ?? !selectedFiles.isFileSelected(file);
// If we're in selecting mode, immediately select the starting file
- if (_selecting == true) {
+ // But skip if it's a DummyFile (dummies are not selectable)
+ if (_selecting == true && file is! DummyFile) {
selectedFiles.selectAll({file});
}
}
@@ -76,10 +78,13 @@ class SwipeToSelectHelper {
final lastToIndex = _lastToIndex!;
final selecting = _selecting!;
- // Helper function to get range of files
+ // Helper function to get range of files, excluding DummyFiles
Set<EnteFile> getRange(int start, int end) {
if (start < end && start >= 0 && end <= allFiles.length) {
- return allFiles.getRange(start, end).toSet();
+ return allFiles
+ .getRange(start, end)
+ .where((file) => file is! DummyFile)
+ .toSet();
}
return {};
}