Skip to content

armgit / ente

Public Imported from GitHub
0

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

Use taps to select sharing albums

Neeraj Guptab03102ba8b3b
diff --git a/mobile/apps/photos/lib/ui/collections/flex_grid_view.dart b/mobile/apps/photos/lib/ui/collections/flex_grid_view.dart
index b395d0c413..b7b57022d3 100644
--- a/mobile/apps/photos/lib/ui/collections/flex_grid_view.dart
+++ b/mobile/apps/photos/lib/ui/collections/flex_grid_view.dart
@@ -52,7 +52,6 @@ class AlbumGridLayout {
}
typedef AlbumSelectionCallbacks = ({
- bool isSelectionModeActive,
bool Function(Collection) isSelected,
ValueChanged<Collection> toggle,
});
@@ -146,7 +145,7 @@ class _CollectionsFlexiGridViewWidgetState
}
bool get _togglesSelectionOnTap =>
- (widget.selectionCallbacks?.isSelectionModeActive ?? false) ||
+ widget.selectionCallbacks != null ||
isAnyAlbumSelected ||
widget.onlyAllowSelection;
@@ -160,7 +159,7 @@ class _CollectionsFlexiGridViewWidgetState
void _handleCollectionLongPress(Collection collection) {
if (widget.selectionCallbacks != null) {
- unawaited(_toggleAlbumSelection(collection));
+ unawaited(_navigateToCollectionPage(collection));
return;
}
unawaited(
diff --git a/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_controller.dart b/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_controller.dart
index 7b32a797e3..15dade98e8 100644
--- a/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_controller.dart
+++ b/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_controller.dart
@@ -47,7 +47,6 @@ class LibrarySharingController extends ChangeNotifier {
!_isLoading &&
_loadError == null &&
(_selectionMode != null || isFirstTime);
- bool get selectsAlbumsOnTap => _selectionMode != null || hasSelection;
bool get hasSelection => _selectedRoles.isNotEmpty;
int get selectedCount => _selectedRoles.length;
int get selectedActiveShareCount =>
diff --git a/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_page.dart b/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_page.dart
index e1bddd48db..f2132bf941 100644
--- a/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_page.dart
+++ b/mobile/apps/photos/lib/ui/sharing/library_sharing/library_sharing_page.dart
@@ -227,11 +227,10 @@ class _LibrarySharingPageState extends State<LibrarySharingPage> {
albums,
tag: 'library_sharing_${_recipient.userID}',
selectionCallbacks: (
- isSelectionModeActive: _controller.selectsAlbumsOnTap,
isSelected: _controller.isSelected,
toggle: _toggleAlbumSelection,
),
- enableSelectionMode: true,
+ enableSelectionMode: !_controller.isMutating,
gridTopLeftOverlayBuilder: _roleOverlay,
topPadding: Spacing.sm,
bottomPadding: _gridBottomPadding,
diff --git a/mobile/apps/photos/test/ui/sharing/library_sharing_controller_test.dart b/mobile/apps/photos/test/ui/sharing/library_sharing_controller_test.dart
index bff0ea1377..f0d85c6b43 100644
--- a/mobile/apps/photos/test/ui/sharing/library_sharing_controller_test.dart
+++ b/mobile/apps/photos/test/ui/sharing/library_sharing_controller_test.dart
@@ -7,25 +7,6 @@ import 'package:photos/ui/sharing/library_sharing/library_sharing_controller.dar
import 'library_sharing_test_helpers.dart';
void main() {
- test('first-time tap selection starts after an album is selected', () async {
- final repository = FakeLibrarySharingRepository([
- librarySharingTestAlbum(1),
- ]);
- final controller = LibrarySharingController(
- recipient: librarySharingTestRecipient,
- repository: repository,
- );
- await controller.load();
-
- expect(controller.selectsAlbumsOnTap, isFalse);
-
- controller.toggleSelection(repository.albums.single);
- expect(controller.selectsAlbumsOnTap, isTrue);
-
- controller.clearSelection();
- expect(controller.selectsAlbumsOnTap, isFalse);
- });
-
test('shares a new album and returns to the shared overview', () async {
final repository = FakeLibrarySharingRepository([
librarySharingTestAlbum(