Skip to content

armgit / ente

Public Imported from GitHub
0

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

fixup! [mobile][photos] fix memories strip schedule validation

Priyanshu Dangare099c599849d6
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 c949df6c4f..754f8f1962 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
@@ -1,7 +1,6 @@
import "dart:convert";
import "dart:io";
-import "package:collection/collection.dart";
import "package:logging/logging.dart";
import "package:path/path.dart" as p;
import "package:path_provider/path_provider.dart";
@@ -64,20 +63,20 @@ class MemoryLaneCacheService {
Future<MemoryLaneSchedule?> getCurrentMemoriesStripSchedule() async {
final cache = await getCache();
final nowMicros = DateTime.now().microsecondsSinceEpoch;
- return maxBy(
- cache.memoriesStripSchedule.entries.where((entry) {
- final timeline = cache.timelines[entry.key];
- final endShowingAt =
- entry.value.beginShowingAt +
- MemoryLaneSchedule.displayDuration.inMicroseconds;
- return entry.value.beginShowingAt <= nowMicros &&
- nowMicros < endShowingAt &&
- timeline != null &&
- timeline.isEligible &&
- timeline.entries.isNotEmpty;
- }),
- (entry) => entry.value.beginShowingAt,
- )?.value;
+ for (final entry in cache.memoriesStripSchedule.entries) {
+ final timeline = cache.timelines[entry.key];
+ final endShowingAt =
+ entry.value.beginShowingAt +
+ MemoryLaneSchedule.displayDuration.inMicroseconds;
+ if (entry.value.beginShowingAt <= nowMicros &&
+ nowMicros < endShowingAt &&
+ timeline != null &&
+ timeline.isEligible &&
+ timeline.entries.isNotEmpty) {
+ return entry.value;
+ }
+ }
+ return null;
}
Future<MemoryLaneComputeLogEntry?> getComputeLogEntry(String personId) async {