Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] Hide album sorting during file selection

r4khuled7a7598e1f8
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
index e57c359fcd..a106d566ea 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
@@ -194,7 +194,13 @@ class _CollectionPageState extends State<CollectionPage> {
addHeaderOrFooterEmptyState: false,
showSelectAll: true,
groupHeaderAction: galleryType.canSort()
- ? _SortButton(c.collection)
+ ? ListenableBuilder(
+ listenable: _selectedFiles,
+ builder: (context, child) => _selectedFiles.files.isEmpty
+ ? child!
+ : const SizedBox.shrink(),
+ child: _SortButton(c.collection),
+ )
: null,
emptyState: galleryType == GalleryType.ownedCollection
? EmptyAlbumState(
diff --git a/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart b/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart
index d0368d8843..e92bc3828c 100644
--- a/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart
+++ b/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart
@@ -169,9 +169,11 @@ void main() {
.widget<GalleryAppBarWidget>(find.byType(GalleryAppBarWidget))
.selectedFiles;
expect(find.byType(AlbumCoverActionButton), findsNWidgets(2));
+ expect(find.byTooltip("Sort"), findsOneWidget);
selectedFiles.toggleSelection(newest);
await tester.pumpAndSettle();
expect(find.byType(AlbumCoverActionButton), findsNothing);
+ expect(find.byTooltip("Sort"), findsNothing);
await tester.tap(find.byType(SelectAllButton));
await tester.pumpAndSettle();
expect(selectedFiles.files, containsAll([oldest, newest]));
@@ -179,6 +181,7 @@ void main() {
await tester.pumpAndSettle();
expect(selectedFiles.files, isEmpty);
expect(find.byType(AlbumCoverActionButton), findsNWidgets(2));
+ expect(find.byTooltip("Sort"), findsOneWidget);
collection.pubMagicMetadata = CollectionPubMagicMetadata(asc: true);
Bus.instance.fire(