π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Allow clearing saved birthdates
Neeraj Guptaa339ca3a283c
diff --git a/mobile/apps/photos/lib/models/ml/face/person.dart b/mobile/apps/photos/lib/models/ml/face/person.dartindex aacbdd8252..7c1ff836ac 100644--- a/mobile/apps/photos/lib/models/ml/face/person.dart+++ b/mobile/apps/photos/lib/models/ml/face/person.dart@@ -3,6 +3,8 @@// On the device, this information is stored as [LocalEntityData] with type person.import "package:flutter/foundation.dart";+const Object _personDataUnchanged = Object();+class PersonEntity {final String remoteID;final PersonData data;@@ -97,7 +99,7 @@ class PersonData {bool? isPinned,bool? hideFromMemories,int? version,- String? birthDate,+ Object? birthDate = _personDataUnchanged,String? email,int? userID,List<String>? rejectedFaceIDs,@@ -110,7 +112,9 @@ class PersonData {isHidden: isHidden ?? this.isHidden,isPinned: isPinned ?? this.isPinned,hideFromMemories: hideFromMemories ?? this.hideFromMemories,- birthDate: birthDate ?? this.birthDate,+ birthDate: identical(birthDate, _personDataUnchanged)+ ? this.birthDate+ : birthDate as String?,email: email ?? this.email,userID: userID ?? this.userID,rejectedFaceIDs:diff --git a/mobile/apps/photos/lib/services/machine_learning/face_ml/person/person_service.dart b/mobile/apps/photos/lib/services/machine_learning/face_ml/person/person_service.dartindex ed6f2f2381..00a3950eee 100644--- a/mobile/apps/photos/lib/services/machine_learning/face_ml/person/person_service.dart+++ b/mobile/apps/photos/lib/services/machine_learning/face_ml/person/person_service.dart@@ -27,6 +27,7 @@ typedef ManualPersonAssignmentResult = ({});class PersonService {+ static const Object _attributeNotProvided = Object();final EntityService entityService;final MLDataDB faceMLDataDB;final SharedPreferences prefs;@@ -586,22 +587,23 @@ class PersonService {bool? isPinned,bool? hideFromMemories,int? version,- String? birthDate,+ Object? birthDate = _attributeNotProvided,String? email,}) async {final person = (await getPerson(id))!;- final updatedPerson = person.copyWith(- data: person.data.copyWith(- name: name,- avatarFaceId: avatarFaceId,- isHidden: isHidden,- isPinned: isPinned,- hideFromMemories: hideFromMemories,- version: version,- birthDate: birthDate,- email: email,- ),+ var updatedData = person.data.copyWith(+ name: name,+ avatarFaceId: avatarFaceId,+ isHidden: isHidden,+ isPinned: isPinned,+ hideFromMemories: hideFromMemories,+ version: version,+ email: email,);+ if (!identical(birthDate, _attributeNotProvided)) {+ updatedData = updatedData.copyWith(birthDate: birthDate as String?);+ }+ final updatedPerson = person.copyWith(data: updatedData);await updatePerson(updatedPerson);await refreshPersonCache();if (hideFromMemories != null &&diff --git a/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart b/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dartindex 1524dd1bdc..a6ae1aa4b5 100644--- a/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart+++ b/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart@@ -280,8 +280,9 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {onChanged: (date) {setState(() {// format date to yyyy-MM-dd- _selectedDate =- date?.toIso8601String().split("T").first;+ _selectedDate = date == null+ ? null+ : date.toIso8601String().split("T").first;});},),