Skip to content

armgit / ente

Public Imported from GitHub
0

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

Proper full rename to Memory Lane

laurenspriemb63172af3691
diff --git a/mobile/apps/photos/lib/events/memory_lane_changed_event.dart b/mobile/apps/photos/lib/events/memory_lane_changed_event.dart
index f10b6c9532..78e19fd6bf 100644
--- a/mobile/apps/photos/lib/events/memory_lane_changed_event.dart
+++ b/mobile/apps/photos/lib/events/memory_lane_changed_event.dart
@@ -1,16 +1,16 @@
import "package:photos/events/event.dart";
import "package:photos/models/memory_lane/memory_lane_models.dart";
-class FacesTimelineChangedEvent extends Event {
+class MemoryLaneChangedEvent extends Event {
final String personId;
- final FacesTimelineStatus status;
+ final MemoryLaneStatus status;
- FacesTimelineChangedEvent({
+ MemoryLaneChangedEvent({
required this.personId,
required this.status,
});
- bool get isReady => status == FacesTimelineStatus.ready;
+ bool get isReady => status == MemoryLaneStatus.ready;
@override
String get reason =>
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dart
index 03db034d63..3d8fc3baf9 100644
--- a/mobile/apps/photos/lib/main.dart
+++ b/mobile/apps/photos/lib/main.dart
@@ -319,13 +319,13 @@ Future<void> _init(bool isBackground, {String via = ''}) async {
unawaited(SemanticSearchService.instance.init());
unawaited(MLService.instance.init());
await PersonService.init(entityService, MLDataDB.instance, preferences);
- await FacesTimelineService.instance.init();
+ await MemoryLaneService.instance.init();
if (flagService.facesTimeline) {
- FacesTimelineService.instance
+ MemoryLaneService.instance
.queueFullRecompute(trigger: "startup")
.ignore();
} else {
- _logger.info("Faces timeline disabled via feature flag");
+ _logger.info("Memory Lane disabled via feature flag");
}
EnteWakeLockService.instance.init(preferences);
wrappedService.scheduleInitialLoad();
diff --git a/mobile/apps/photos/lib/models/memory_lane/memory_lane_models.dart b/mobile/apps/photos/lib/models/memory_lane/memory_lane_models.dart
index 78ab4ee1c4..63e48f2b49 100644
--- a/mobile/apps/photos/lib/models/memory_lane/memory_lane_models.dart
+++ b/mobile/apps/photos/lib/models/memory_lane/memory_lane_models.dart
@@ -1,34 +1,34 @@
import "dart:convert";
-enum FacesTimelineStatus { ready, ineligible }
+enum MemoryLaneStatus { ready, ineligible }
-FacesTimelineStatus facesTimelineStatusFromString(String value) {
+MemoryLaneStatus memoryLaneStatusFromString(String value) {
switch (value) {
case "ready":
- return FacesTimelineStatus.ready;
+ return MemoryLaneStatus.ready;
case "ineligible":
- return FacesTimelineStatus.ineligible;
+ return MemoryLaneStatus.ineligible;
default:
throw ArgumentError.value(value, "value", "Unsupported timeline status");
}
}
-String facesTimelineStatusToString(FacesTimelineStatus status) {
+String memoryLaneStatusToString(MemoryLaneStatus status) {
switch (status) {
- case FacesTimelineStatus.ready:
+ case MemoryLaneStatus.ready:
return "ready";
- case FacesTimelineStatus.ineligible:
+ case MemoryLaneStatus.ineligible:
return "ineligible";
}
}
-class FacesTimelineEntry {
+class MemoryLaneEntry {
final String faceId;
final int fileId;
final int creationTimeMicros;
final int year;
- const FacesTimelineEntry({
+ const MemoryLaneEntry({
required this.faceId,
required this.fileId,
required this.creationTimeMicros,
@@ -42,8 +42,8 @@ class FacesTimelineEntry {
"year": year,
};
- factory FacesTimelineEntry.fromJson(Map<String, dynamic> json) {
- return FacesTimelineEntry(
+ factory MemoryLaneEntry.fromJson(Map<String, dynamic> json) {
+ return MemoryLaneEntry(
faceId: json["faceId"] as String,
fileId: json["fileId"] as int,
creationTimeMicros: json["creationTime"] as int,
@@ -52,49 +52,48 @@ class FacesTimelineEntry {
}
}
-class FacesTimelinePersonTimeline {
+class MemoryLanePersonTimeline {
final String personId;
- final FacesTimelineStatus status;
+ final MemoryLaneStatus status;
final int updatedAtMicros;
- final List<FacesTimelineEntry> entries;
+ final List<MemoryLaneEntry> entries;
- const FacesTimelinePersonTimeline({
+ const MemoryLanePersonTimeline({
required this.personId,
required this.status,
required this.updatedAtMicros,
required this.entries,
});
- bool get isReady => status == FacesTimelineStatus.ready;
+ bool get isReady => status == MemoryLaneStatus.ready;
Map<String, dynamic> toJson() => {
"personId": personId,
- "status": facesTimelineStatusToString(status),
+ "status": memoryLaneStatusToString(status),
"updatedAt": updatedAtMicros,
"entries": entries.map((entry) => entry.toJson()).toList(),
};
- factory FacesTimelinePersonTimeline.fromJson(Map<String, dynamic> json) {
+ factory MemoryLanePersonTimeline.fromJson(Map<String, dynamic> json) {
final Iterable entriesJson = json["entries"] as Iterable? ?? [];
- return FacesTimelinePersonTimeline(
+ return MemoryLanePersonTimeline(
personId: json["personId"] as String,
- status: facesTimelineStatusFromString(json["status"] as String),
+ status: memoryLaneStatusFromString(json["status"] as String),
updatedAtMicros: json["updatedAt"] as int,
entries: entriesJson
.map(
- (entry) =>
- FacesTimelineEntry.fromJson(entry as Map<String, dynamic>),
+ (entry) => MemoryLaneEntry.fromJson(entry as Map<String, dynamic>),
)
.toList(growable: false),
);
}
- FacesTimelinePersonTimeline copyWith({
- FacesTimelineStatus? status,
+ MemoryLanePersonTimeline copyWith({
+ MemoryLaneStatus? status,
int? updatedAtMicros,
- List<FacesTimelineEntry>? entries,
+ List<MemoryLaneEntry>? entries,
}) {
- return FacesTimelinePersonTimeline(
+ return MemoryLanePersonTimeline(
personId: personId,
status: status ?? this.status,
updatedAtMicros: updatedAtMicros ?? this.updatedAtMicros,
@@ -103,7 +102,7 @@ class FacesTimelinePersonTimeline {
}
}
-class FacesTimelineComputeLogEntry {
+class MemoryLaneComputeLogEntry {
final String personId;
final String? name;
final String? birthDate;
@@ -111,7 +110,7 @@ class FacesTimelineComputeLogEntry {
final int lastComputedMicros;
final int logicVersion;
- const FacesTimelineComputeLogEntry({
+ const MemoryLaneComputeLogEntry({
required this.personId,
required this.faceCount,
required this.lastComputedMicros,
@@ -129,8 +128,8 @@ class FacesTimelineComputeLogEntry {
"logicVersion": logicVersion,
};
- factory FacesTimelineComputeLogEntry.fromJson(Map<String, dynamic> json) {
- return FacesTimelineComputeLogEntry(
+ factory MemoryLaneComputeLogEntry.fromJson(Map<String, dynamic> json) {
+ return MemoryLaneComputeLogEntry(
personId: json["personId"] as String,
name: json["name"] as String?,
birthDate: json["birthDate"] as String?,
@@ -140,14 +139,14 @@ class FacesTimelineComputeLogEntry {
);
}
- FacesTimelineComputeLogEntry copyWith({
+ MemoryLaneComputeLogEntry copyWith({
String? name,
String? birthDate,
int? faceCount,
int? lastComputedMicros,
int? logicVersion,
}) {
- return FacesTimelineComputeLogEntry(
+ return MemoryLaneComputeLogEntry(
personId: personId,
name: name ?? this.name,
birthDate: birthDate ?? this.birthDate,
@@ -158,23 +157,23 @@ class FacesTimelineComputeLogEntry {
}
}
-class FacesTimelineCachePayload {
+class MemoryLaneCachePayload {
static const currentVersion = 1;
static const currentComputeLogVersion = 1;
final int version;
- final Map<String, FacesTimelinePersonTimeline> timelines;
+ final Map<String, MemoryLanePersonTimeline> timelines;
final int computeLogVersion;
- final Map<String, FacesTimelineComputeLogEntry> computeLog;
+ final Map<String, MemoryLaneComputeLogEntry> computeLog;
- const FacesTimelineCachePayload({
+ const MemoryLaneCachePayload({
required this.version,
required this.timelines,
required this.computeLogVersion,
required this.computeLog,
});
- FacesTimelineCachePayload.empty()
+ MemoryLaneCachePayload.empty()
: version = currentVersion,
timelines = {},
computeLogVersion = currentComputeLogVersion,
@@ -191,18 +190,17 @@ class FacesTimelineCachePayload {
String toEncodedJson() => jsonEncode(toJson());
- FacesTimelinePersonTimeline? operator [](String personId) =>
- timelines[personId];
+ MemoryLanePersonTimeline? operator [](String personId) => timelines[personId];
- Iterable<FacesTimelinePersonTimeline> get allTimelines => timelines.values;
+ Iterable<MemoryLanePersonTimeline> get allTimelines => timelines.values;
- FacesTimelineCachePayload copyWithTimeline(
- FacesTimelinePersonTimeline timeline,
+ MemoryLaneCachePayload copyWithTimeline(
+ MemoryLanePersonTimeline timeline,
) {
final updatedTimelines =
- Map<String, FacesTimelinePersonTimeline>.from(timelines);
+ Map<String, MemoryLanePersonTimeline>.from(timelines);
updatedTimelines[timeline.personId] = timeline;
- return FacesTimelineCachePayload(
+ return MemoryLaneCachePayload(
version: version,
timelines: updatedTimelines,
computeLogVersion: computeLogVersion,
@@ -210,14 +208,12 @@ class FacesTimelineCachePayload {
);
}
- FacesTimelineCachePayload copyWithoutPerson(String personId) {
+ MemoryLaneCachePayload copyWithoutPerson(String personId) {
final updatedTimelines =
- Map<String, FacesTimelinePersonTimeline>.from(timelines)
- ..remove(personId);
- final updatedLog =
- Map<String, FacesTimelineComputeLogEntry>.from(computeLog)
- ..remove(personId);
- return FacesTimelineCachePayload(
+ Map<String, MemoryLanePersonTimeline>.from(timelines)..remove(personId);
+ final updatedLog = Map<String, MemoryLaneComputeLogEntry>.from(computeLog)
+ ..remove(personId);
+ return MemoryLaneCachePayload(
version: version,
timelines: updatedTimelines,
computeLogVersion: computeLogVersion,
@@ -225,13 +221,12 @@ class FacesTimelineCachePayload {
);
}
- FacesTimelineCachePayload copyWithComputeLogEntry(
- FacesTimelineComputeLogEntry entry,
+ MemoryLaneCachePayload copyWithComputeLogEntry(
+ MemoryLaneComputeLogEntry entry,
) {
- final updatedLog =
- Map<String, FacesTimelineComputeLogEntry>.from(computeLog);
+ final updatedLog = Map<String, MemoryLaneComputeLogEntry>.from(computeLog);
updatedLog[entry.personId] = entry;
- return FacesTimelineCachePayload(
+ return MemoryLaneCachePayload(
version: version,
timelines: timelines,
computeLogVersion: computeLogVersion,
@@ -239,11 +234,11 @@ class FacesTimelineCachePayload {
);
}
- FacesTimelineCachePayload copyWithComputeLog({
- required Map<String, FacesTimelineComputeLogEntry> entries,
+ MemoryLaneCachePayload copyWithComputeLog({
+ required Map<String, MemoryLaneComputeLogEntry> entries,
required int logVersion,
}) {
- return FacesTimelineCachePayload(
+ return MemoryLaneCachePayload(
version: version,
timelines: timelines,
computeLogVersion: logVersion,
@@ -251,25 +246,25 @@ class FacesTimelineCachePayload {
);
}
- factory FacesTimelineCachePayload.fromJson(Map<String, dynamic> json) {
+ factory MemoryLaneCachePayload.fromJson(Map<String, dynamic> json) {
final int jsonVersion = json["version"] as int? ?? currentVersion;
final peopleJson = json["people"] as Map<String, dynamic>? ?? {};
- final timelines = <String, FacesTimelinePersonTimeline>{};
+ final timelines = <String, MemoryLanePersonTimeline>{};
for (final entry in peopleJson.entries) {
- timelines[entry.key] = FacesTimelinePersonTimeline.fromJson(
+ timelines[entry.key] = MemoryLanePersonTimeline.fromJson(
Map<String, dynamic>.from(entry.value as Map),
);
}
final computeLogVersion =
json["computeLogVersion"] as int? ?? currentComputeLogVersion;
final computeLogJson = json["computeLog"] as Map<String, dynamic>? ?? {};
- final computeLog = <String, FacesTimelineComputeLogEntry>{};
+ final computeLog = <String, MemoryLaneComputeLogEntry>{};
for (final entry in computeLogJson.entries) {
- computeLog[entry.key] = FacesTimelineComputeLogEntry.fromJson(
+ computeLog[entry.key] = MemoryLaneComputeLogEntry.fromJson(
Map<String, dynamic>.from(entry.value as Map),
);
}
- return FacesTimelineCachePayload(
+ return MemoryLaneCachePayload(
version: jsonVersion,
timelines: timelines,
computeLogVersion: computeLogVersion,
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 41bdf53803..00f31e77b5 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
@@ -7,19 +7,19 @@ import "package:path_provider/path_provider.dart";
import "package:photos/models/memory_lane/memory_lane_models.dart";
import "package:synchronized/synchronized.dart";
-class FacesTimelineCacheService {
- FacesTimelineCacheService._internal();
+class MemoryLaneCacheService {
+ MemoryLaneCacheService._internal();
- static final FacesTimelineCacheService instance =
- FacesTimelineCacheService._internal();
+ static final MemoryLaneCacheService instance =
+ MemoryLaneCacheService._internal();
static const _cacheDirectoryName = "faces_timeline";
static const _cacheFileName = "cache.json";
- final Logger _logger = Logger("FacesTimelineCacheService");
+ final Logger _logger = Logger("MemoryLaneCacheService");
final Lock _lock = Lock();
- FacesTimelineCachePayload? _cache;
+ MemoryLaneCachePayload? _cache;
File? _cacheFile;
bool _initialized = false;
@@ -38,7 +38,7 @@ class FacesTimelineCacheService {
await _lock.synchronized(() async {
_cacheFile = file;
if (!await file.exists()) {
- _cache = FacesTimelineCachePayload.empty();
+ _cache = MemoryLaneCachePayload.empty();
await _writeCacheUnsafe();
} else {
await _loadCacheUnsafe();
@@ -47,7 +47,7 @@ class FacesTimelineCacheService {
});
}
- Future<FacesTimelineCachePayload> getCache() async {
+ Future<MemoryLaneCachePayload> getCache() async {
await _ensureInitialized();
return _lock.synchronized(() async {
_cache ??= await _loadCacheUnsafe();
@@ -55,24 +55,24 @@ class FacesTimelineCacheService {
});
}
- Future<FacesTimelinePersonTimeline?> getTimeline(String personId) async {
+ Future<MemoryLanePersonTimeline?> getTimeline(String personId) async {
final cache = await getCache();
return cache[personId];
}
- Future<FacesTimelineComputeLogEntry?> getComputeLogEntry(
+ Future<MemoryLaneComputeLogEntry?> getComputeLogEntry(
String personId,
) async {
final cache = await getCache();
return cache.computeLog[personId];
}
- Future<Map<String, FacesTimelineComputeLogEntry>> getComputeLog() async {
+ Future<Map<String, MemoryLaneComputeLogEntry>> getComputeLog() async {
final cache = await getCache();
- return Map<String, FacesTimelineComputeLogEntry>.from(cache.computeLog);
+ return Map<String, MemoryLaneComputeLogEntry>.from(cache.computeLog);
}
- Future<void> upsertTimeline(FacesTimelinePersonTimeline timeline) async {
+ Future<void> upsertTimeline(MemoryLanePersonTimeline timeline) async {
await _ensureInitialized();
await _lock.synchronized(() async {
final currentCache = await _loadCacheUnsafe();
@@ -83,7 +83,7 @@ class FacesTimelineCacheService {
}
Future<void> upsertComputeLogEntry(
- FacesTimelineComputeLogEntry entry,
+ MemoryLaneComputeLogEntry entry,
) async {
await _ensureInitialized();
await _lock.synchronized(() async {
@@ -101,7 +101,7 @@ class FacesTimelineCacheService {
if (!currentCache.computeLog.containsKey(personId)) {
return;
}
- final updatedLog = Map<String, FacesTimelineComputeLogEntry>.from(
+ final updatedLog = Map<String, MemoryLaneComputeLogEntry>.from(
currentCache.computeLog,
)..remove(personId);
_cache = currentCache.copyWithComputeLog(
@@ -140,7 +140,7 @@ class FacesTimelineCacheService {
});
}
- Future<void> replaceAll(FacesTimelineCachePayload payload) async {
+ Future<void> replaceAll(MemoryLaneCachePayload payload) async {
await _ensureInitialized();
await _lock.synchronized(() async {
_cache = payload;
@@ -151,7 +151,7 @@ class FacesTimelineCacheService {
Future<void> clear() async {
await _ensureInitialized();
await _lock.synchronized(() async {
- _cache = FacesTimelineCachePayload.empty();
+ _cache = MemoryLaneCachePayload.empty();
await _writeCacheUnsafe();
});
}
@@ -161,29 +161,29 @@ class FacesTimelineCacheService {
await init();
}
- Future<FacesTimelineCachePayload> _loadCacheUnsafe() async {
+ Future<MemoryLaneCachePayload> _loadCacheUnsafe() async {
if (_cache != null) return _cache!;
final file = _cacheFile;
if (file == null) {
_logger.severe("Faces timeline cache accessed before initialization");
- _cache = FacesTimelineCachePayload.empty();
+ _cache = MemoryLaneCachePayload.empty();
return _cache!;
}
try {
final contents = await file.readAsString();
if (contents.trim().isEmpty) {
- _cache = FacesTimelineCachePayload.empty();
+ _cache = MemoryLaneCachePayload.empty();
return _cache!;
}
final decoded = jsonDecode(contents);
if (decoded is! Map<String, dynamic>) {
throw const FormatException("Timeline cache is not a JSON map");
}
- _cache = FacesTimelineCachePayload.fromJson(decoded);
+ _cache = MemoryLaneCachePayload.fromJson(decoded);
return _cache!;
} catch (error, stackTrace) {
_logger.severe("Failed to read faces timeline cache", error, stackTrace);
- _cache = FacesTimelineCachePayload.empty();
+ _cache = MemoryLaneCachePayload.empty();
await _writeCacheUnsafe();
return _cache!;
}
@@ -195,7 +195,7 @@ class FacesTimelineCacheService {
_logger.severe("Faces timeline cache file missing during write");
return;
}
- final payload = _cache ?? FacesTimelineCachePayload.empty();
+ final payload = _cache ?? MemoryLaneCachePayload.empty();
try {
await file.writeAsString(payload.toEncodedJson(), flush: true);
} catch (error, stackTrace) {
diff --git a/mobile/apps/photos/lib/services/memory_lane/memory_lane_service.dart b/mobile/apps/photos/lib/services/memory_lane/memory_lane_service.dart
index 05afd78c14..e527763191 100644
--- a/mobile/apps/photos/lib/services/memory_lane/memory_lane_service.dart
+++ b/mobile/apps/photos/lib/services/memory_lane/memory_lane_service.dart
@@ -21,15 +21,15 @@ import "package:photos/utils/face/face_thumbnail_cache.dart";
import "package:photos/utils/standalone/task_queue.dart";
typedef _TimelineComputationResult = ({
- FacesTimelinePersonTimeline timeline,
+ MemoryLanePersonTimeline timeline,
Map<int, EnteFile> filesById,
int faceCount,
});
-class FacesTimelineService {
- FacesTimelineService._internal();
+class MemoryLaneService {
+ MemoryLaneService._internal();
- static final FacesTimelineService instance = FacesTimelineService._internal();
+ static final MemoryLaneService instance = MemoryLaneService._internal();
static const _minimumYears = 5;
static const _minimumFacesPerYear = 4;
@@ -39,9 +39,8 @@ class FacesTimelineService {
static const _startupBackfillDelay = Duration(seconds: 15);
static const _startupBackfillBatchSize = 200;
- final Logger _logger = Logger("FacesTimelineService");
- final FacesTimelineCacheService _cacheService =
- FacesTimelineCacheService.instance;
+ final Logger _logger = Logger("MemoryLaneService");
+ final MemoryLaneCacheService _cacheService = MemoryLaneCacheService.instance;
final MLDataDB _mlDataDB = MLDataDB.instance;
final FilesDB _filesDB = FilesDB.instance;
final TaskQueue<String> _precomputeQueue = TaskQueue(
@@ -88,13 +87,13 @@ class FacesTimelineService {
}) async {
if (!isFeatureEnabled) {
_logger.fine(
- "Faces timeline full recompute skipped ($trigger): feature disabled",
+ "Memory Lane full recompute skipped ($trigger): feature disabled",
);
return;
}
if (!PersonService.isInitialized) {
_logger.warning(
- "Faces timeline full recompute skipped: PersonService not initialized",
+ "Memory Lane full recompute skipped: PersonService not initialized",
);
return;
}
@@ -119,7 +118,7 @@ class FacesTimelineService {
}) {
if (!isFeatureEnabled) {
_logger.fine(
- "Faces timeline recompute skipped for $personId ($trigger): feature disabled",
+ "Memory Lane recompute skipped for $personId ($trigger): feature disabled",
);
return;
}
@@ -148,14 +147,14 @@ class FacesTimelineService {
}).catchError((error, stackTrace) {
_pendingRequests.remove(personId);
_logger.warning(
- "Faces timeline recompute task failed to enqueue for $personId",
+ "Memory Lane recompute task failed to enqueue for $personId",
error,
stackTrace,
);
});
}
- Future<FacesTimelinePersonTimeline?> getTimeline(String personId) {
+ Future<MemoryLanePersonTimeline?> getTimeline(String personId) {
if (!isFeatureEnabled) return Future.value(null);
return _cacheService.getTimeline(personId);
}
@@ -178,9 +177,9 @@ class FacesTimelineService {
await _cacheService.removeTimeline(personId);
await _refreshReadyPersonIds();
Bus.instance.fire(
- FacesTimelineChangedEvent(
+ MemoryLaneChangedEvent(
personId: personId,
- status: FacesTimelineStatus.ineligible,
+ status: MemoryLaneStatus.ineligible,
),
);
}
@@ -188,7 +187,7 @@ class FacesTimelineService {
void _handlePeopleChange(PeopleChangedEvent event) {
if (!isFeatureEnabled) {
_logger.fine(
- "Faces timeline people change ignored (${event.type.name}): feature disabled",
+ "Memory Lane people change ignored (${event.type.name}): feature disabled",
);
return;
}
@@ -202,7 +201,7 @@ class FacesTimelineService {
final person = event.person;
if (person == null) {
_logger.warning(
- "Faces timeline: people event ${event.type.name} missing person data",
+ "Memory Lane: people event ${event.type.name} missing person data",
);
_scheduleStartupBackfill();
return;
@@ -215,7 +214,7 @@ class FacesTimelineService {
final logEntry = await _cacheService.getComputeLogEntry(person.remoteID);
if (logEntry == null) {
_logger.info(
- "Faces timeline: no compute log for ${person.remoteID}, forcing recompute ($triggerPrefix)",
+ "Memory Lane: no compute log for ${person.remoteID}, forcing recompute ($triggerPrefix)",
);
schedulePersonRecompute(
person.remoteID,
@@ -234,7 +233,7 @@ class FacesTimelineService {
if (!nameChanged && !birthDateChanged && !faceCountChanged) {
_logger.fine(
- "Faces timeline: ${person.remoteID} change ignored "
+ "Memory Lane: ${person.remoteID} change ignored "
"(no name/dob/face count deltas)",
);
return;
@@ -246,7 +245,7 @@ class FacesTimelineService {
if (_timelineFacesMissing(timeline, currentFaceIdSet)) {
final trigger = "${triggerPrefix}_face_removed";
_logger.info(
- "Faces timeline: recompute scheduled for ${person.remoteID} ($trigger)",
+ "Memory Lane: recompute scheduled for ${person.remoteID} ($trigger)",
);
schedulePersonRecompute(person.remoteID, trigger: trigger);
return;
@@ -255,7 +254,7 @@ class FacesTimelineService {
if (birthDateChanged) {
final trigger = "${triggerPrefix}_birthdate_changed";
_logger.info(
- "Faces timeline: recompute scheduled for ${person.remoteID} ($trigger)",
+ "Memory Lane: recompute scheduled for ${person.remoteID} ($trigger)",
);
schedulePersonRecompute(person.remoteID, trigger: trigger);
return;
@@ -263,7 +262,7 @@ class FacesTimelineService {
if (!faceCountChanged) {
_logger.fine(
- "Faces timeline: ${person.remoteID} change skipped after checks "
+ "Memory Lane: ${person.remoteID} change skipped after checks "
"(nameChanged=$nameChanged, faceCountChanged=$faceCountChanged)",
);
return;
@@ -273,14 +272,14 @@ class FacesTimelineService {
if (_hasNewYearWithTenFaces(timeline, facesPerYear)) {
final trigger = "${triggerPrefix}_new_year";
_logger.info(
- "Faces timeline: recompute scheduled for ${person.remoteID} ($trigger)",
+ "Memory Lane: recompute scheduled for ${person.remoteID} ($trigger)",
);
schedulePersonRecompute(person.remoteID, trigger: trigger);
return;
}
_logger.fine(
- "Faces timeline: ${person.remoteID} change skipped "
+ "Memory Lane: ${person.remoteID} change skipped "
"(nameChanged=$nameChanged, birthDateChanged=$birthDateChanged, "
"faceCountChanged=$faceCountChanged)",
);
@@ -301,7 +300,7 @@ class FacesTimelineService {
if (!isFeatureEnabled) return;
if (!PersonService.isInitialized) {
_logger.warning(
- "Faces timeline startup diff skipped: PersonService not initialized",
+ "Memory Lane startup diff skipped: PersonService not initialized",
);
return;
}
@@ -322,7 +321,7 @@ class FacesTimelineService {
}
}
if (missingIds.isEmpty) {
- _logger.fine("Faces timeline startup diff: all persons covered");
+ _logger.fine("Memory Lane startup diff: all persons covered");
return;
}
for (final personId in missingIds) {
@@ -333,11 +332,11 @@ class FacesTimelineService {
);
}
_logger.info(
- "Faces timeline startup diff queued ${missingIds.length} persons",
+ "Memory Lane startup diff queued ${missingIds.length} persons",
);
} catch (error, stackTrace) {
_logger.severe(
- "Faces timeline startup diff failed",
+ "Memory Lane startup diff failed",
error,
stackTrace,
);
@@ -375,7 +374,7 @@ class FacesTimelineService {
}
bool _timelineFacesMissing(
- FacesTimelinePersonTimeline? timeline,
+ MemoryLanePersonTimeline? timeline,
Set<String> currentFaceIds,
) {
if (timeline == null || timeline.entries.isEmpty) {
@@ -390,7 +389,7 @@ class FacesTimelineService {
}
bool _hasNewYearWithTenFaces(
- FacesTimelinePersonTimeline? timeline,
+ MemoryLanePersonTimeline? timeline,
Map<int, int> facesPerYear,
) {
if (facesPerYear.isEmpty) {
@@ -413,32 +412,32 @@ class FacesTimelineService {
}) async {
if (!isFeatureEnabled) {
_logger.fine(
- "Faces timeline compute skipped for $personId ($trigger): feature disabled",
+ "Memory Lane compute skipped for $personId ($trigger): feature disabled",
);
return;
}
if (!PersonService.isInitialized) {
_logger.warning(
- "Faces timeline recompute skipped for $personId: PersonService not initialized",
+ "Memory Lane recompute skipped for $personId: PersonService not initialized",
);
return;
}
final person = await PersonService.instance.getPerson(personId);
if (person == null) {
- _logger.info("Faces timeline: person $personId missing, clearing cache");
+ _logger.info("Memory Lane: person $personId missing, clearing cache");
await _cacheService.removeTimeline(personId);
await _refreshReadyPersonIds();
Bus.instance.fire(
- FacesTimelineChangedEvent(
+ MemoryLaneChangedEvent(
personId: personId,
- status: FacesTimelineStatus.ineligible,
+ status: MemoryLaneStatus.ineligible,
),
);
return;
}
if (person.data.isIgnored) {
- _logger.info("Faces timeline: person $personId ignored, clearing cache");
+ _logger.info("Memory Lane: person $personId ignored, clearing cache");
await _handleIgnoredPerson(personId);
return;
}
@@ -451,7 +450,7 @@ class FacesTimelineService {
final remaining = nowMicros - lastComputedMicros;
if (remaining < _recomputeCooldown.inMicroseconds) {
_logger.fine(
- "Faces timeline compute skipped for $personId due to cooldown "
+ "Memory Lane compute skipped for $personId due to cooldown "
"(elapsed ${remaining / Duration.microsecondsPerHour} hours, trigger: $trigger)",
);
return;
@@ -461,7 +460,7 @@ class FacesTimelineService {
final remaining = nowMicros - lastForcedMicros;
if (remaining < _recomputeCooldown.inMicroseconds) {
_logger.fine(
- "Faces timeline compute skipped for $personId due to forced cooldown "
+ "Memory Lane compute skipped for $personId due to forced cooldown "
"(elapsed ${remaining / Duration.microsecondsPerHour} hours, trigger: $trigger)",
);
return;
@@ -476,7 +475,7 @@ class FacesTimelineService {
final result = await _computeTimeline(person, nowMicros);
await _cacheService.upsertTimeline(result.timeline);
await _cacheService.upsertComputeLogEntry(
- FacesTimelineComputeLogEntry(
+ MemoryLaneComputeLogEntry(
personId: person.remoteID,
name: person.data.name,
birthDate: person.data.birthDate,
@@ -487,7 +486,7 @@ class FacesTimelineService {
);
await _refreshReadyPersonIds();
Bus.instance.fire(
- FacesTimelineChangedEvent(
+ MemoryLaneChangedEvent(
personId: person.remoteID,
status: result.timeline.status,
),
@@ -501,7 +500,7 @@ class FacesTimelineService {
}
} catch (error, stackTrace) {
_logger.severe(
- "Faces timeline compute failed for $personId (trigger: $trigger)",
+ "Memory Lane compute failed for $personId (trigger: $trigger)",
error,
stackTrace,
);
@@ -519,11 +518,11 @@ class FacesTimelineService {
final totalFaceCount = faceIds.length;
if (faceIds.isEmpty) {
_logger.fine(
- "Faces timeline: person $personId has no faces, marking ineligible",
+ "Memory Lane: person $personId has no faces, marking ineligible",
);
- final timeline = FacesTimelinePersonTimeline(
+ final timeline = MemoryLanePersonTimeline(
personId: personId,
- status: FacesTimelineStatus.ineligible,
+ status: MemoryLaneStatus.ineligible,
updatedAtMicros: nowMicros,
entries: const [],
);
@@ -586,12 +585,12 @@ class FacesTimelineService {
if (faces.isEmpty) {
_logger.fine(
- "Faces timeline: person $personId has no usable faces after filtering,"
+ "Memory Lane: person $personId has no usable faces after filtering,"
" marking ineligible",
);
- final timeline = FacesTimelinePersonTimeline(
+ final timeline = MemoryLanePersonTimeline(
personId: personId,
- status: FacesTimelineStatus.ineligible,
+ status: MemoryLaneStatus.ineligible,
updatedAtMicros: nowMicros,
entries: const [],
);
@@ -618,12 +617,12 @@ class FacesTimelineService {
final eligibleYearCount =
selectionResult["eligibleYearCount"] as int? ?? 0;
_logger.info(
- "Faces timeline: person $personId ineligible "
+ "Memory Lane: person $personId ineligible "
"(eligibleYears=$eligibleYearCount, faces=${faces.length})",
);
- final timeline = FacesTimelinePersonTimeline(
+ final timeline = MemoryLanePersonTimeline(
personId: personId,
- status: FacesTimelineStatus.ineligible,
+ status: MemoryLaneStatus.ineligible,
updatedAtMicros: nowMicros,
entries: const [],
);
@@ -638,7 +637,7 @@ class FacesTimelineService {
.cast<Map<String, dynamic>>();
final entries = entriesJson
.map(
- (entryJson) => FacesTimelineEntry(
+ (entryJson) => MemoryLaneEntry(
faceId: entryJson["faceId"] as String,
fileId: entryJson["fileId"] as int,
creationTimeMicros: entryJson["creationTime"] as int,
@@ -647,9 +646,9 @@ class FacesTimelineService {
)
.toList();
- final timeline = FacesTimelinePersonTimeline(
+ final timeline = MemoryLanePersonTimeline(
personId: personId,
- status: FacesTimelineStatus.ready,
+ status: MemoryLaneStatus.ready,
updatedAtMicros: nowMicros,
entries: entries,
);
@@ -658,7 +657,7 @@ class FacesTimelineService {
(selectionResult["years"] as List<dynamic>?)?.cast<int>().join(", ") ??
"unknown";
_logger.info(
- "Faces timeline ready for $personId "
+ "Memory Lane ready for $personId "
"(frames=${entries.length}, years=$years)",
);
@@ -667,11 +666,11 @@ class FacesTimelineService {
Future<void> _ensureFaceCrops(
PersonEntity person,
- List<FacesTimelineEntry> entries,
+ List<MemoryLaneEntry> entries,
Map<int, EnteFile> fileMap,
) async {
final personId = person.remoteID;
- final entriesByFile = <int, List<FacesTimelineEntry>>{};
+ final entriesByFile = <int, List<MemoryLaneEntry>>{};
for (final entry in entries) {
entriesByFile.putIfAbsent(entry.fileId, () => []).add(entry);
}
@@ -699,7 +698,7 @@ class FacesTimelineService {
);
} catch (error, stackTrace) {
_logger.warning(
- "Faces timeline: failed to cache crops for $personId file ${entry.key}",
+ "Memory Lane: failed to cache crops for $personId file ${entry.key}",
error,
stackTrace,
);
diff --git a/mobile/apps/photos/lib/ui/viewer/people/memory_lane_banner.dart b/mobile/apps/photos/lib/ui/viewer/people/memory_lane_banner.dart
index 502326119b..e1baa23adb 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/memory_lane_banner.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/memory_lane_banner.dart
@@ -13,12 +13,12 @@ import "package:photos/services/memory_lane/memory_lane_service.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/utils/face/face_thumbnail_cache.dart";
-class FacesTimelineBanner extends StatelessWidget {
+class MemoryLaneBanner extends StatelessWidget {
final String title;
final VoidCallback onTap;
final ImageProvider? thumbnail;
- const FacesTimelineBanner({
+ const MemoryLaneBanner({
required this.title,
required this.onTap,
this.thumbnail,
@@ -228,14 +228,14 @@ class _SparklePainter extends CustomPainter {
}
}
-class FacesTimelineBannerSection extends StatefulWidget {
+class MemoryLaneBannerSection extends StatefulWidget {
final bool showBanner;
final PersonEntity person;
final VoidCallback? onTap;
- final Future<FacesTimelinePersonTimeline?> Function(String personId)?
+ final Future<MemoryLanePersonTimeline?> Function(String personId)?
loadTimeline;
- const FacesTimelineBannerSection({
+ const MemoryLaneBannerSection({
required this.showBanner,
required this.person,
this.onTap,
@@ -244,13 +244,12 @@ class FacesTimelineBannerSection extends StatefulWidget {
});
@override
- State<FacesTimelineBannerSection> createState() =>
- _FacesTimelineBannerSectionState();
+ State<MemoryLaneBannerSection> createState() =>
+ _MemoryLaneBannerSectionState();
}
-class _FacesTimelineBannerSectionState
- extends State<FacesTimelineBannerSection> {
- final Logger _logger = Logger("FacesTimelineBannerSection");
+class _MemoryLaneBannerSectionState extends State<MemoryLaneBannerSection> {
+ final Logger _logger = Logger("MemoryLaneBannerSection");
MemoryImage? _thumbnail;
Future<void>? _thumbnailFuture;
@@ -261,7 +260,7 @@ class _FacesTimelineBannerSectionState
}
@override
- void didUpdateWidget(covariant FacesTimelineBannerSection oldWidget) {
+ void didUpdateWidget(covariant MemoryLaneBannerSection oldWidget) {
super.didUpdateWidget(oldWidget);
final bool personChanged =
widget.person.remoteID != oldWidget.person.remoteID;
@@ -286,7 +285,7 @@ class _FacesTimelineBannerSectionState
Future<void> _loadThumbnail() async {
try {
final loader =
- widget.loadTimeline ?? FacesTimelineService.instance.getTimeline;
+ widget.loadTimeline ?? MemoryLaneService.instance.getTimeline;
final timeline = await loader(widget.person.remoteID);
if (!mounted || timeline == null || !timeline.isReady) {
return;
@@ -313,7 +312,7 @@ class _FacesTimelineBannerSectionState
}
}
- Future<MemoryImage?> _loadFaceThumbnail(FacesTimelineEntry entry) async {
+ Future<MemoryImage?> _loadFaceThumbnail(MemoryLaneEntry entry) async {
final file = await FilesDB.instance.getAnyUploadedFile(entry.fileId);
if (file == null) {
return null;
@@ -353,7 +352,7 @@ class _FacesTimelineBannerSectionState
if (!widget.showBanner || widget.onTap == null) {
return const SizedBox.shrink();
}
- return FacesTimelineBanner(
+ return MemoryLaneBanner(
title: context.l10n.facesTimelineBannerTitle,
onTap: widget.onTap!,
thumbnail: _thumbnail,
diff --git a/mobile/apps/photos/lib/ui/viewer/people/memory_lane_debug_panel.dart b/mobile/apps/photos/lib/ui/viewer/people/memory_lane_debug_panel.dart
index 072b293ae4..22a31f648e 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/memory_lane_debug_panel.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/memory_lane_debug_panel.dart
@@ -11,22 +11,21 @@ import "package:photos/services/memory_lane/memory_lane_cache_service.dart";
import "package:photos/services/memory_lane/memory_lane_service.dart";
import "package:photos/theme/ente_theme.dart";
-class FacesTimelineDebugPanel extends StatefulWidget {
+class MemoryLaneDebugPanel extends StatefulWidget {
final PersonEntity person;
- const FacesTimelineDebugPanel({required this.person, super.key});
+ const MemoryLaneDebugPanel({required this.person, super.key});
@override
- State<FacesTimelineDebugPanel> createState() =>
- _FacesTimelineDebugPanelState();
+ State<MemoryLaneDebugPanel> createState() => _MemoryLaneDebugPanelState();
}
-class _FacesTimelineDebugPanelState extends State<FacesTimelineDebugPanel> {
- FacesTimelinePersonTimeline? _timeline;
+class _MemoryLaneDebugPanelState extends State<MemoryLaneDebugPanel> {
+ MemoryLanePersonTimeline? _timeline;
bool _loading = false;
String? _error;
String? _info;
- StreamSubscription<FacesTimelineChangedEvent>? _timelineSubscription;
+ StreamSubscription<MemoryLaneChangedEvent>? _timelineSubscription;
bool get _featureEnabled => flagService.facesTimeline;
@@ -36,7 +35,7 @@ class _FacesTimelineDebugPanelState extends State<FacesTimelineDebugPanel> {
if (kDebugMode && _featureEnabled) {
_reloadTimeline();
_timelineSubscription = Bus.instance
- .on<FacesTimelineChangedEvent>()
+ .on<MemoryLaneChangedEvent>()
.listen(_handleTimelineChanged);
}
}
@@ -47,7 +46,7 @@ class _FacesTimelineDebugPanelState extends State<FacesTimelineDebugPanel> {
super.dispose();
}
- void _handleTimelineChanged(FacesTimelineChangedEvent event) {
+ void _handleTimelineChanged(MemoryLaneChangedEvent event) {
if (event.personId != widget.person.remoteID) return;
_reloadTimeline();
}
@@ -59,8 +58,8 @@ class _FacesTimelineDebugPanelState extends State<FacesTimelineDebugPanel> {
_error = null;
});
try {
- final timeline = await FacesTimelineService.instance
- .getTimeline(widget.person.remoteID);
+ final timeline =
+ await MemoryLaneService.instance.getTimeline(widget.person.remoteID);
if (!mounted) return;
setState(() {
_timeline = timeline;
@@ -80,7 +79,7 @@ class _FacesTimelineDebugPanelState extends State<FacesTimelineDebugPanel> {
}
Future<void> _forceRecompute() async {
- FacesTimelineService.instance.schedulePersonRecompute(
+ MemoryLaneService.instance.schedulePersonRecompute(
widget.person.remoteID,
force: true,
trigger: "debug_panel",
@@ -98,7 +97,7 @@ class _FacesTimelineDebugPanelState extends State<FacesTimelineDebugPanel> {
_error = null;
});
try {
- await FacesTimelineCacheService.instance
+ await MemoryLaneCacheService.instance
.removeTimeline(widget.person.remoteID);
await _reloadTimeline();
if (!mounted) return;
@@ -126,8 +125,8 @@ class _FacesTimelineDebugPanelState extends State<FacesTimelineDebugPanel> {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
final timeline = _timeline;
- final bool inReadySet = FacesTimelineService.instance
- .hasReadyTimelineSync(widget.person.remoteID);
+ final bool inReadySet =
+ MemoryLaneService.instance.hasReadyTimelineSync(widget.person.remoteID);
final DateTime? updatedAt = timeline == null
? null
: DateTime.fromMicrosecondsSinceEpoch(timeline.updatedAtMicros)
diff --git a/mobile/apps/photos/lib/ui/viewer/people/memory_lane_page.dart b/mobile/apps/photos/lib/ui/viewer/people/memory_lane_page.dart
index 72d5e3de5e..74e801e8f0 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/memory_lane_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/memory_lane_page.dart
@@ -21,16 +21,16 @@ import "package:photos/theme/effects.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/utils/face/face_thumbnail_cache.dart";
-class FacesTimelinePage extends StatefulWidget {
+class MemoryLanePage extends StatefulWidget {
final PersonEntity person;
- const FacesTimelinePage({required this.person, super.key});
+ const MemoryLanePage({required this.person, super.key});
@override
- State<FacesTimelinePage> createState() => _FacesTimelinePageState();
+ State<MemoryLanePage> createState() => _MemoryLanePageState();
}
-const LinearGradient _facesTimelineBackgroundGradient = LinearGradient(
+const LinearGradient _memoryLaneBackgroundGradient = LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
@@ -43,7 +43,7 @@ const LinearGradient _facesTimelineBackgroundGradient = LinearGradient(
stops: [0.0, 0.3, 0.52, 0.74, 1.0],
);
-class _FacesTimelinePageState extends State<FacesTimelinePage>
+class _MemoryLanePageState extends State<MemoryLanePage>
with TickerProviderStateMixin {
static const _frameInterval = Duration(milliseconds: 800);
static const _cardTransitionDuration = Duration(milliseconds: 520);
@@ -56,7 +56,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
// Wait for this many frames (or the available total) before auto-starting playback.
static const int _initialFrameTarget = 120;
- final Logger _logger = Logger("FacesTimelinePage");
+ final Logger _logger = Logger("MemoryLanePage");
late final AnimationController _cardTransitionController;
double _stackProgress = 0;
late final ValueNotifier<double> _stackProgressNotifier;
@@ -126,7 +126,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
Future<void> _loadFrames() async {
_hasMarkedTimelineSeen =
- localSettings.hasSeenFacesTimeline(widget.person.remoteID);
+ localSettings.hasSeenMemoryLane(widget.person.remoteID);
_playTimer?.cancel();
if (mounted) {
setState(() {
@@ -134,7 +134,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
});
}
try {
- final timeline = await FacesTimelineService.instance.getTimeline(
+ final timeline = await MemoryLaneService.instance.getTimeline(
widget.person.remoteID,
);
if (!mounted) {
@@ -237,7 +237,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
}
_hasMarkedTimelineSeen = true;
unawaited(
- localSettings.markFacesTimelineSeen(widget.person.remoteID),
+ localSettings.markMemoryLaneSeen(widget.person.remoteID),
);
}
@@ -274,7 +274,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
return math.max(1, rounded.toString().length);
}
- Future<_TimelineFrame> _buildFrame(FacesTimelineEntry entry) async {
+ Future<_TimelineFrame> _buildFrame(MemoryLaneEntry entry) async {
final file = await FilesDB.instance.getAnyUploadedFile(entry.fileId);
MemoryImage? image;
if (file != null) {
@@ -499,7 +499,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
);
return DecoratedBox(
decoration: const BoxDecoration(
- gradient: _facesTimelineBackgroundGradient,
+ gradient: _memoryLaneBackgroundGradient,
),
child: Scaffold(
backgroundColor: Colors.transparent,
@@ -677,7 +677,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
];
final children = orderedSlices.isEmpty
? [
- _FacesTimelineCard(
+ _MemoryLaneCard(
key: ValueKey<int>(_currentIndex),
frame: _frames[_currentIndex],
distance: 0,
@@ -689,7 +689,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
]
: orderedSlices
.map(
- (slice) => _FacesTimelineCard(
+ (slice) => _MemoryLaneCard(
key: ValueKey<int>(slice.index),
frame: _frames[slice.index],
distance: slice.distance,
@@ -850,7 +850,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
thumbColor: Colors.white,
overlayColor: Colors.transparent,
trackShape: const RoundedRectSliderTrackShape(),
- thumbShape: const _FacesTimelineSliderThumbShape(),
+ thumbShape: const _MemoryLaneSliderThumbShape(),
),
child: Slider(
value: sliderValue.toDouble(),
@@ -970,7 +970,7 @@ class _FacesTimelinePageState extends State<FacesTimelinePage>
}
class _TimelineFrame {
- final FacesTimelineEntry entry;
+ final MemoryLaneEntry entry;
final MemoryImage? image;
final DateTime creationDate;
final _CaptionType captionType;
@@ -995,7 +995,7 @@ class _CardSlice {
});
}
-class _FacesTimelineCard extends StatelessWidget {
+class _MemoryLaneCard extends StatelessWidget {
static const double _cardRadius = 28;
final _TimelineFrame frame;
@@ -1005,7 +1005,7 @@ class _FacesTimelineCard extends StatelessWidget {
final double cardHeight;
final bool blurEnabled;
- const _FacesTimelineCard({
+ const _MemoryLaneCard({
required this.frame,
required this.distance,
required this.isDarkMode,
@@ -1259,8 +1259,8 @@ double _yearsBetween(DateTime start, DateTime end) {
return days / 365.25;
}
-class _FacesTimelineSliderThumbShape extends SliderComponentShape {
- const _FacesTimelineSliderThumbShape();
+class _MemoryLaneSliderThumbShape extends SliderComponentShape {
+ const _MemoryLaneSliderThumbShape();
static const double _thumbRadius = 12;
diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
index 0ad89028e7..571af3fb90 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/people_app_bar.dart
@@ -34,8 +34,8 @@ class PeopleAppBar extends StatefulWidget {
final String? title;
final SelectedFiles selectedFiles;
final PersonEntity person;
- final bool facesTimelineReady;
- final Future<void> Function()? onFacesTimelineTap;
+ final bool memoryLaneReady;
+ final Future<void> Function()? onMemoryLaneTap;
bool get isIgnored => person.data.isIgnored;
@@ -44,8 +44,8 @@ class PeopleAppBar extends StatefulWidget {
this.title,
this.selectedFiles,
this.person, {
- this.facesTimelineReady = false,
- this.onFacesTimelineTap,
+ this.memoryLaneReady = false,
+ this.onMemoryLaneTap,
super.key,
});
@@ -226,7 +226,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
final List<PopupMenuItem<PeoplePopupAction>> items = [];
final bool showTimelineAction =
- widget.facesTimelineReady && widget.onFacesTimelineTap != null;
+ widget.memoryLaneReady && widget.onMemoryLaneTap != null;
if (showTimelineAction) {
items.add(
PopupMenuItem(
@@ -401,7 +401,7 @@ class _AppBarWidgetState extends State<PeopleAppBar> {
),
);
} else if (value == PeoplePopupAction.memoryLane) {
- final callback = widget.onFacesTimelineTap;
+ final callback = widget.onMemoryLaneTap;
if (callback != null) {
unawaited(callback());
}
diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_page.dart b/mobile/apps/photos/lib/ui/viewer/people/people_page.dart
index 868c698ec9..a5c34a2821 100644
--- a/mobile/apps/photos/lib/ui/viewer/people/people_page.dart
+++ b/mobile/apps/photos/lib/ui/viewer/people/people_page.dart
@@ -56,7 +56,7 @@ class PeoplePage extends StatefulWidget {
class _PeoplePageState extends State<PeoplePage> {
final Logger _logger = Logger("_PeoplePageState");
- final Logger _timelineLogger = Logger("FacesTimelineInteractions");
+ final Logger _timelineLogger = Logger("MemoryLaneInteractions");
final _selectedFiles = SelectedFiles();
List<EnteFile>? files;
Future<List<EnteFile>> filesFuture = Future.value([]);
@@ -70,7 +70,7 @@ class _PeoplePageState extends State<PeoplePage> {
ValueNotifier<Set<String>>? _timelineNotifier;
VoidCallback? _timelineListener;
- bool get _facesTimelineEnabled => flagService.facesTimeline;
+ bool get _memoryLaneEnabled => flagService.facesTimeline;
@override
void initState() {
@@ -109,17 +109,17 @@ class _PeoplePageState extends State<PeoplePage> {
widget.searchResult!.getHierarchicalSearchFilter(),
)
: null;
- if (_facesTimelineEnabled) {
- _timelineNotifier = FacesTimelineService.instance.readyPersonIds;
+ if (_memoryLaneEnabled) {
+ _timelineNotifier = MemoryLaneService.instance.readyPersonIds;
_timelineListener = () {
if (!mounted) return;
setState(() {});
};
_timelineNotifier!.addListener(_timelineListener!);
- if (!FacesTimelineService.instance.hasReadyTimelineSync(
+ if (!MemoryLaneService.instance.hasReadyTimelineSync(
_person.remoteID,
)) {
- FacesTimelineService.instance.schedulePersonRecompute(
+ MemoryLaneService.instance.schedulePersonRecompute(
_person.remoteID,
trigger: "people_page_visit",
);
@@ -147,10 +147,10 @@ class _PeoplePageState extends State<PeoplePage> {
super.dispose();
}
- Future<void> _openFacesTimelinePage() async {
- if (!_facesTimelineEnabled) return;
+ Future<void> _openMemoryLanePage() async {
+ if (!_memoryLaneEnabled) return;
_timelineLogger.info("banner_tap person=${_person.remoteID}");
- await routeToPage(context, FacesTimelinePage(person: _person));
+ await routeToPage(context, MemoryLanePage(person: _person));
if (!mounted) {
return;
}
@@ -160,16 +160,16 @@ class _PeoplePageState extends State<PeoplePage> {
@override
Widget build(BuildContext context) {
_logger.info("Building for ${_person.data.name}");
- final bool featureEnabled = _facesTimelineEnabled;
- final bool facesTimelineReady = featureEnabled
- ? FacesTimelineService.instance.hasReadyTimelineSync(
+ final bool featureEnabled = _memoryLaneEnabled;
+ final bool memoryLaneReady = featureEnabled
+ ? MemoryLaneService.instance.hasReadyTimelineSync(
_person.remoteID,
)
: false;
- final bool hasSeenFacesTimeline =
- localSettings.hasSeenFacesTimeline(_person.remoteID);
- final bool showFacesTimelineBanner =
- featureEnabled && facesTimelineReady && !hasSeenFacesTimeline;
+ final bool hasSeenMemoryLane =
+ localSettings.hasSeenMemoryLane(_person.remoteID);
+ final bool showMemoryLaneBanner =
+ featureEnabled && memoryLaneReady && !hasSeenMemoryLane;
return GalleryBoundariesProvider(
child: GalleryFilesState(
@@ -187,9 +187,9 @@ class _PeoplePageState extends State<PeoplePage> {
: _person.data.name,
_selectedFiles,
_person,
- facesTimelineReady: facesTimelineReady,
- onFacesTimelineTap: featureEnabled && facesTimelineReady
- ? _openFacesTimelinePage
+ memoryLaneReady: memoryLaneReady,
+ onMemoryLaneTap: featureEnabled && memoryLaneReady
+ ? _openMemoryLanePage
: null,
),
),
@@ -223,15 +223,15 @@ class _PeoplePageState extends State<PeoplePage> {
personFiles: personFiles,
loadPersonFiles: _loadPersonFiles,
personEntity: _person,
- facesTimelineEnabled: featureEnabled,
+ memoryLaneEnabled: featureEnabled,
showTimelineBanner:
- showFacesTimelineBanner,
- onTimelineTap: featureEnabled &&
- facesTimelineReady
- ? () => unawaited(
- _openFacesTimelinePage(),
- )
- : null,
+ showMemoryLaneBanner,
+ onTimelineTap:
+ featureEnabled && memoryLaneReady
+ ? () => unawaited(
+ _openMemoryLanePage(),
+ )
+ : null,
);
},
)
@@ -241,14 +241,13 @@ class _PeoplePageState extends State<PeoplePage> {
personFiles: personFiles,
loadPersonFiles: _loadPersonFiles,
personEntity: _person,
- facesTimelineEnabled: featureEnabled,
- showTimelineBanner: showFacesTimelineBanner,
- onTimelineTap:
- featureEnabled && facesTimelineReady
- ? () => unawaited(
- _openFacesTimelinePage(),
- )
- : null,
+ memoryLaneEnabled: featureEnabled,
+ showTimelineBanner: showMemoryLaneBanner,
+ onTimelineTap: featureEnabled && memoryLaneReady
+ ? () => unawaited(
+ _openMemoryLanePage(),
+ )
+ : null,
),
FileSelectionOverlayBar(
PeoplePage.overlayType,
@@ -282,7 +281,7 @@ class _Gallery extends StatefulWidget {
final List<EnteFile> personFiles;
final Future<List<EnteFile>> Function() loadPersonFiles;
final PersonEntity personEntity;
- final bool facesTimelineEnabled;
+ final bool memoryLaneEnabled;
final bool showTimelineBanner;
final VoidCallback? onTimelineTap;
@@ -292,7 +291,7 @@ class _Gallery extends StatefulWidget {
required this.personFiles,
required this.loadPersonFiles,
required this.personEntity,
- required this.facesTimelineEnabled,
+ required this.memoryLaneEnabled,
this.showTimelineBanner = false,
this.onTimelineTap,
});
@@ -303,7 +302,7 @@ class _Gallery extends StatefulWidget {
class _GalleryState extends State<_Gallery> {
bool userDismissedPersonGallerySuggestion = false;
- final Logger _timelineLogger = Logger("FacesTimelineBanner");
+ final Logger _timelineLogger = Logger("MemoryLaneBanner");
bool _loggedTimelineImpression = false;
@override
@@ -358,14 +357,13 @@ class _GalleryState extends State<_Gallery> {
},
),
),
- FacesTimelineBannerSection(
- showBanner:
- widget.facesTimelineEnabled && widget.showTimelineBanner,
+ MemoryLaneBannerSection(
+ showBanner: widget.memoryLaneEnabled && widget.showTimelineBanner,
person: widget.personEntity,
- onTap: widget.facesTimelineEnabled ? widget.onTimelineTap : null,
+ onTap: widget.memoryLaneEnabled ? widget.onTimelineTap : null,
),
- if (widget.facesTimelineEnabled)
- FacesTimelineDebugPanel(person: widget.personEntity),
+ if (widget.memoryLaneEnabled)
+ MemoryLaneDebugPanel(person: widget.personEntity),
!userDismissedPersonGallerySuggestion
? Dismissible(
key: const Key("personGallerySuggestion"),
diff --git a/mobile/apps/photos/lib/utils/local_settings.dart b/mobile/apps/photos/lib/utils/local_settings.dart
index a3dbf531da..7f130796c6 100644
--- a/mobile/apps/photos/lib/utils/local_settings.dart
+++ b/mobile/apps/photos/lib/utils/local_settings.dart
@@ -50,7 +50,7 @@ class LocalSettings {
static const _kInternalUserDisabled = "ls.internal_user_disabled";
static const _kWrapped2025ResumeIndex = "ls.wrapped_2025_resume_index";
static const _kWrapped2025Complete = "ls.wrapped_2025_complete";
- static const _facesTimelineSeenKey = "faces_timeline_seen_person_ids";
+ static const _memoryLaneSeenKey = "faces_timeline_seen_person_ids";
final SharedPreferences _prefs;
@@ -186,23 +186,23 @@ class LocalSettings {
await _prefs.setBool(_kHasSeenMLEnablingBanner, true);
}
- bool hasSeenFacesTimeline(String personId) {
- final seenIds = _prefs.getStringList(_facesTimelineSeenKey);
+ bool hasSeenMemoryLane(String personId) {
+ final seenIds = _prefs.getStringList(_memoryLaneSeenKey);
if (seenIds == null || seenIds.isEmpty) {
return false;
}
return seenIds.contains(personId);
}
- Future<void> markFacesTimelineSeen(String personId) async {
+ Future<void> markMemoryLaneSeen(String personId) async {
final List<String> seenIds = List<String>.from(
- _prefs.getStringList(_facesTimelineSeenKey) ?? [],
+ _prefs.getStringList(_memoryLaneSeenKey) ?? [],
);
if (seenIds.contains(personId)) {
return;
}
seenIds.add(personId);
- await _prefs.setStringList(_facesTimelineSeenKey, seenIds);
+ await _prefs.setStringList(_memoryLaneSeenKey, seenIds);
}
//#region todo:(NG) remove this section, only needed for internal testing to see
diff --git a/mobile/apps/photos/test/services/memory_lane/memory_lane_selector_test.dart b/mobile/apps/photos/test/services/memory_lane/memory_lane_selector_test.dart
index e3041ae0ce..55cdad320e 100644
--- a/mobile/apps/photos/test/services/memory_lane/memory_lane_selector_test.dart
+++ b/mobile/apps/photos/test/services/memory_lane/memory_lane_selector_test.dart
@@ -19,7 +19,7 @@ Map<String, dynamic> _buildFace(
}
void main() {
- group("Faces timeline selection", () {
+ group("Memory lane selection", () {
test("returns ready when at least five eligible years are present", () {
final faces = <Map<String, dynamic>>[];
for (int year = 2010; year < 2015; year++) {
@@ -292,25 +292,25 @@ void main() {
group("minimum eligible creation time", () {
test("returns null when birthdate missing", () {
expect(
- FacesTimelineService.minimumEligibleCreationTimeMicros(null),
+ MemoryLaneService.minimumEligibleCreationTimeMicros(null),
isNull,
);
expect(
- FacesTimelineService.minimumEligibleCreationTimeMicros(""),
+ MemoryLaneService.minimumEligibleCreationTimeMicros(""),
isNull,
);
});
test("returns null for invalid birthdate string", () {
expect(
- FacesTimelineService.minimumEligibleCreationTimeMicros("invalid"),
+ MemoryLaneService.minimumEligibleCreationTimeMicros("invalid"),
isNull,
);
});
test("computes fifth birthday cutoff", () {
final birthDate = DateTime(2010, 6, 15);
- final cutoff = FacesTimelineService.minimumEligibleCreationTimeMicros(
+ final cutoff = MemoryLaneService.minimumEligibleCreationTimeMicros(
"2010-06-15",
);
final expected =
@@ -320,7 +320,7 @@ void main() {
});
test("clamps day for leap birthdays", () {
- final cutoff = FacesTimelineService.minimumEligibleCreationTimeMicros(
+ final cutoff = MemoryLaneService.minimumEligibleCreationTimeMicros(
"2012-02-29",
);
final expected = DateTime(2017, 2, 28).microsecondsSinceEpoch;
diff --git a/mobile/apps/photos/test/ui/viewer/people/memory_lane_banner_section_test.dart b/mobile/apps/photos/test/ui/viewer/people/memory_lane_banner_section_test.dart
index 47f7bc7b8d..b83c44aeb8 100644
--- a/mobile/apps/photos/test/ui/viewer/people/memory_lane_banner_section_test.dart
+++ b/mobile/apps/photos/test/ui/viewer/people/memory_lane_banner_section_test.dart
@@ -5,7 +5,7 @@ import "package:photos/models/ml/face/person.dart";
import "package:photos/ui/viewer/people/memory_lane_banner.dart";
void main() {
- group("FacesTimelineBannerSection", () {
+ group("MemoryLaneBannerSection", () {
late PersonEntity person;
setUp(() {
@@ -20,7 +20,7 @@ void main() {
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
- home: FacesTimelineBannerSection(
+ home: MemoryLaneBannerSection(
showBanner: true,
person: person,
onTap: () {},
@@ -31,8 +31,8 @@ void main() {
await tester.pump();
- expect(find.byType(FacesTimelineBanner), findsOneWidget);
- final context = tester.element(find.byType(FacesTimelineBanner));
+ expect(find.byType(MemoryLaneBanner), findsOneWidget);
+ final context = tester.element(find.byType(MemoryLaneBanner));
final l10n = AppLocalizations.of(context)!;
expect(find.text(l10n.facesTimelineBannerTitle), findsOneWidget);
});
@@ -42,7 +42,7 @@ void main() {
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
- home: FacesTimelineBannerSection(
+ home: MemoryLaneBannerSection(
showBanner: false,
person: person,
onTap: () {},
@@ -51,7 +51,7 @@ void main() {
),
);
- expect(find.byType(FacesTimelineBanner), findsNothing);
+ expect(find.byType(MemoryLaneBanner), findsNothing);
});
testWidgets("hides banner when tap callback is missing", (tester) async {
@@ -59,7 +59,7 @@ void main() {
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
- home: FacesTimelineBannerSection(
+ home: MemoryLaneBannerSection(
showBanner: true,
person: person,
onTap: null,
@@ -68,7 +68,7 @@ void main() {
),
);
- expect(find.byType(FacesTimelineBanner), findsNothing);
+ expect(find.byType(MemoryLaneBanner), findsNothing);
});
});
}