Skip to content

armgit / ente

Public Imported from GitHub
0

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

Reuse prepared smart memory inputs

Neeraj Gupta5378755dc090
diff --git a/mobile/apps/photos/lib/services/smart_memories_service.dart b/mobile/apps/photos/lib/services/smart_memories_service.dart
index 9897ea460a..01a96478c4 100644
--- a/mobile/apps/photos/lib/services/smart_memories_service.dart
+++ b/mobile/apps/photos/lib/services/smart_memories_service.dart
@@ -936,12 +936,8 @@ class SmartMemoriesService {
final List<SmartMemory> memories = [];
- final onThisDayFiles = _collectAvailableFiles(
- allFileIdsToFile,
- usedMemoryFileIds,
- );
final onThisDayMemories = await _getOnThisDayResults(
- onThisDayFiles,
+ fullSourceFiles,
now,
seenTimes: seenTimes,
collectionIDsToExclude: collectionIDsToExclude,
@@ -1116,12 +1112,8 @@ class SmartMemoriesService {
final List<SmartMemory> memories = [];
- final onThisDayFiles = _collectAvailableFiles(
- allFileIdsToFile,
- usedMemoryFileIds,
- );
final onThisDayMemories = await _getOnThisDayResults(
- onThisDayFiles,
+ allFileIdsToFile.values,
now,
seenTimes: seenTimes,
collectionIDsToExclude: collectionIDsToExclude,
diff --git a/mobile/apps/photos/lib/services/smart_memories_trip_calculator_v2.dart b/mobile/apps/photos/lib/services/smart_memories_trip_calculator_v2.dart
index 0940f3fb31..9e564ad118 100644
--- a/mobile/apps/photos/lib/services/smart_memories_trip_calculator_v2.dart
+++ b/mobile/apps/photos/lib/services/smart_memories_trip_calculator_v2.dart
@@ -187,8 +187,10 @@ class TripMemoriesCalculatorV2 {
);
}
+ final filesWithLocation = allFiles.where((f) => f.hasLocation).toList()
+ ..sort((a, b) => a.creationTime!.compareTo(b.creationTime!));
final baseLocations = _detectBaseLocations(
- allFiles,
+ filesWithLocation,
isLocalGalleryMode: isLocalGalleryMode,
);
final baseCountriesToExclude = _baseCountriesToExcludeFromTripTitles(
@@ -198,9 +200,6 @@ class TripMemoriesCalculatorV2 {
seenTimes,
);
- final filesWithLocation = allFiles.where((f) => f.hasLocation).toList()
- ..sort((a, b) => a.creationTime!.compareTo(b.creationTime!));
-
if (filesWithLocation.isEmpty) {
return TripMemoriesAnalysis(
baseLocations: baseLocations,
@@ -335,12 +334,9 @@ class TripMemoriesCalculatorV2 {
}
static List<BaseLocation> _detectBaseLocations(
- Iterable<EnteFile> allFiles, {
+ List<EnteFile> filesWithLocation, {
required bool isLocalGalleryMode,
}) {
- final filesWithLocation =
- allFiles.where((file) => file.hasLocation).toList()
- ..sort((a, b) => a.creationTime!.compareTo(b.creationTime!));
final smallRadiusClusters = _mergeNearbyLocationClusters(
_clusterByLocation(filesWithLocation, radius: baseRadius),
radius: _baseMergeRadius,
@@ -965,7 +961,7 @@ class TripMemoriesCalculatorV2 {
excludedCountryNames: baseCountriesToExclude,
);
final photoSelection = await SmartMemoriesService._bestSelection(
- trip.memories,
+ List<Memory>.of(trip.memories),
isLocalGalleryMode: isLocalGalleryMode,
mlEnabled: mlEnabled,
fileIdToFaces: fileIdToFaces,
@@ -1114,7 +1110,7 @@ class TripMemoriesCalculatorV2 {
excludedCountryNames: baseCountriesToExclude,
);
final photoSelection = await SmartMemoriesService._bestSelection(
- trip.memories,
+ List<Memory>.of(trip.memories),
isLocalGalleryMode: isLocalGalleryMode,
mlEnabled: mlEnabled,
fileIdToFaces: fileIdToFaces,