Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] Remove album header text-sheet shortcuts

r4khul7a8c206c0ec3
diff --git a/mobile/apps/photos/changes/album-cover-redesign.md b/mobile/apps/photos/changes/album-cover-redesign.md
index 393be66655..95cc53da47 100644
--- a/mobile/apps/photos/changes/album-cover-redesign.md
+++ b/mobile/apps/photos/changes/album-cover-redesign.md
@@ -1,3 +1 @@
- Refreshed the album page with a full cover, smooth thumbnail transitions, quick slideshow and map buttons, and a simpler options sheet.
-- Open full album titles and descriptions from the header, with editing for album owners.
-- Improved album header alignment and controls across phones and tablets.
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/component/album_cover_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/gallery/component/album_cover_app_bar.dart
index 7450c3bd36..9b3bcda232 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/component/album_cover_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/component/album_cover_app_bar.dart
@@ -29,7 +29,6 @@ class AlbumCoverAppBar extends StatefulWidget {
required this.collapsedHeight,
this.heroTag,
this.bottom,
- this.onDetailsTap,
});
final Collection collection;
@@ -41,7 +40,6 @@ class AlbumCoverAppBar extends StatefulWidget {
final double collapsedHeight;
final String? heroTag;
final PreferredSizeWidget? bottom;
- final VoidCallback? onDetailsTap;
static HeaderAppBarGeometry resolveGeometry(
BuildContext context, {
@@ -121,7 +119,6 @@ class _AlbumCoverAppBarState extends State<AlbumCoverAppBar> with RouteAware {
isCovered: _isCovered,
title: widget.title,
actionsBuilder: widget.actionsBuilder,
- onDetailsTap: widget.onDetailsTap,
bottom: widget.bottom,
photo: _CoverPhoto(
cover: widget.cover,
@@ -135,37 +132,27 @@ class _AlbumCoverAppBarState extends State<AlbumCoverAppBar> with RouteAware {
_CoverCaption(
GalleryFilesState.maybeOf(context)?.galleryFilesOrNull,
),
- GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: widget.onDetailsTap,
- child: Semantics(
- header: true,
- child: Text(
- widget.title,
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- textAlign: TextAlign.center,
- style: TextStyles.display1.copyWith(
- color: colors.specialWhite,
- ),
- ),
+ Semantics(
+ header: true,
+ child: Text(
+ widget.title,
+ maxLines: 2,
+ overflow: TextOverflow.ellipsis,
+ textAlign: TextAlign.center,
+ style: TextStyles.display1.copyWith(color: colors.specialWhite),
),
),
if (description != null) ...[
const SizedBox(height: Spacing.sm),
- GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: widget.onDetailsTap,
- child: Padding(
- padding: const EdgeInsets.symmetric(horizontal: 18),
- child: Text(
- description,
- maxLines: _descriptionMaxLines,
- overflow: TextOverflow.ellipsis,
- textAlign: TextAlign.center,
- style: TextStyles.mini.copyWith(
- color: colors.specialWhite.withValues(alpha: 0.92),
- ),
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 18),
+ child: Text(
+ description,
+ maxLines: _descriptionMaxLines,
+ overflow: TextOverflow.ellipsis,
+ textAlign: TextAlign.center,
+ style: TextStyles.mini.copyWith(
+ color: colors.specialWhite.withValues(alpha: 0.92),
),
),
),
@@ -653,7 +640,6 @@ class _AlbumCoverDelegate extends SliverPersistentHeaderDelegate {
required this.bottom,
required this.photo,
required this.content,
- required this.onDetailsTap,
});
final HeaderAppBarGeometry geometry;
@@ -667,7 +653,6 @@ class _AlbumCoverDelegate extends SliverPersistentHeaderDelegate {
final String title;
final List<Widget> Function(Color foregroundColor) actionsBuilder;
final PreferredSizeWidget? bottom;
- final VoidCallback? onDetailsTap;
final Widget photo;
final Widget content;
@@ -797,21 +782,14 @@ class _AlbumCoverDelegate extends SliverPersistentHeaderDelegate {
Expanded(
child: ExcludeSemantics(
excluding: contentOpacity > 0,
- child: IgnorePointer(
- ignoring: titleOpacity == 0,
- child: Opacity(
- opacity: titleOpacity,
- child: GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: onDetailsTap,
- child: Text(
- title,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyles.display3.copyWith(
- color: foregroundColor,
- ),
- ),
+ child: Opacity(
+ opacity: titleOpacity,
+ child: Text(
+ title,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyles.display3.copyWith(
+ color: foregroundColor,
),
),
),
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 48313a2638..79bad10e10 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
@@ -365,9 +365,6 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
cover: widget.cover!,
heroTag: widget.coverHeroTag,
title: _appBarTitle,
- onDetailsTap: widget.selectedFiles.files.isEmpty
- ? () => _showAlbumDetails(context)
- : null,
backgroundColor: GalleryAppBarWidget.backgroundColor(context),
collapsedHeight: GalleryAppBarWidget.toolbarHeight,
bottom: bottom,
@@ -391,42 +388,6 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
);
}
- Future<void> _showAlbumDetails(BuildContext context) async {
- if (galleryType.canEditDetails()) {
- await _editAlbumDetails(context);
- return;
- }
-
- await showBottomSheetComponent<void>(
- context: context,
- builder: (context) => BottomSheetComponent(
- title: context.strings.details,
- closeTooltip: context.strings.close,
- isScrollable: true,
- content: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- _appBarTitle,
- style: TextStyles.h2.copyWith(
- color: context.componentColors.textBase,
- ),
- ),
- if (widget.collection!.displayDescription != null) ...[
- const SizedBox(height: Spacing.lg),
- Text(
- widget.collection!.displayDescription!,
- style: TextStyles.body.copyWith(
- color: context.componentColors.textLight,
- ),
- ),
- ],
- ],
- ),
- ),
- );
- }
-
Future<void> _editAlbumDetails(BuildContext context) async {
final collection = widget.collection;
if (collection == null) {
diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/edit_album_details_sheet.dart b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/edit_album_details_sheet.dart
index b4d49a0eb9..b724ffa834 100644
--- a/mobile/apps/photos/lib/ui/viewer/gallery/hooks/edit_album_details_sheet.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/hooks/edit_album_details_sheet.dart
@@ -40,34 +40,32 @@ Future<void> showEditAlbumDetailsSheet({
await showBottomSheetComponent<void>(
context: context,
- builder: (sheetContext) => SingleChildScrollView(
- child: EditAlbumDetailsSheet(
- initialName: collection.displayName,
- initialDescription: collection.displayDescription ?? "",
- initialCover: initialCover,
- onSelectCover: (pendingCoverID) async {
- final hasEffectiveCustomCover = pendingCoverID == null
- ? collection.hasCover
- : pendingCoverID != 0;
- final coverID = await showPickCoverPhotoSheet(
- sheetContext,
- collection,
- hasEffectiveCustomCover: hasEffectiveCustomCover,
- );
- if (coverID == null) {
- return null;
- }
+ builder: (sheetContext) => EditAlbumDetailsSheet(
+ initialName: collection.displayName,
+ initialDescription: collection.displayDescription ?? "",
+ initialCover: initialCover,
+ onSelectCover: (pendingCoverID) async {
+ final hasEffectiveCustomCover = pendingCoverID == null
+ ? collection.hasCover
+ : pendingCoverID != 0;
+ final coverID = await showPickCoverPhotoSheet(
+ sheetContext,
+ collection,
+ hasEffectiveCustomCover: hasEffectiveCustomCover,
+ );
+ if (coverID == null) {
+ return null;
+ }
- final file = coverID == 0
- ? await FilesDB.instance.getCollectionFileFirstOrLast(
- collection.id,
- collection.pubMagicMetadata.asc ?? false,
- )
- : await FilesDB.instance.getUploadedFile(coverID, collection.id);
- return AlbumCoverSelection(id: coverID, file: file);
- },
- onSave: onSave,
- ),
+ final file = coverID == 0
+ ? await FilesDB.instance.getCollectionFileFirstOrLast(
+ collection.id,
+ collection.pubMagicMetadata.asc ?? false,
+ )
+ : await FilesDB.instance.getUploadedFile(coverID, collection.id);
+ return AlbumCoverSelection(id: coverID, file: file);
+ },
+ onSave: onSave,
),
);
}
diff --git a/mobile/apps/photos/test/ui/viewer/gallery/album_cover_app_bar_test.dart b/mobile/apps/photos/test/ui/viewer/gallery/album_cover_app_bar_test.dart
index bc6038e5f8..83bd4e0806 100644
--- a/mobile/apps/photos/test/ui/viewer/gallery/album_cover_app_bar_test.dart
+++ b/mobile/apps/photos/test/ui/viewer/gallery/album_cover_app_bar_test.dart
@@ -63,7 +63,6 @@ void main() {
),
]) {
tester.view.physicalSize = size;
- var taps = 0;
final header = _coverHeader(cover);
header.collection.pubMagicMetadata = CollectionPubMagicMetadata(
description: caption,
@@ -91,7 +90,6 @@ void main() {
collection: header.collection,
cover: cover,
title: title,
- onDetailsTap: () => taps++,
backgroundColor: header.backgroundColor,
collapsedHeight: kToolbarHeight,
actionsBuilder: (_) => List.generate(
@@ -129,11 +127,6 @@ void main() {
closeTo(tester.getSize(expandedTitle).width, 0.1),
);
}
- await tester.tap(expandedTitle);
- if (caption != null) {
- await tester.tap(find.text(caption));
- }
- expect(taps, caption == null ? 1 : 2);
final backIcon = tester.getRect(find.byIcon(Icons.arrow_back));
expect(backIcon.left, size.width >= 1024 ? padding.left + 28 : 28);
final lastAction = tester.getRect(find.byType(IconButton).last);
@@ -145,13 +138,6 @@ void main() {
);
await tester.drag(find.byType(CustomScrollView), const Offset(0, -500));
await tester.pumpAndSettle();
- await tester.tap(
- find.byWidgetPredicate(
- (widget) =>
- widget is Text && widget.data == title && widget.maxLines == 1,
- ),
- );
- expect(taps, caption == null ? 2 : 3);
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox.shrink());
await tester.pump(const Duration(seconds: 1));
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 5d0fa8c9c5..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
@@ -125,71 +125,6 @@ void main() {
expect(find.text("Open album"), findsOneWidget);
});
- testWidgets("opens full album details and preserves editing permissions", (
- tester,
- ) async {
- tester.view.devicePixelRatio = 1;
- tester.view.physicalSize = const Size(844, 390);
- addTearDown(tester.view.resetDevicePixelRatio);
- addTearDown(tester.view.resetPhysicalSize);
- addTearDown(tester.view.resetViewInsets);
- const title = "An album title that is long enough to overflow the header";
- const description = "The complete album description";
- final cover = _file(1);
- await tester.runAsync(() => FilesDB.instance.insertMultiple([cover]));
- for (final ownerID in [1, 2]) {
- final collection = _collection(ownerID: ownerID)
- ..decryptedName = title
- ..pubMagicMetadata = CollectionPubMagicMetadata(
- description: description,
- );
- await _pumpAlbum(tester, collection);
- await _expectCover(tester, cover);
- final selectedFiles = tester
- .widget<GalleryAppBarWidget>(find.byType(GalleryAppBarWidget))
- .selectedFiles;
- selectedFiles.toggleSelection(cover);
- await tester.pumpAndSettle();
- await tester.tap(find.text(title).first);
- await tester.pumpAndSettle();
- expect(find.byType(BottomSheet), findsNothing);
- selectedFiles.clearAll();
- await tester.pumpAndSettle();
- await tester.tap(find.text(ownerID == 1 ? title : description).first);
- await tester.pumpAndSettle();
- if (ownerID == 1) {
- expect(
- tester
- .widgetList<EditableText>(find.byType(EditableText))
- .map((field) => field.controller.text),
- containsAll([title, description]),
- );
- tester.view.viewInsets = const FakeViewPadding(bottom: 200);
- await tester.showKeyboard(find.byType(EditableText).last);
- await tester.pumpAndSettle();
- final save = find.byKey(const ValueKey("save_album_details"));
- await tester.ensureVisible(save);
- await tester.pumpAndSettle();
- expect(save.hitTestable(), findsOneWidget);
- tester.view.resetViewInsets();
- tester.testTextInput.hide();
- await tester.pumpAndSettle();
- } else {
- expect(find.byType(EditableText), findsNothing);
- final sheet = find.byType(BottomSheet);
- for (final text in [title, description]) {
- expect(
- find.descendant(of: sheet, matching: find.text(text)),
- findsOneWidget,
- );
- }
- }
- await tester.tap(find.byTooltip("Close").last);
- await tester.pumpAndSettle();
- await _disposeAlbum(tester);
- }
- });
-
testWidgets("uses a pending local photo and excludes ignored photos", (
tester,
) async {
@@ -419,9 +354,9 @@ void main() {
);
}
-Collection _collection({int ownerID = 1}) => Collection(
+Collection _collection() => Collection(
1,
- User(id: ownerID, email: "[email protected]"),
+ User(id: 1, email: "[email protected]"),
"",
null,
"Album",