π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fixup! [mobile][photos] validate scheduled memory lane timelines
Priyanshu Dangareb1e72aabcfa7
diff --git a/mobile/apps/photos/lib/events/people_changed_event.dart b/mobile/apps/photos/lib/events/people_changed_event.dartindex eb80581b72..89a54bf568 100644--- a/mobile/apps/photos/lib/events/people_changed_event.dart+++ b/mobile/apps/photos/lib/events/people_changed_event.dart@@ -8,6 +8,7 @@ class PeopleChangedEvent extends Event {final PeopleEventType type;final String source;final PersonEntity? person;+ final List<PersonEntity>? persons;final Set<String>? newClusterIDs;PeopleChangedEvent({@@ -16,6 +17,7 @@ class PeopleChangedEvent extends Event {this.type = PeopleEventType.defaultType,this.source = "",this.person,+ this.persons,this.newClusterIDs,});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.dartindex 754f8f1962..81748d5c7e 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@@ -113,6 +113,18 @@ class MemoryLaneCacheService {});}+ Future<void> removeMemoriesStripSchedule(String personId) async {+ await _ensureInitialized();+ await _lock.synchronized(() async {+ final currentCache = await _loadCacheUnsafe();+ if (!currentCache.memoriesStripSchedule.containsKey(personId)) {+ return;+ }+ _cache = currentCache.copyWithoutMemoriesStripScheduleEntries({personId});+ await _writeCacheUnsafe();+ });+ }+Future<void> upsertTimelineAndLog(MemoryLanePersonTimeline timeline,MemoryLaneComputeLogEntry log,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.dartindex 8e1c4a579f..fa35485dab 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@@ -420,12 +420,33 @@ class MemoryLaneService {}Future<void> _processPeopleChange(PeopleChangedEvent event) async {+ final persons = event.persons;+ if (persons != null) {+ final hiddenTimelineIds = <String>{+ for (final person in persons)+ if (person.data.hideFromMemories) ...{+ person.remoteID,+ ...person.data.assigned.map((cluster) => cluster.id),+ },+ };+ await _cacheService.updateMemoriesStripSchedule(hiddenTimelineIds, null);+ return;+ }final person = event.person;if (person == null) {_logger.warning("${event.type.name} event missing person");_scheduleStartupBackfill();return;}+ if (person.data.hideFromMemories) {+ for (final id in {+ person.remoteID,+ ...person.data.assigned.map((cluster) => cluster.id),+ ...?event.newClusterIDs,+ }) {+ await _cacheService.removeMemoriesStripSchedule(id);+ }+ }if (person.data.isIgnored) {await _invalidateTimeline(person.remoteID);for (final clusterdiff --git a/mobile/apps/photos/lib/ui/viewer/actions/people_selection_action_widget.dart b/mobile/apps/photos/lib/ui/viewer/actions/people_selection_action_widget.dartindex c48a6143b0..0d167c8605 100644--- a/mobile/apps/photos/lib/ui/viewer/actions/people_selection_action_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/actions/people_selection_action_widget.dart@@ -382,23 +382,26 @@ class _PeopleSelectionActionWidgetState}Future<void> _updateHideFromMemoriesState(bool shouldHide) async {+ final updatedPersons = <PersonEntity>[];try {final personMap = await personEntitiesMapFuture;final selectedPersonIds = _getSelectedPersonIds(personMap);- if (selectedPersonIds.isEmpty) return;for (final personID in selectedPersonIds) {final person = personMap[personID];if (person == null || person.data.name.isEmpty) continue;if (person.data.hideFromMemories == shouldHide) continue;- await PersonService.instance.updateAttributes(+ final updatedPerson = await PersonService.instance.updateAttributes(person.remoteID,hideFromMemories: shouldHide,);+ updatedPersons.add(updatedPerson);}- Bus.instance.fire(PeopleChangedEvent());} catch (e, s) {_logger.severe('Failed to update hide from memories state', e, s);} finally {+ if (updatedPersons.isNotEmpty) {+ Bus.instance.fire(PeopleChangedEvent(persons: updatedPersons));+ }widget.selectedPeople.clearAll();}}