From d1e0ec31e6bdac438d2f4c70e6cf12d7e7871c78 Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Thu, 9 Apr 2026 08:36:36 +0300 Subject: [PATCH 1/3] radiology ai lab analysis & lab ai analysis api end points updates. --- lib/core/app_state.dart | 14 ++++++++++++++ .../authentication/authentication_repo.dart | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/core/app_state.dart b/lib/core/app_state.dart index a5a8d72a..d02aa946 100644 --- a/lib/core/app_state.dart +++ b/lib/core/app_state.dart @@ -249,4 +249,18 @@ class AppState { _userSwitchPayloads.clear(); _childSwitchCounter = 0; } + + void clearChildUsersKeepSuperUser() { + // Keep the super user payload + final superUserPayload = _userSwitchPayloads['superUser']; + + // Clear all payloads + _userSwitchPayloads.clear(); + _childSwitchCounter = 0; + + // Restore super user if it existed + if (superUserPayload != null) { + _userSwitchPayloads['superUser'] = superUserPayload; + } + } } diff --git a/lib/features/authentication/authentication_repo.dart b/lib/features/authentication/authentication_repo.dart index 39d8e3ee..c355819e 100644 --- a/lib/features/authentication/authentication_repo.dart +++ b/lib/features/authentication/authentication_repo.dart @@ -314,7 +314,7 @@ class AuthenticationRepoImp implements AuthenticationRepo { requestBody['PatientIdentificationID'] = ""; requestBody.removeWhere((key, value) => ['NationalID', 'isDentalAllowedBackend', 'ForRegisteration'].contains(key)); appState.setIsChildLoggedIn = false; - appState.clearUserSwitchPayloads(); + appState.clearChildUsersKeepSuperUser(); } } else { appState.setIsChildLoggedIn = true; -- 2.30.2 From 74479850f53e6955bf7258f322b89e08263c28dc Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Thu, 9 Apr 2026 09:57:59 +0300 Subject: [PATCH 2/3] radiology ai lab analysis & lab ai analysis api end points updates. --- lib/presentation/my_family/widget/family_cards.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/presentation/my_family/widget/family_cards.dart b/lib/presentation/my_family/widget/family_cards.dart index 39344f30..3a647674 100644 --- a/lib/presentation/my_family/widget/family_cards.dart +++ b/lib/presentation/my_family/widget/family_cards.dart @@ -319,7 +319,6 @@ class _FamilyCardsState extends State { final profile = widget.profileViewList![index]; final isActive = (profile.responseId == appState.getAuthenticatedUser()?.patientId); final isParentUser = appState.getAuthenticatedUser()?.isParentUser ?? false; - print(jsonEncode(appState.getUserSwitchPayloads)); final isSuperUser = appState.getUserSwitchPayloads; // TODO: canSwitch functionality is currently disabled - set to true to allow all switches // Original logic: final canSwitch = isParentUser || (!isParentUser && profile.responseId == appState.getSuperUserID); -- 2.30.2 From 39cbee029aed1f85fce5cead4d0fe078f56e7f05 Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Thu, 9 Apr 2026 10:18:15 +0300 Subject: [PATCH 3/3] radiology ai lab analysis & lab ai analysis api end points updates. --- lib/features/authentication/authentication_view_model.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index 7e753722..733118ca 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -641,8 +641,8 @@ class AuthenticationViewModel extends ChangeNotifier { _appState.addUserSwitchPayload(activation.list!.first.toJson(), isSuperUser: true); } } else { - _appState.setSuperUserID = _appState.getAuthenticatedUser()?.patientId; - // _appState.setIsChildLoggedIn = false; + var allUsersPayload = _appState.getUserSwitchPayloads; + _appState.setSuperUserID = allUsersPayload['superUser']?['PatientID']; activation.list!.first.isParentUser = true; _appState.addUserSwitchPayload(activation.list!.first.toJson(), isSuperUser: true); } -- 2.30.2