Skip to content

armgit / ente

Public Imported from GitHub
0

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

Prevent legacy trips from showing duplicate trips

laurenspriem00f74388b3f1
diff --git a/mobile/apps/photos/lib/services/memories_cache_service.dart b/mobile/apps/photos/lib/services/memories_cache_service.dart
index c432ba9d59..3f49c48294 100644
--- a/mobile/apps/photos/lib/services/memories_cache_service.dart
+++ b/mobile/apps/photos/lib/services/memories_cache_service.dart
@@ -712,7 +712,8 @@ class MemoriesCacheService {
final activeTrips = memories
.where(
(memory) =>
- memory.type == MemoryType.trips && memory.isRelevantAt(timestamp),
+ _shouldCarryForwardTripEntry(memory) &&
+ memory.isRelevantAt(timestamp),
)
.toList();
final dedupedActiveTrips = _dedupeTripCacheEntriesInOrder(
@@ -731,6 +732,16 @@ class MemoriesCacheService {
.toList(growable: false);
}
+ static bool _shouldCarryForwardTripEntry(ToShowMemory memory) {
+ if (memory.type != MemoryType.trips) {
+ return false;
+ }
+ // Drop legacy keyless trips during migration so they cannot coexist with
+ // newly recomputed keyed trips for the same trip.
+ final tripKey = memory.tripKey;
+ return tripKey != null && tripKey.isNotEmpty;
+ }
+
Future<String> _getCachePath() async {
final suffix = isOfflineMode ? "_offline" : "";
return (await getApplicationSupportDirectory()).path +