From 38471a773c4af0fe46da61aa7c9d9af2c3682f5b Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Wed, 1 Apr 2026 17:53:11 +0300 Subject: [PATCH] family file switch back issue fixed --- .../authentication/authentication_repo.dart | 13 +++--------- .../authentication_view_model.dart | 20 +++++++++---------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/lib/features/authentication/authentication_repo.dart b/lib/features/authentication/authentication_repo.dart index 4fc8883f..1271f467 100644 --- a/lib/features/authentication/authentication_repo.dart +++ b/lib/features/authentication/authentication_repo.dart @@ -200,8 +200,6 @@ class AuthenticationRepoImp implements AuthenticationRepo { } } - - @override Future>> checkActivationCodeRepo( {required dynamic newRequest, // could be CheckActivationCodeReq or CheckActivationCodeRegisterReq @@ -276,11 +274,10 @@ class AuthenticationRepoImp implements AuthenticationRepo { newRequest.forRegisteration = newRequest.isRegister ?? false; newRequest.isRegister = false; //silent login case removed token and login token - if(newRequest.logInTokenID.isEmpty && newRequest.isSilentLogin == true && (newRequest.loginType==1 || newRequest.loginType==4)) { + if (newRequest.logInTokenID.isEmpty && newRequest.isSilentLogin == true && (newRequest.loginType == 1 || newRequest.loginType == 4)) { newRequest.logInTokenID = null; newRequest.deviceToken = null; } - } Map familyRequest = {}; @@ -315,13 +312,9 @@ class AuthenticationRepoImp implements AuthenticationRepo { } if (appState.getSuperUserID == responseID) { - // switchRequest['LoginType'] = 0; + switchRequest['LoginType'] = loginType; switchRequest['PatientIdentificationID'] = ""; - // switchRequest["PatientID"] = responseID; - // switchRequest["SuperUser"] = responseID; - // switchRequest["PatientID"] = appState.getAuthenticatedUser()?.patientId ?? 0; - - // switchRequest["PatientMobileNumber"] = newRequest.patientMobileNumber?.toString().startsWith('0') == true ? newRequest.patientMobileNumber.toString() : '0${newRequest.patientMobileNumber}'; + switchRequest['DeviceToken'] = newRequest.deviceToken; switchRequest.removeWhere((key, value) => ['NationalID', 'isDentalAllowedBackend', 'ProjectOutSA', 'ForRegisteration'].contains(key)); } } diff --git a/lib/features/authentication/authentication_view_model.dart b/lib/features/authentication/authentication_view_model.dart index 336b35ae..ba79b70d 100644 --- a/lib/features/authentication/authentication_view_model.dart +++ b/lib/features/authentication/authentication_view_model.dart @@ -552,16 +552,16 @@ class AuthenticationViewModel extends ChangeNotifier { }); } else { final resultEither = await _authenticationRepo.checkActivationCodeRepo( - newRequest: CheckActivationCodeRegisterReq.fromJson(request), - activationCode: activationCode, - isRegister: false, - isFormFamilyFile: isFormFamilyFile, - patientShareRequestID: patientShareRequestID, - responseID: responseID, - isSwitchUser: isSwitchUser, - patientID: patientID, - loginType: _appState.getSuperUserID != null ? 0 : 2, - ); + newRequest: CheckActivationCodeRegisterReq.fromJson(request), + activationCode: activationCode, + isRegister: false, + isFormFamilyFile: isFormFamilyFile, + patientShareRequestID: patientShareRequestID, + responseID: responseID, + isSwitchUser: isSwitchUser, + patientID: patientID, + // loginType: _appState.getSuperUserID != null ? 0 : 2, + loginType: loginTypeEnum.toInt); resultEither.fold( (failure) async => await _errorHandlerService.handleError(