π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Optimize allFilesWithDummies population for large galleries
ashilkn9a7a15f38f87
diff --git a/mobile/apps/photos/lib/models/gallery/gallery_groups.dart b/mobile/apps/photos/lib/models/gallery/gallery_groups.dartindex de540326b2..c30a6357f5 100644--- a/mobile/apps/photos/lib/models/gallery/gallery_groups.dart+++ b/mobile/apps/photos/lib/models/gallery/gallery_groups.dart@@ -61,7 +61,7 @@ class GalleryGroups {late final int crossAxisCount;late final List<FixedExtentSectionLayout> _groupLayouts;- late final List<EnteFile> _allFilesWithDummies;+ final List<EnteFile> _allFilesWithDummies = [];final List<String> _groupIds = [];final Map<String, List<EnteFile>> _groupIdToFilesMap = {};@@ -88,7 +88,7 @@ class GalleryGroups {_scrollbarDivisions;/// Returns allFiles with dummy entries added at appropriate positions to fill- /// incomplete rows in each group. Computed once during initialization.+ /// incomplete rows in each group.List<EnteFile> get allFilesWithDummies => _allFilesWithDummies;double? getOffsetOfFile(EnteFile file) {@@ -159,17 +159,6 @@ class GalleryGroups {crossAxisCount = localSettings.getPhotoGridSize();_buildGroups();- // Build allFilesWithDummies only if swipe-to-select feature is enabled- if (flagService.internalUser && !limitSelectionToOne) {- // Flatten groups with dummies for swipe-to-select gesture tracking- _allFilesWithDummies = _groupIds- .expand((groupId) => _groupIdToFilesMap[groupId]!)- .toList(growable: false);- } else {- // Empty list when feature is disabled - SwipeHelper won't be created anyway- _allFilesWithDummies = [];- }-_groupLayouts = _computeGroupLayouts();assert(groupIDs.length == _groupIdToFilesMap.length);@@ -404,6 +393,11 @@ class GalleryGroups {endCreationTime: lastFile.creationTime!);+ if (_allFilesWithDummies.isNotEmpty ||+ (flagService.internalUser && !limitSelectionToOne)) {+ _allFilesWithDummies.addAll(groupFiles);+ }+// For scrollbar divisionsif (groupType.timeGrouping()) {final yearOfGroup = DateTime.fromMicrosecondsSinceEpoch(