Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add haptic feedback for swipe-to-select contracting and initial selection

ashilkn58a9950f6776
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 4152571087..d00f643d36 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
@@ -46,8 +46,10 @@ class SwipeToSelectHelper {
// Immediately select/deselect the starting file based on mode
if (_selecting == true) {
selectedFiles.selectAll({file});
+ HapticFeedback.selectionClick();
} else {
selectedFiles.unSelectAll({file});
+ HapticFeedback.selectionClick();
}
}
@@ -103,6 +105,7 @@ class SwipeToSelectHelper {
final itemsToRemove = getRange(fromIndex + 1, lastToIndex + 1);
if (itemsToRemove.isNotEmpty) {
selectedFiles.unSelectAll(itemsToRemove);
+ HapticFeedback.selectionClick();
}
}
} else if (lastToIndex < toIndex) {
@@ -110,6 +113,7 @@ class SwipeToSelectHelper {
final itemsToRemove = getRange(lastToIndex, toIndex);
if (itemsToRemove.isNotEmpty) {
selectedFiles.unSelectAll(itemsToRemove);
+ HapticFeedback.selectionClick();
}
}
} else if (fromIndex < toIndex) {
@@ -126,6 +130,7 @@ class SwipeToSelectHelper {
final itemsToRemove = getRange(lastToIndex, fromIndex);
if (itemsToRemove.isNotEmpty) {
selectedFiles.unSelectAll(itemsToRemove);
+ HapticFeedback.selectionClick();
}
}
} else if (toIndex < lastToIndex) {
@@ -133,6 +138,7 @@ class SwipeToSelectHelper {
final itemsToRemove = getRange(toIndex + 1, lastToIndex + 1);
if (itemsToRemove.isNotEmpty) {
selectedFiles.unSelectAll(itemsToRemove);
+ HapticFeedback.selectionClick();
}
}
}
@@ -152,6 +158,7 @@ class SwipeToSelectHelper {
final itemsToAdd = getRange(fromIndex + 1, lastToIndex + 1);
if (itemsToAdd.isNotEmpty) {
selectedFiles.selectAll(itemsToAdd);
+ HapticFeedback.selectionClick();
}
}
} else if (lastToIndex < toIndex) {
@@ -159,6 +166,7 @@ class SwipeToSelectHelper {
final itemsToAdd = getRange(lastToIndex, toIndex);
if (itemsToAdd.isNotEmpty) {
selectedFiles.selectAll(itemsToAdd);
+ HapticFeedback.selectionClick();
}
}
} else if (fromIndex < toIndex) {
@@ -176,6 +184,7 @@ class SwipeToSelectHelper {
final itemsToAdd = getRange(lastToIndex, fromIndex);
if (itemsToAdd.isNotEmpty) {
selectedFiles.selectAll(itemsToAdd);
+ HapticFeedback.selectionClick();
}
}
} else if (toIndex < lastToIndex) {
@@ -183,6 +192,7 @@ class SwipeToSelectHelper {
final itemsToAdd = getRange(toIndex + 1, lastToIndex + 1);
if (itemsToAdd.isNotEmpty) {
selectedFiles.selectAll(itemsToAdd);
+ HapticFeedback.selectionClick();
}
}
}