π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix: Enable delinking email from person with no face
Neeraj Gupta3deb138b77c5
diff --git a/mobile/lib/ui/viewer/people/save_or_edit_person.dart b/mobile/lib/ui/viewer/people/save_or_edit_person.dartindex 2d4ddd10cd..ae8c98de19 100644--- a/mobile/lib/ui/viewer/people/save_or_edit_person.dart+++ b/mobile/lib/ui/viewer/people/save_or_edit_person.dart@@ -628,10 +628,7 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {_logger.severe("Failed to addNewPerson, email is already assigned to a person",);- await showGenericErrorDialog(- context: context,- error: "Email already assigned",- );+ await showAlreadyLinkedEmailDialog(context, email);return null;}diff --git a/mobile/lib/utils/person_contact_linking_util.dart b/mobile/lib/utils/person_contact_linking_util.dartindex cf8877269e..c09671bc31 100644--- a/mobile/lib/utils/person_contact_linking_util.dart+++ b/mobile/lib/utils/person_contact_linking_util.dart@@ -1,4 +1,11 @@+import "package:collection/collection.dart";+import "package:flutter/widgets.dart";+import "package:photos/generated/l10n.dart";+import "package:photos/models/ml/face/person.dart";import "package:photos/services/machine_learning/face_ml/person/person_service.dart";+import "package:photos/ui/viewer/people/save_or_edit_person.dart";+import "package:photos/utils/dialog_util.dart";+import "package:photos/utils/navigation_util.dart";Future<bool> checkIfEmailAlreadyAssignedToAPerson(String email,@@ -11,3 +18,34 @@ Future<bool> checkIfEmailAlreadyAssignedToAPerson(}return false;}++Future<void> showAlreadyLinkedEmailDialog(+ BuildContext context,+ String email,+) async {+ final persons = await PersonService.instance.getPersons();+ final PersonEntity? person = persons.firstWhereOrNull(+ (person) => person.data.email == email,+ );+ if (person == null) {+ return;+ }++ await showChoiceActionSheet(+ context,+ title: 'Email already assigned',+ body: 'This email is already assigned to ${person?.data.name}.',+ firstButtonLabel: S.of(context).editPerson,+ firstButtonOnTap: () async {+ await routeToPage(+ context,+ SaveOrEditPerson(+ person.data.assigned.firstOrNull?.id,+ person: person,+ isEditing: true,+ ),+ );+ },+ isCritical: false,+ );+}