π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Better frequency for people memories
laurenspriemd6c3cf3b8ff4
diff --git a/mobile/apps/photos/lib/models/memories/memories_cache.dart b/mobile/apps/photos/lib/models/memories/memories_cache.dartindex f45282d30c..622c3b8485 100644--- a/mobile/apps/photos/lib/models/memories/memories_cache.dart+++ b/mobile/apps/photos/lib/models/memories/memories_cache.dart@@ -9,7 +9,7 @@ import "package:photos/models/memories/smart_memory.dart";import "package:photos/models/memories/smart_memory_constants.dart";import "package:photos/models/memories/trip_memory.dart";-const kPersonShowTimeout = Duration(days: 7 * 10);+const kPersonShowTimeout = Duration(days: 16 * kMemoriesUpdateFrequencyDays);const kPersonAndTypeShowTimeout = Duration(days: 7 * 26);const kClipShowTimeout = Duration(days: 3 * 10);const kTripShowTimeout = Duration(days: 7 * 25);diff --git a/mobile/apps/photos/lib/models/memories/smart_memory_constants.dart b/mobile/apps/photos/lib/models/memories/smart_memory_constants.dartindex 2d9885f90e..35a8b4130c 100644--- a/mobile/apps/photos/lib/models/memories/smart_memory_constants.dart+++ b/mobile/apps/photos/lib/models/memories/smart_memory_constants.dart@@ -1,4 +1,5 @@// Constants for computing smart memories-const kMemoriesUpdateFrequency = Duration(days: 3);+const kMemoriesUpdateFrequencyDays = 3;+const kMemoriesUpdateFrequency = Duration(days: kMemoriesUpdateFrequencyDays);const kMemoriesMargin = Duration(days: 1);const kDayItself = Duration(days: 1);diff --git a/mobile/apps/photos/lib/services/smart_memories_service.dart b/mobile/apps/photos/lib/services/smart_memories_service.dartindex ce20f14cd2..9875df1402 100644--- a/mobile/apps/photos/lib/services/smart_memories_service.dart+++ b/mobile/apps/photos/lib/services/smart_memories_service.dart@@ -422,6 +422,7 @@ class SmartMemoriesService {.map((p) => p.remoteID).toList();orderedImportantPersonsID.shuffle(Random());+ final amountOfPersons = orderedImportantPersonsID.length;w?.log('orderedImportantPersonsID setup');// Check if the user has assignmed "me"@@ -709,6 +710,12 @@ class SmartMemoriesService {w?.log('relevancy setup');// Loop through the people (and memory types) and add based on rotation+ final shownPersonTimeout = Duration(+ days: min(+ kPersonShowTimeout.inDays,+ max(1, amountOfPersons) * kMemoriesUpdateFrequencyDays,+ ),+ );peopleRotationLoop:for (final personID in orderedImportantPersonsID) {for (final memory in memoryResults) {@@ -721,7 +728,7 @@ class SmartMemoriesService {final shownDate =DateTime.fromMicrosecondsSinceEpoch(shownLog.lastTimeShown);final bool seenPersonRecently =- currentTime.difference(shownDate) < kPersonShowTimeout;+ currentTime.difference(shownDate) < shownPersonTimeout;if (seenPersonRecently) continue peopleRotationLoop;}if (personToMemories[personID] == null) continue peopleRotationLoop;