|  |  |  | @ -376,6 +376,9 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |         isFormFamilyFile: isFormFamilyFile, | 
		
	
		
			
				|  |  |  |  |         responseID: responseID); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     // TODO: GET APP SMS SIGNATURE HERE | 
		
	
		
			
				|  |  |  |  |     request.sMSSignature = await getSignature(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -390,10 +393,9 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |       (failure) async => await _errorHandlerService.handleError(failure: failure), | 
		
	
		
			
				|  |  |  |  |       (apiResponse) async { | 
		
	
		
			
				|  |  |  |  |         int? patientShareRequestID = 0; | 
		
	
		
			
				|  |  |  |  |         String? familyFileTokenID; | 
		
	
		
			
				|  |  |  |  |         if (isFormFamilyFile) { | 
		
	
		
			
				|  |  |  |  |           patientShareRequestID = apiResponse.data['PatientShareRequestID']; | 
		
	
		
			
				|  |  |  |  |           familyFileTokenID = apiResponse.data['LogInTokenID']; | 
		
	
		
			
				|  |  |  |  |           _appState.setFamilyFileTokenID = apiResponse.data['LogInTokenID']; | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |         if (apiResponse.messageStatus == 2) { | 
		
	
		
			
				|  |  |  |  |           LoaderBottomSheet.hideLoader(); | 
		
	
	
		
			
				
					|  |  |  | @ -407,15 +409,15 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |             LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |             if (!isComingFromResendOTP) { | 
		
	
		
			
				|  |  |  |  |               navigateToOTPScreen( | 
		
	
		
			
				|  |  |  |  |                   otpTypeEnum: otpTypeEnum, | 
		
	
		
			
				|  |  |  |  |                   phoneNumber: phoneNumber, | 
		
	
		
			
				|  |  |  |  |                   isComingFromRegister: checkIsUserComingForRegister(request: payload), | 
		
	
		
			
				|  |  |  |  |                   payload: payload, | 
		
	
		
			
				|  |  |  |  |                   isFormFamilyFile: isFormFamilyFile, | 
		
	
		
			
				|  |  |  |  |                   isExcludedUser: isExcludedUser, | 
		
	
		
			
				|  |  |  |  |                   responseID: responseID, | 
		
	
		
			
				|  |  |  |  |                   patientShareRequestID: patientShareRequestID, | 
		
	
		
			
				|  |  |  |  |                   familyFileTokenID: familyFileTokenID); | 
		
	
		
			
				|  |  |  |  |                 otpTypeEnum: otpTypeEnum, | 
		
	
		
			
				|  |  |  |  |                 phoneNumber: phoneNumber, | 
		
	
		
			
				|  |  |  |  |                 isComingFromRegister: checkIsUserComingForRegister(request: payload), | 
		
	
		
			
				|  |  |  |  |                 payload: payload, | 
		
	
		
			
				|  |  |  |  |                 isFormFamilyFile: isFormFamilyFile, | 
		
	
		
			
				|  |  |  |  |                 isExcludedUser: isExcludedUser, | 
		
	
		
			
				|  |  |  |  |                 responseID: responseID, | 
		
	
		
			
				|  |  |  |  |                 patientShareRequestID: patientShareRequestID, | 
		
	
		
			
				|  |  |  |  |               ); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |           } else { | 
		
	
		
			
				|  |  |  |  |             // TODO: Handle isSMSSent false | 
		
	
	
		
			
				
					|  |  |  | @ -441,8 +443,7 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |       Function()? onResendActivation, | 
		
	
		
			
				|  |  |  |  |       bool isFormFamilyFile = false, | 
		
	
		
			
				|  |  |  |  |       dynamic patientShareRequestID, | 
		
	
		
			
				|  |  |  |  |       dynamic responseID, | 
		
	
		
			
				|  |  |  |  |       String? familyFileTokenID}) async { | 
		
	
		
			
				|  |  |  |  |       dynamic responseID}) async { | 
		
	
		
			
				|  |  |  |  |     bool isForRegister = (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true || _appState.getUserRegistrationPayload.patientOutSa == 1); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     final request = RequestUtils.getCommonRequestWelcome( | 
		
	
	
		
			
				
					|  |  |  | @ -478,11 +479,7 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |       request["ForRegisteration"] = _appState.getUserRegistrationPayload.isRegister; | 
		
	
		
			
				|  |  |  |  |       request["isRegister"] = false; | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       final resultEither = await _authenticationRepo.checkActivationCodeRepo( | 
		
	
		
			
				|  |  |  |  |         newRequest: request, | 
		
	
		
			
				|  |  |  |  |         activationCode: activationCode.toString(), | 
		
	
		
			
				|  |  |  |  |         isRegister: true, | 
		
	
		
			
				|  |  |  |  |       ); | 
		
	
		
			
				|  |  |  |  |       final resultEither = await _authenticationRepo.checkActivationCodeRepo(newRequest: request, activationCode: activationCode.toString(), isRegister: true); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -514,8 +511,7 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |           isRegister: false, | 
		
	
		
			
				|  |  |  |  |           isFormFamilyFile: isFormFamilyFile, | 
		
	
		
			
				|  |  |  |  |           patientShareRequestID: patientShareRequestID, | 
		
	
		
			
				|  |  |  |  |           responseID: responseID, | 
		
	
		
			
				|  |  |  |  |           familyFileTokenID: familyFileTokenID); | 
		
	
		
			
				|  |  |  |  |           responseID: responseID); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       resultEither.fold( | 
		
	
		
			
				|  |  |  |  |           (failure) async => await _errorHandlerService.handleError( | 
		
	
	
		
			
				
					|  |  |  | @ -549,59 +545,62 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |           return; | 
		
	
		
			
				|  |  |  |  |         } else { | 
		
	
		
			
				|  |  |  |  |           if (isFormFamilyFile) { | 
		
	
		
			
				|  |  |  |  |             _dialogService.showCommonBottomSheetWithoutH( | 
		
	
		
			
				|  |  |  |  |                 message: "Family File Added Successfully", | 
		
	
		
			
				|  |  |  |  |                 onOkPressed: () { | 
		
	
		
			
				|  |  |  |  |                   LoaderBottomSheet.showLoader(); | 
		
	
		
			
				|  |  |  |  |                   MedicalFileViewModel medicalFileVM = GetIt.instance<MedicalFileViewModel>(); | 
		
	
		
			
				|  |  |  |  |                   medicalFileVM.getFamilyFiles(); | 
		
	
		
			
				|  |  |  |  |                   LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |                   _navigationService.popUntilNamed(AppRoutes.medicalFilePage); | 
		
	
		
			
				|  |  |  |  |                 }); | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |           if (activation.list != null && activation.list!.isNotEmpty) { | 
		
	
		
			
				|  |  |  |  |             _appState.setAuthenticatedUser(activation.list!.first); | 
		
	
		
			
				|  |  |  |  |             _appState.setPrivilegeModelList(activation.list!.first.listPrivilege!); | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |           _appState.setUserBloodGroup = (activation.patientBlodType ?? ""); | 
		
	
		
			
				|  |  |  |  |           _appState.setAppAuthToken = activation.authenticationTokenId; | 
		
	
		
			
				|  |  |  |  |           final request = RequestUtils.getAuthanticatedCommonRequest().toJson(); | 
		
	
		
			
				|  |  |  |  |           bool isUserAgreedBefore = await checkIfUserAgreedBefore(request: request); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |           //updating the last login type in app state to show the fingerprint/face id option on home screen | 
		
	
		
			
				|  |  |  |  |           if (_appState.getSelectDeviceByImeiRespModelElement != null) { | 
		
	
		
			
				|  |  |  |  |             _appState.getSelectDeviceByImeiRespModelElement!.logInType = loginTypeEnum.toInt; | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |           LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |           insertPatientIMEIData(loginTypeEnum.toInt); | 
		
	
		
			
				|  |  |  |  |           await clearDefaultInputValues(); | 
		
	
		
			
				|  |  |  |  |           if (isUserAgreedBefore) { | 
		
	
		
			
				|  |  |  |  |             navigateToHomeScreen(); | 
		
	
		
			
				|  |  |  |  |             await navigateToFamilyFilePage(); | 
		
	
		
			
				|  |  |  |  |             // _dialogService.showCommonBottomSheetWithoutH( | 
		
	
		
			
				|  |  |  |  |             //     message: "Family File Added Successfully", | 
		
	
		
			
				|  |  |  |  |             //     onOkPressed: () async { | 
		
	
		
			
				|  |  |  |  |             //       print("navigating to family file page"); | 
		
	
		
			
				|  |  |  |  |             // | 
		
	
		
			
				|  |  |  |  |             //     }); | 
		
	
		
			
				|  |  |  |  |           } else { | 
		
	
		
			
				|  |  |  |  |             navigateToHomeScreen(); | 
		
	
		
			
				|  |  |  |  |             //Agreement page not designed yet so we are navigating to home screen directly | 
		
	
		
			
				|  |  |  |  |             // getUserAgreementContent(request: request); | 
		
	
		
			
				|  |  |  |  |             if (activation.list != null && activation.list!.isNotEmpty) { | 
		
	
		
			
				|  |  |  |  |               _appState.setAuthenticatedUser(activation.list!.first); | 
		
	
		
			
				|  |  |  |  |               _appState.setPrivilegeModelList(activation.list!.first.listPrivilege!); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             _appState.setUserBloodGroup = (activation.patientBlodType ?? ""); | 
		
	
		
			
				|  |  |  |  |             _appState.setAppAuthToken = activation.authenticationTokenId; | 
		
	
		
			
				|  |  |  |  |             final request = RequestUtils.getAuthanticatedCommonRequest().toJson(); | 
		
	
		
			
				|  |  |  |  |             bool isUserAgreedBefore = await checkIfUserAgreedBefore(request: request); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |             //updating the last login type in app state to show the fingerprint/face id option on home screen | 
		
	
		
			
				|  |  |  |  |             if (_appState.getSelectDeviceByImeiRespModelElement != null) { | 
		
	
		
			
				|  |  |  |  |               _appState.getSelectDeviceByImeiRespModelElement!.logInType = loginTypeEnum.toInt; | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             LoaderBottomSheet.hideLoader(); | 
		
	
		
			
				|  |  |  |  |             insertPatientIMEIData(loginTypeEnum.toInt); | 
		
	
		
			
				|  |  |  |  |             await clearDefaultInputValues(); | 
		
	
		
			
				|  |  |  |  |             if (isUserAgreedBefore) { | 
		
	
		
			
				|  |  |  |  |               navigateToHomeScreen(); | 
		
	
		
			
				|  |  |  |  |             } else { | 
		
	
		
			
				|  |  |  |  |               navigateToHomeScreen(); | 
		
	
		
			
				|  |  |  |  |               //Agreement page not designed yet so we are navigating to home screen directly | 
		
	
		
			
				|  |  |  |  |               // getUserAgreementContent(request: request); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |             // TODO: setPreferences and stuff | 
		
	
		
			
				|  |  |  |  |             // sharedPref.remove(FAMILY_FILE); | 
		
	
		
			
				|  |  |  |  |             // activation.list!.isFamily = false; | 
		
	
		
			
				|  |  |  |  |             // userData = activation.list; | 
		
	
		
			
				|  |  |  |  |             // sharedPref.setString(BLOOD_TYPE, activation.patientBloodType ?? ""); | 
		
	
		
			
				|  |  |  |  |             // authenticatedUserObject.user = activation.list!; | 
		
	
		
			
				|  |  |  |  |             // projectViewModel.setPrivilege(privilegeList: res); | 
		
	
		
			
				|  |  |  |  |             // await sharedPref.setObject(MAIN_USER, activation.list); | 
		
	
		
			
				|  |  |  |  |             // await sharedPref.setObject(USER_PROFILE, activation.list); | 
		
	
		
			
				|  |  |  |  |             // loginTokenID = activation.logInTokenID; | 
		
	
		
			
				|  |  |  |  |             // await sharedPref.setObject(LOGIN_TOKEN_ID, activation.logInTokenID); | 
		
	
		
			
				|  |  |  |  |             // await sharedPref.setString(TOKEN, activation.authenticationTokenID!); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |             // projectViewModel.analytics.loginRegistration.login_successful(); | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
		
			
				|  |  |  |  |           // TODO: setPreferences and stuff | 
		
	
		
			
				|  |  |  |  |           // sharedPref.remove(FAMILY_FILE); | 
		
	
		
			
				|  |  |  |  |           // activation.list!.isFamily = false; | 
		
	
		
			
				|  |  |  |  |           // userData = activation.list; | 
		
	
		
			
				|  |  |  |  |           // sharedPref.setString(BLOOD_TYPE, activation.patientBloodType ?? ""); | 
		
	
		
			
				|  |  |  |  |           // authenticatedUserObject.user = activation.list!; | 
		
	
		
			
				|  |  |  |  |           // projectViewModel.setPrivilege(privilegeList: res); | 
		
	
		
			
				|  |  |  |  |           // await sharedPref.setObject(MAIN_USER, activation.list); | 
		
	
		
			
				|  |  |  |  |           // await sharedPref.setObject(USER_PROFILE, activation.list); | 
		
	
		
			
				|  |  |  |  |           // loginTokenID = activation.logInTokenID; | 
		
	
		
			
				|  |  |  |  |           // await sharedPref.setObject(LOGIN_TOKEN_ID, activation.logInTokenID); | 
		
	
		
			
				|  |  |  |  |           // await sharedPref.setString(TOKEN, activation.authenticationTokenID!); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |           // projectViewModel.analytics.loginRegistration.login_successful(); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       }); | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<void> navigateToFamilyFilePage() async { | 
		
	
		
			
				|  |  |  |  |     MedicalFileViewModel medicalFileVM = GetIt.instance<MedicalFileViewModel>(); | 
		
	
		
			
				|  |  |  |  |     medicalFileVM.handleFamilyFileRequestOTPVerification(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<bool> checkIfUserAgreedBefore({required dynamic request}) async { | 
		
	
		
			
				|  |  |  |  |     bool isAgreed = false; | 
		
	
		
			
				|  |  |  |  |     if (havePrivilege(109)) { | 
		
	
	
		
			
				
					|  |  |  | @ -647,8 +646,7 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |       bool isFormFamilyFile = false, | 
		
	
		
			
				|  |  |  |  |       bool isExcludedUser = false, | 
		
	
		
			
				|  |  |  |  |       int? responseID, | 
		
	
		
			
				|  |  |  |  |       int? patientShareRequestID, | 
		
	
		
			
				|  |  |  |  |       String? familyFileTokenID}) async { | 
		
	
		
			
				|  |  |  |  |       int? patientShareRequestID}) async { | 
		
	
		
			
				|  |  |  |  |     _navigationService.pushToOtpScreen( | 
		
	
		
			
				|  |  |  |  |       phoneNumber: phoneNumber, | 
		
	
		
			
				|  |  |  |  |       isFormFamilyFile: isFormFamilyFile, | 
		
	
	
		
			
				
					|  |  |  | @ -659,7 +657,6 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |           otpTypeEnum: otpTypeEnum, | 
		
	
		
			
				|  |  |  |  |           responseID: responseID, | 
		
	
		
			
				|  |  |  |  |           patientShareRequestID: patientShareRequestID, | 
		
	
		
			
				|  |  |  |  |           familyFileTokenID: familyFileTokenID, | 
		
	
		
			
				|  |  |  |  |           onWrongActivationCode: (String? value) { | 
		
	
		
			
				|  |  |  |  |             onWrongActivationCode(message: value); | 
		
	
		
			
				|  |  |  |  |           }, | 
		
	
	
		
			
				
					|  |  |  | 
 |