💚 End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Remove Comfort justified layout option
ashil-pilote3b3377e378d
diff --git a/mobile/apps/photos/lib/models/gallery/gallery_groups.dart b/mobile/apps/photos/lib/models/gallery/gallery_groups.dartindex 9003342217..c7c5381469 100644--- a/mobile/apps/photos/lib/models/gallery/gallery_groups.dart+++ b/mobile/apps/photos/lib/models/gallery/gallery_groups.dart@@ -463,7 +463,6 @@ class GalleryGroups {? math.min(gridTargetRowHeight, _maximumJustifiedTargetRowHeight): gridTargetRowHeight;final targetHeightScale = switch (strategy) {- JustifiedLayoutStrategy.comfort => 1.0,JustifiedLayoutStrategy.comfortLarge =>comfortLargeTuning.targetHeightScale,JustifiedLayoutStrategy.flex => flexTuning.targetHeightScale,@@ -484,13 +483,6 @@ class GalleryGroups {),);final rows = switch (strategy) {- JustifiedLayoutStrategy.comfort =>- JustifiedLayoutCalculator.computeRows(- aspectRatios: aspectRatios,- availableWidth: widthAvailable,- targetRowHeight: targetRowHeight,- spacing: spacing,- ),JustifiedLayoutStrategy.comfortLarge =>JustifiedLayoutCalculator.computeRows(aspectRatios: aspectRatios,diff --git a/mobile/apps/photos/lib/models/gallery/justified_layout_strategy.dart b/mobile/apps/photos/lib/models/gallery/justified_layout_strategy.dartindex e6f845f049..9635f3bab0 100644--- a/mobile/apps/photos/lib/models/gallery/justified_layout_strategy.dart+++ b/mobile/apps/photos/lib/models/gallery/justified_layout_strategy.dart@@ -1 +1 @@-enum JustifiedLayoutStrategy { comfort, comfortLarge, flex, flexFullRows }+enum JustifiedLayoutStrategy { comfortLarge, flex, flexFullRows }diff --git a/mobile/apps/photos/lib/settings/local_settings.dart b/mobile/apps/photos/lib/settings/local_settings.dartindex 3bf583f828..a168dfae56 100644--- a/mobile/apps/photos/lib/settings/local_settings.dart+++ b/mobile/apps/photos/lib/settings/local_settings.dart@@ -302,10 +302,9 @@ class LocalSettings {JustifiedLayoutStrategy getJustifiedLayoutStrategy() {return switch (_prefs.getString(kJustifiedLayoutStrategy)) {- "comfortLarge" => JustifiedLayoutStrategy.comfortLarge,"flex" => JustifiedLayoutStrategy.flex,"flexFullRows" => JustifiedLayoutStrategy.flexFullRows,- _ => JustifiedLayoutStrategy.comfort,+ _ => JustifiedLayoutStrategy.comfortLarge,};}diff --git a/mobile/apps/photos/lib/ui/viewer/gallery/justified_layout_strategy_label.dart b/mobile/apps/photos/lib/ui/viewer/gallery/justified_layout_strategy_label.dartindex 6df4e6820c..cd67eaf2fe 100644--- a/mobile/apps/photos/lib/ui/viewer/gallery/justified_layout_strategy_label.dart+++ b/mobile/apps/photos/lib/ui/viewer/gallery/justified_layout_strategy_label.dart@@ -4,7 +4,6 @@ import "package:photos/models/gallery/justified_layout_strategy.dart";extension JustifiedLayoutStrategyLabel on JustifiedLayoutStrategy {String label(BuildContext context) => switch (this) {- JustifiedLayoutStrategy.comfort => context.strings.layoutJustifiedComfort,JustifiedLayoutStrategy.comfortLarge =>"${context.strings.layoutJustifiedComfort} Large",JustifiedLayoutStrategy.flex => context.strings.layoutJustifiedFlex,diff --git a/mobile/apps/photos/test/models/gallery_groups_justified_test.dart b/mobile/apps/photos/test/models/gallery_groups_justified_test.dartindex bd21e396ad..f19139086c 100644--- a/mobile/apps/photos/test/models/gallery_groups_justified_test.dart+++ b/mobile/apps/photos/test/models/gallery_groups_justified_test.dart@@ -50,7 +50,7 @@ void main() {setUp(() async {await localSettings.setGalleryLayoutType(GalleryLayoutType.justified);await localSettings.setJustifiedLayoutStrategy(- JustifiedLayoutStrategy.comfort,+ JustifiedLayoutStrategy.comfortLarge,);await localSettings.resetFlexLayoutTuning();await localSettings.resetFlexFullRowsLayoutTuning();@@ -148,19 +148,23 @@ void main() {),);await localSettings.setPhotoGridSize(2);+ await localSettings.setComfortLargeLayoutTuningValue(+ ComfortLargeLayoutTuningField.targetHeightScale,+ 1,+ );GalleryGroups groups() => _galleryGroups(files: files,groupType: GroupType.none,groupHeaderExtent: GalleryGroups.spacing,widthAvailable: 402,);- final comfort = groups().groupLayouts.single as JustifiedSectionLayout;- expect(comfort.rows.map((row) => row.itemWidths.length), [2, 2]);+ final comfortLarge = groups().groupLayouts.single as JustifiedSectionLayout;+ expect(comfortLarge.rows.map((row) => row.itemWidths.length), [2, 2]);await localSettings.setJustifiedLayoutStrategy(JustifiedLayoutStrategy.flex,);final flex = groups().groupLayouts.single as JustifiedSectionLayout;- expect(flex.rows.single.itemWidths, hasLength(4));+ expect(flex.rows.map((row) => row.itemWidths.length), [3, 1]);});test("routes Flex Full Rows with independent tuning", () async {@@ -216,20 +220,16 @@ void main() {return section.rows.single.height;}- expect(rowHeight(), 320);-- await localSettings.setJustifiedLayoutStrategy(- JustifiedLayoutStrategy.comfortLarge,- );expect(rowHeight(),320 * ComfortLargeLayoutTuning.defaults.targetHeightScale,);+await localSettings.setComfortLargeLayoutTuningValue(ComfortLargeLayoutTuningField.targetHeightScale,- 1.5,+ 1.25,);- expect(rowHeight(), 480);+ expect(rowHeight(), 400);await localSettings.setJustifiedLayoutStrategy(JustifiedLayoutStrategy.flex,@@ -248,7 +248,11 @@ void main() {test("headerless justified remains one continuous group past grid chunks",- () {+ () async {+ await localSettings.setComfortLargeLayoutTuningValue(+ ComfortLargeLayoutTuningField.targetHeightScale,+ 1,+ );const fileCount = 100;final files = List<EnteFile>.generate(fileCount,@@ -322,6 +326,10 @@ void main() {}await localSettings.setPhotoGridSize(2);+ await localSettings.setComfortLargeLayoutTuningValue(+ ComfortLargeLayoutTuningField.targetHeightScale,+ 1,+ );expect(rowHeight(), 320);await localSettings.setPhotoGridSize(4);diff --git a/mobile/apps/photos/test/settings/local_settings_gallery_layout_test.dart b/mobile/apps/photos/test/settings/local_settings_gallery_layout_test.dartindex 0226c77d07..a6f776c1f5 100644--- a/mobile/apps/photos/test/settings/local_settings_gallery_layout_test.dart+++ b/mobile/apps/photos/test/settings/local_settings_gallery_layout_test.dart@@ -29,17 +29,16 @@ void main() {});test(- "justified strategy defaults to Comfort and persists alternatives",+ "justified strategy defaults to Comfort Large and persists alternatives",() async {SharedPreferences.setMockInitialValues({});final preferences = await SharedPreferences.getInstance();final settings = LocalSettings(preferences);expect(settings.getJustifiedLayoutStrategy(),- JustifiedLayoutStrategy.comfort,+ JustifiedLayoutStrategy.comfortLarge,);for (final strategy in [- JustifiedLayoutStrategy.comfortLarge,JustifiedLayoutStrategy.flex,JustifiedLayoutStrategy.flexFullRows,]) {diff --git 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.dartindex 2549424ecc..144f0ade09 100644--- 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@@ -61,7 +61,7 @@ void main() {await localSettings.setInternalUserDisabled(false);await localSettings.setGalleryLayoutType(GalleryLayoutType.grid);await localSettings.setJustifiedLayoutStrategy(- JustifiedLayoutStrategy.comfort,+ JustifiedLayoutStrategy.comfortLarge,);await localSettings.resetFlexLayoutTuning();await localSettings.resetFlexFullRowsLayoutTuning();@@ -83,7 +83,7 @@ void main() {for (final quickMenu in [true, false]) {await localSettings.setGalleryLayoutType(GalleryLayoutType.justified);await localSettings.setJustifiedLayoutStrategy(- JustifiedLayoutStrategy.comfort,+ JustifiedLayoutStrategy.comfortLarge,);events = 0;await tester.pumpWidget(@@ -115,6 +115,7 @@ void main() {await tester.tap(find.text("Layout"));await tester.pumpAndSettle();}+ expect(find.text("Justified · Comfort"), findsNothing);await tester.tap(find.text("Justified · Flex Full Rows"));await tester.pumpAndSettle();expect(