Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] Merge upstream main for album redesign

r4khula2697a9ff20e
diff --cc mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
index a106d566ea,fe42699837..e336fe94db
--- a/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/gallery/collection_page.dart
@@@ -238,9 -144,12 +238,12 @@@ class _CollectionPageState extends Stat
builder: (context, value, _) {
return value
? HierarchicalSearchGallery(
- tagPrefix: tagPrefix,
+ tagPrefix: "${tagPrefix}_files",
selectedFiles: _selectedFiles,
appBar: appBar,
+ hiddenCollectionID: c.collection.isHidden()
+ ? c.collection.id
+ : null,
)
: gallery;
},
diff --cc mobile/apps/photos/test/ui/viewer/gallery/gallery_layout_changed_event_test.dart
index ae4ec98c21,b3f8cd9040..7bb8e7a4b8
--- a/mobile/apps/photos/test/ui/viewer/gallery/gallery_layout_changed_event_test.dart
+++ b/mobile/apps/photos/test/ui/viewer/gallery/gallery_layout_changed_event_test.dart
@@@ -71,55 -72,40 +72,87 @@@ void main()
await localSettings.setInternalUserDisabled(false);
});
+ testWidgets("keeps the current gallery controller after an animated swap", (
+ tester,
+ ) async {
+ final boundariesKey = GlobalKey<GalleryBoundariesProviderState>();
+ late StateSetter replaceGallery;
+ var generation = 0;
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: lightThemeData,
+ localizationsDelegates: StringsLocalizations.localizationsDelegates,
+ supportedLocales: StringsLocalizations.supportedLocales,
+ home: GalleryBoundariesProvider(
+ key: boundariesKey,
+ child: GalleryFilesState(
+ child: StatefulBuilder(
+ builder: (context, setState) {
+ replaceGallery = setState;
+ return AnimatedSwitcher(
+ duration: const Duration(milliseconds: 200),
+ child: Gallery(
+ key: ValueKey(generation),
+ asyncLoader: (start, end, {limit, asc}) async =>
+ FileLoadResult([_dummyFile("handoff")], false),
+ tagPrefix: "handoff",
+ enableFileGrouping: false,
+ ),
+ );
+ },
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ final controllers = boundariesKey.currentState!.scrollControllerNotifier;
+ final previous = controllers.value;
+ replaceGallery(() => generation++);
+ await tester.pump();
+ final current = controllers.value;
+ expect(current, isNotNull);
+ expect(current, isNot(same(previous)));
+ await tester.pumpAndSettle();
+ expect(controllers.value, same(current));
+ await tester.pumpWidget(const SizedBox.shrink());
+ await tester.pumpAndSettle();
+ });
+
+ testWidgets("Flex remains unavailable when internal features are disabled", (
+ tester,
+ ) async {
+ await localSettings.setGalleryLayoutType(GalleryLayoutType.justified);
+ await localSettings.setJustifiedLayoutStrategy(
+ JustifiedLayoutStrategy.flex,
+ );
+ await localSettings.setInternalUserDisabled(true);
+
+ expect(isJustifiedLayoutAvailable, isFalse);
+ expect(
+ resolveGalleryLayoutType(localSettings.getGalleryLayoutType()),
+ GalleryLayoutType.grid,
+ );
+ for (final settings in [
+ const Scaffold(body: GalleryLayoutSettings()),
+ const GallerySettingsScreen(fromGalleryLayoutSettingsCTA: true),
+ ]) {
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: lightThemeData,
+ localizationsDelegates: StringsLocalizations.localizationsDelegates,
+ supportedLocales: StringsLocalizations.supportedLocales,
+ home: settings,
+ ),
+ );
+ await tester.pumpAndSettle();
+ expect(find.text("Justified Β· Flex (i)"), findsNothing);
+ expect(find.text("Layout (i)"), findsNothing);
+ }
+ });
+
testWidgets(
- "both layout menus notify galleries when only the strategy changes",
+ "selecting or reselecting Flex in either menu sets grid size 2 and notifies galleries",
(tester) async {
var events = 0;
final subscription = Bus.instance.on<GalleryLayoutChangedEvent>().listen(