Skip to content

armgit / ente

Public Imported from GitHub
0

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

Don't show future days

laurensprieme3701795cbaa
diff --git a/mobile/apps/photos/lib/services/wrapped/candidate_builders.dart b/mobile/apps/photos/lib/services/wrapped/candidate_builders.dart
index c6b1e4c09c..104b904736 100644
--- a/mobile/apps/photos/lib/services/wrapped/candidate_builders.dart
+++ b/mobile/apps/photos/lib/services/wrapped/candidate_builders.dart
@@ -749,16 +749,16 @@ class _QuarterHeatmapData {
index < snapshot.heatmapWeekStartDates.length;
index += 1) {
final DateTime weekStart = snapshot.heatmapWeekStartDates[index];
- if (weekStart.isAfter(lastVisibleDay)) {
- continue;
- }
final int quarterIndex = ((weekStart.month - 1) ~/ 3).clamp(0, 3);
final List<int> counts = snapshot.heatmapRows[index];
final List<int> sanitized = List<int>.filled(7, 0);
+ final DateTime yearStart = DateTime(snapshot.year, 1, 1);
for (int dayOffset = 0; dayOffset < 7; dayOffset += 1) {
final DateTime day = weekStart.add(Duration(days: dayOffset));
if (day.isAfter(lastVisibleDay)) {
- sanitized[dayOffset] = -1;
+ sanitized[dayOffset] = kWrappedHeatmapFutureValue;
+ } else if (day.isBefore(yearStart)) {
+ sanitized[dayOffset] = kWrappedHeatmapPaddedValue;
} else {
sanitized[dayOffset] =
dayOffset < counts.length ? counts[dayOffset] : 0;
diff --git a/mobile/apps/photos/lib/services/wrapped/models.dart b/mobile/apps/photos/lib/services/wrapped/models.dart
index 0e6eb8c085..39a640b150 100644
--- a/mobile/apps/photos/lib/services/wrapped/models.dart
+++ b/mobile/apps/photos/lib/services/wrapped/models.dart
@@ -2,6 +2,14 @@ import "dart:convert";
import "package:flutter/foundation.dart" show immutable;
+/// Sentinel value used in heatmap grids when a day should be hidden but space
+/// must still be reserved (e.g. future dates).
+const int kWrappedHeatmapFutureValue = -2;
+
+/// Sentinel value used when a day is outside the display window but we still
+/// want to render a faint placeholder (e.g. padded weeks).
+const int kWrappedHeatmapPaddedValue = -1;
+
@immutable
class WrappedResult {
WrappedResult({