From a4de4fe4b7cb4888933ff43fd02e10f95a13a345 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Mon, 4 Nov 2024 15:54:59 +0530 Subject: [PATCH] [mob] Fix nav bug during person label assignment --- .../ui/viewer/people/add_person_action_sheet.dart | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mobile/lib/ui/viewer/people/add_person_action_sheet.dart b/mobile/lib/ui/viewer/people/add_person_action_sheet.dart index ecfa6b56b5..b63034c440 100644 --- a/mobile/lib/ui/viewer/people/add_person_action_sheet.dart +++ b/mobile/lib/ui/viewer/people/add_person_action_sheet.dart @@ -290,6 +290,7 @@ class _PersonActionSheetState extends State { 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 { } 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 { if (result is Exception) { await showGenericErrorDialog(context: context, error: result); } + if (personEntity != null) { + Bus.instance.fire(PeopleChangedEvent()); + Navigator.pop(context, personEntity); + } } Future> _getPersonsWithRecentFile({