π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Keep embedded location gallery on grid
ashil-pilot89583be2411a
diff --git a/mobile/apps/photos/lib/models/gallery/gallery_groups.dart b/mobile/apps/photos/lib/models/gallery/gallery_groups.dartindex 9e6c39b12e..bbf7c6b9ba 100644--- a/mobile/apps/photos/lib/models/gallery/gallery_groups.dart+++ b/mobile/apps/photos/lib/models/gallery/gallery_groups.dart@@ -29,6 +29,7 @@ class GalleryGroups {final bool showSelectAll;final _logger = Logger("GalleryGroups");final bool showGallerySettingsCTA;+ final GalleryLayoutType? layoutTypeOverride;final bool sortOrderAsc;final double widthAvailable;@@ -44,6 +45,7 @@ class GalleryGroups {required this.showSelectAll,this.limitSelectionToOne = false,this.showGallerySettingsCTA = false,+ this.layoutTypeOverride,}) {init();if (!groupType.showGroupHeader()) {@@ -258,7 +260,7 @@ class GalleryGroups {void init() {crossAxisCount = localSettings.getPhotoGridSize();- layoutType = localSettings.getGalleryLayoutType();+ layoutType = layoutTypeOverride ?? localSettings.getGalleryLayoutType();_buildGroups();_groupLayouts = switch (layoutType) {diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dartindex 09da06d34d..a71ce66422 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/gallery.dart@@ -22,6 +22,7 @@ import "package:photos/models/gallery/gallery_groups.dart";import "package:photos/models/gallery_type.dart";import 'package:photos/models/selected_files.dart';import "package:photos/service_locator.dart" show localSettings;+import "package:photos/settings/local_settings.dart" show GalleryLayoutType;import "package:photos/ui/viewer/actions/file_selection_overlay_bar.dart";import "package:photos/ui/viewer/gallery/component/gallery_file_widget.dart";import "package:photos/ui/viewer/gallery/component/group/group_header_widget.dart";@@ -78,6 +79,7 @@ class Gallery extends StatefulWidget {final Duration priorityReloadDebounceTime;final GalleryType? galleryType;final bool showGallerySettingsCTA;+ final GalleryLayoutType? layoutTypeOverride;// Return null to force a full reload.final NewLocalFilesResolver? newLocalFilesResolver;@@ -128,6 +130,7 @@ class Gallery extends StatefulWidget {this.galleryType,this.disableVerticalPaddingForScrollbar = false,this.showGallerySettingsCTA = false,+ this.layoutTypeOverride,this.fileToJumpTo,this.newLocalFilesResolver,super.key,@@ -391,6 +394,7 @@ class GalleryState extends State<Gallery> {showSelectAll: widget.showSelectAll,limitSelectionToOne: widget.limitSelectionToOne,showGallerySettingsCTA: widget.showGallerySettingsCTA,+ layoutTypeOverride: widget.layoutTypeOverride,);galleryGroups = groups;diff --git a/mobile/apps/photos/lib/ui/viewer/location/dynamic_location_gallery_widget.dart b/mobile/apps/photos/lib/ui/viewer/location/dynamic_location_gallery_widget.dartindex c13c8de4c4..8a3fa9f7cd 100644--- a/mobile/apps/photos/lib/ui/viewer/location/dynamic_location_gallery_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/location/dynamic_location_gallery_widget.dart@@ -10,6 +10,7 @@ import "package:photos/service_locator.dart";import "package:photos/services/collections_service.dart";import "package:photos/services/filter/db_filters.dart";import "package:photos/services/location_service.dart";+import "package:photos/settings/local_settings.dart";import 'package:photos/states/location_state.dart';import "package:photos/ui/viewer/gallery/gallery.dart";import "package:photos/ui/viewer/gallery/state/gallery_files_inherited_widget.dart";@@ -108,6 +109,7 @@ class _DynamicLocationGalleryWidgetState},tagPrefix: widget.tagPrefix,enableFileGrouping: false,+ layoutTypeOverride: GalleryLayoutType.grid,showSelectAll: false,),),diff --git a/mobile/apps/photos/test/models/gallery_groups_mosaic_test.dart b/mobile/apps/photos/test/models/gallery_groups_mosaic_test.dartindex d951e71c2e..b03778186d 100644--- a/mobile/apps/photos/test/models/gallery_groups_mosaic_test.dart+++ b/mobile/apps/photos/test/models/gallery_groups_mosaic_test.dart@@ -5,6 +5,7 @@ import "package:photos/core/configuration.dart";import "package:photos/models/file/dummy_file.dart";import "package:photos/models/file/file.dart";import "package:photos/models/file/file_type.dart";+import "package:photos/models/gallery/fixed_extent_section_layout.dart";import "package:photos/models/gallery/gallery_groups.dart";import "package:photos/models/gallery/mosaic_layout.dart";import "package:photos/models/metadata/file_magic.dart";@@ -192,6 +193,29 @@ void main() {expect(groups.getGeometryOfFile(replacement), originalGeometry);expect(groups.getOffsetOfFile(replacement), originalGeometry?.rowOffset);});++ test("a layout override keeps an embedded gallery on the fixed grid", () {+ final files = List<EnteFile>.generate(+ 12,+ (index) => _file(+ index: index,+ creationTime: DateTime(2026, 8, 19).microsecondsSinceEpoch,+ width: 400,+ height: 100,+ ),+ growable: false,+ );++ final groups = _galleryGroups(+ files: files,+ groupType: GroupType.none,+ groupHeaderExtent: GalleryGroups.spacing,+ layoutTypeOverride: GalleryLayoutType.grid,+ );++ expect(groups.layoutType, GalleryLayoutType.grid);+ expect(groups.groupLayouts, everyElement(isA<FixedExtentSectionLayout>()));+ });}GalleryGroups _galleryGroups({@@ -199,6 +223,7 @@ GalleryGroups _galleryGroups({required GroupType groupType,required double groupHeaderExtent,bool sortOrderAsc = false,+ GalleryLayoutType? layoutTypeOverride,}) {return GalleryGroups(allFiles: files,@@ -209,6 +234,7 @@ GalleryGroups _galleryGroups({tagPrefix: "test_",groupHeaderExtent: groupHeaderExtent,showSelectAll: false,+ layoutTypeOverride: layoutTypeOverride,);}