Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] expose scheduled memory lane timeline

Priyanshu Dangaref3f68ad07537
diff --git a/mobile/apps/photos/lib/services/memory_lane/memory_lane_cache_service.dart b/mobile/apps/photos/lib/services/memory_lane/memory_lane_cache_service.dart
index 1b088e6ee0..572a6a7fea 100644
--- a/mobile/apps/photos/lib/services/memory_lane/memory_lane_cache_service.dart
+++ b/mobile/apps/photos/lib/services/memory_lane/memory_lane_cache_service.dart
@@ -60,6 +60,33 @@ class MemoryLaneCacheService {
return cache[personId];
}
+ Future<MemoryLanePersonTimeline?> getScheduledMemoriesStripTimeline() async {
+ final cache = await getCache();
+ final nowMicros = DateTime.now().microsecondsSinceEpoch;
+ MemoryLanePersonTimeline? currentTimeline;
+ int? currentBeginShowingAt;
+ for (final entry in cache.memoriesStripSchedule.entries) {
+ final timeline = cache.timelines[entry.key];
+ final schedule = entry.value;
+ final endShowingAt =
+ schedule.beginShowingAt +
+ MemoryLaneSchedule.displayDuration.inMicroseconds;
+ if (schedule.beginShowingAt > nowMicros ||
+ nowMicros >= endShowingAt ||
+ timeline == null ||
+ !timeline.isEligible ||
+ timeline.entries.isEmpty) {
+ continue;
+ }
+ if (currentBeginShowingAt == null ||
+ schedule.beginShowingAt > currentBeginShowingAt) {
+ currentTimeline = timeline;
+ currentBeginShowingAt = schedule.beginShowingAt;
+ }
+ }
+ return currentTimeline;
+ }
+
Future<MemoryLaneComputeLogEntry?> getComputeLogEntry(String personId) async {
final cache = await getCache();
return cache.computeLog[personId];