[mob] Fix nav bug during person label assignment

This commit is contained in:
Neeraj Gupta 2024-11-04 15:54:59 +05:30
parent 5c4aed51f2
commit a4de4fe4b7

View File

@ -290,6 +290,7 @@ class _PersonActionSheetState extends State<PersonActionSheet> {
String initValue = '',
required String clusterID,
}) async {
PersonEntity? personEntity;
final result = await showTextInputDialog(
context,
title: S.of(context).newPerson,
@ -308,15 +309,14 @@ class _PersonActionSheetState extends State<PersonActionSheet> {
}
try {
userAlreadyAssigned = true;
final PersonEntity p =
personEntity =
await PersonService.instance.addPerson(text, clusterID);
final bool extraPhotosFound = await ClusterFeedbackService.instance
.checkAndDoAutomaticMerges(p, personClusterID: clusterID);
.checkAndDoAutomaticMerges(personEntity!,
personClusterID: clusterID);
if (extraPhotosFound) {
showShortToast(context, S.of(context).extraPhotosFound);
}
Bus.instance.fire(PeopleChangedEvent());
Navigator.pop(context, p);
} catch (e, s) {
Logger("_PersonActionSheetState")
.severe("Failed to add person", e, s);
@ -327,6 +327,10 @@ class _PersonActionSheetState extends State<PersonActionSheet> {
if (result is Exception) {
await showGenericErrorDialog(context: context, error: result);
}
if (personEntity != null) {
Bus.instance.fire(PeopleChangedEvent());
Navigator.pop(context, personEntity);
}
}
Future<List<(PersonEntity, EnteFile)>> _getPersonsWithRecentFile({