|  |  |  | @ -289,7 +289,7 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |               await checkActivationCode( | 
		
	
		
			
				|  |  |  |  |                 otpTypeEnum: otpTypeEnum, | 
		
	
		
			
				|  |  |  |  |                 onWrongActivationCode: (String? message) {}, | 
		
	
		
			
				|  |  |  |  |                 activationCode: 0000, | 
		
	
		
			
				|  |  |  |  |                 activationCode: null, //todo silent login case halded on the repo itself.. | 
		
	
		
			
				|  |  |  |  |               ); | 
		
	
		
			
				|  |  |  |  |             } | 
		
	
		
			
				|  |  |  |  |           } | 
		
	
	
		
			
				
					|  |  |  | @ -360,7 +360,7 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   Future<void> checkActivationCode({ | 
		
	
		
			
				|  |  |  |  |     required int activationCode, | 
		
	
		
			
				|  |  |  |  |     required String? activationCode, | 
		
	
		
			
				|  |  |  |  |     required OTPTypeEnum otpTypeEnum, | 
		
	
		
			
				|  |  |  |  |     required Function(String? message) onWrongActivationCode, | 
		
	
		
			
				|  |  |  |  |   }) async { | 
		
	
	
		
			
				
					|  |  |  | @ -373,9 +373,10 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |       registeredData: null, | 
		
	
		
			
				|  |  |  |  |       nationIdText: nationalIdController.text, | 
		
	
		
			
				|  |  |  |  |       countryCode: selectedCountrySignup.countryCode, | 
		
	
		
			
				|  |  |  |  |       loginType:  loginTypeEnum.toInt | 
		
	
		
			
				|  |  |  |  |     ).toJson(); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     bool isForRegister = _appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true; | 
		
	
		
			
				|  |  |  |  |     bool isForRegister =  (_appState.getUserRegistrationPayload.healthId != null || _appState.getUserRegistrationPayload.patientOutSa == true); | 
		
	
		
			
				|  |  |  |  |     if (isForRegister) { | 
		
	
		
			
				|  |  |  |  |       if (_appState.getUserRegistrationPayload.patientOutSa == true) request['DOB'] = _appState.getUserRegistrationPayload.dob; | 
		
	
		
			
				|  |  |  |  |       request['HealthId'] = _appState.getUserRegistrationPayload.healthId; | 
		
	
	
		
			
				
					|  |  |  | @ -396,7 +397,7 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |     } else { | 
		
	
		
			
				|  |  |  |  |       final resultEither = await _authenticationRepo.checkActivationCodeRepo( | 
		
	
		
			
				|  |  |  |  |         newRequest: CheckActivationCodeRegisterReq.fromJson(request), | 
		
	
		
			
				|  |  |  |  |         activationCode: activationCode.toString(), | 
		
	
		
			
				|  |  |  |  |         activationCode: activationCode, | 
		
	
		
			
				|  |  |  |  |         isRegister: false, | 
		
	
		
			
				|  |  |  |  |       ); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | @ -422,6 +423,7 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |           _appState.setAppAuthToken = activation.authenticationTokenId; | 
		
	
		
			
				|  |  |  |  |           final request = RequestUtils.getAuthanticatedCommonRequest().toJson(); | 
		
	
		
			
				|  |  |  |  |           bool isUserAgreedBefore = await checkIfUserAgreedBefore(request: request); | 
		
	
		
			
				|  |  |  |  |           insertPatientIMEIData(loginTypeEnum.toInt); | 
		
	
		
			
				|  |  |  |  |           clearDefaultInputValues(); | 
		
	
		
			
				|  |  |  |  |           if (isUserAgreedBefore) { | 
		
	
		
			
				|  |  |  |  |             navigateToHomeScreen(); | 
		
	
	
		
			
				
					|  |  |  | @ -491,7 +493,7 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |       phoneNumber: phoneNumber, | 
		
	
		
			
				|  |  |  |  |       checkActivationCode: (int activationCode) async { | 
		
	
		
			
				|  |  |  |  |         await checkActivationCode( | 
		
	
		
			
				|  |  |  |  |             activationCode: activationCode, | 
		
	
		
			
				|  |  |  |  |             activationCode: activationCode.toString(), | 
		
	
		
			
				|  |  |  |  |             otpTypeEnum: otpTypeEnum, | 
		
	
		
			
				|  |  |  |  |             onWrongActivationCode: (String? value) { | 
		
	
		
			
				|  |  |  |  |               onWrongActivationCode(message: value); | 
		
	
	
		
			
				
					|  |  |  | @ -508,12 +510,19 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   loginWithFingerPrintFace() async { | 
		
	
		
			
				|  |  |  |  |     _localAuthService.authenticate().then((value) { | 
		
	
		
			
				|  |  |  |  |     _localAuthService.authenticate().then((value) async { | 
		
	
		
			
				|  |  |  |  |       if (value) { | 
		
	
		
			
				|  |  |  |  |         // we have to handle this if verification true; | 
		
	
		
			
				|  |  |  |  |        // checkActivationCode(otpTypeEnum: OTPTypeEnum.faceIDFingerprint, activationCode: 0000, onWrongActivationCode: (String? message) {}); | 
		
	
		
			
				|  |  |  |  |         // authenticated = true; | 
		
	
		
			
				|  |  |  |  |         insertPatientIMEIData( OTPTypeEnum.faceIDFingerprint.toInt()); | 
		
	
		
			
				|  |  |  |  |         if(!_appState.isAuthenticated) { | 
		
	
		
			
				|  |  |  |  |           loginTypeEnum = (_appState.deviceTypeID == 1 ? LoginTypeEnum.face : LoginTypeEnum.fingerprint); | 
		
	
		
			
				|  |  |  |  |           print(loginTypeEnum); | 
		
	
		
			
				|  |  |  |  |            checkActivationCode(otpTypeEnum:OTPTypeEnum.faceIDFingerprint , activationCode: null, onWrongActivationCode: (String? message) {}); | 
		
	
		
			
				|  |  |  |  |           insertPatientIMEIData((_appState.deviceTypeID == 1 ? LoginTypeEnum.face.toInt : LoginTypeEnum.fingerprint.toInt)); | 
		
	
		
			
				|  |  |  |  |         }else { | 
		
	
		
			
				|  |  |  |  |           // authenticated = true; | 
		
	
		
			
				|  |  |  |  |           insertPatientIMEIData((_appState.deviceTypeID == 1 ? LoginTypeEnum.face.toInt : LoginTypeEnum.fingerprint.toInt)); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |         notifyListeners(); | 
		
	
		
			
				|  |  |  |  |         // navigateToHomeScreen(); | 
		
	
		
			
				|  |  |  |  |       } else { | 
		
	
	
		
			
				
					|  |  |  | @ -521,7 +530,6 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  |         notifyListeners(); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     }); | 
		
	
		
			
				|  |  |  |  |     notifyListeners(); | 
		
	
		
			
				|  |  |  |  |   } | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |   checkLastLoginStatus(Function() onSuccess) async { | 
		
	
	
		
			
				
					|  |  |  | @ -696,25 +704,25 @@ class AuthenticationViewModel extends ChangeNotifier { | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     Future<void>  insertPatientIMEIData(int loginType) async{ | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |       final resultEither = await _authenticationRepo.insertPatientIMEIData(patientIMEIDataRequest: PatientInsertDeviceImei(imei: _appState.deviceToken, deviceTypeId: _appState.getDeviceTypeID(), patientId: _appState.getAuthenticatedUser()!.patientId!, patientIdentificationNo:_appState.getAuthenticatedUser()!.nationalityId!, firstName:  _appState.getAuthenticatedUser()!.firstName!,  lastName:  _appState.getAuthenticatedUser()!.lastName!, patientTypeId: _appState.getAuthenticatedUser()!.patientType, mobileNo:_appState.getAuthenticatedUser()!.mobileNumber!, logInTypeId: loginType, patientOutSa:_appState.getAuthenticatedUser()!.outSa! ).toJson()); | 
		
	
		
			
				|  |  |  |  |       final resultEither = await _authenticationRepo.insertPatientIMEIData(patientIMEIDataRequest: PatientInsertDeviceImei(imei: _appState.deviceToken, deviceTypeId: _appState.getDeviceTypeID(), patientId: _appState.getAuthenticatedUser()!.patientId!, patientIdentificationNo:_appState.getAuthenticatedUser()!.nationalityId!, firstName:  _appState.getAuthenticatedUser()!.firstName!,  lastName:  _appState.getAuthenticatedUser()!.lastName!, patientTypeId: _appState.getAuthenticatedUser()!.patientType, mobileNo:_appState.getAuthenticatedUser()!.mobileNumber!, logInTypeId: loginType, patientOutSa:_appState.getAuthenticatedUser()!.outSa!, outSa: _appState.getAuthenticatedUser()!.outSa == 1 ? true :false, biometricEnabled: loginType == 1 || loginType ==2 ? false :true, firstNameN:_appState.getAuthenticatedUser()!.firstNameN , lastNameN:_appState.getAuthenticatedUser()!.lastNameN ).toJson()); | 
		
	
		
			
				|  |  |  |  |       resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async { | 
		
	
		
			
				|  |  |  |  |         if (apiResponse.messageStatus == 1) { | 
		
	
		
			
				|  |  |  |  |           print("Insert IMEI Success"); | 
		
	
		
			
				|  |  |  |  |           log("Insert IMEI Success"); | 
		
	
		
			
				|  |  |  |  |           insertPatientDeviceData( loginType); | 
		
	
		
			
				|  |  |  |  |         } else { | 
		
	
		
			
				|  |  |  |  |           print("Insert IMEI Failed"); | 
		
	
		
			
				|  |  |  |  |           log("Insert IMEI Failed"); | 
		
	
		
			
				|  |  |  |  |         } | 
		
	
		
			
				|  |  |  |  |       }); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     } | 
		
	
		
			
				|  |  |  |  |   Future<void>  insertPatientDeviceData(int loginType) async{ | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
		
			
				|  |  |  |  |     final resultEither = await _authenticationRepo.insertPatientDeviceData(patientDeviceDataRequest: InsertPatientMobileDeviceInfo(deviceToken: _appState.deviceToken, deviceTypeId: _appState.getDeviceTypeID(), patientId: _appState.getAuthenticatedUser()!.patientId!,  patientTypeId: _appState.getAuthenticatedUser()!.patientType,  patientOutSa:_appState.getAuthenticatedUser()!.outSa!, loginType:  loginType, languageId: _appState.getLanguageID(), latitude: _appState.userLat, longitude:_appState.userLong ).toJson()); | 
		
	
		
			
				|  |  |  |  |     final resultEither = await _authenticationRepo.insertPatientDeviceData(patientDeviceDataRequest: InsertPatientMobileDeviceInfo(deviceToken: _appState.deviceToken, deviceTypeId: _appState.getDeviceTypeID(), patientId: _appState.getAuthenticatedUser()!.patientId!,  patientTypeId: _appState.getAuthenticatedUser()!.patientType,  patientOutSa:_appState.getAuthenticatedUser()!.outSa!, loginType:  loginType, languageId: _appState.getLanguageID(), latitude: _appState.userLat, longitude:_appState.userLong, voipToken: "", deviceType: _appState.deviceTypeID, patientMobileNumber:_appState.getAuthenticatedUser()!.mobileNumber, nationalId:  _appState.getAuthenticatedUser()!.patientIdentificationNo, gender:  _appState.getAuthenticatedUser()!.gender ).toJson()); | 
		
	
		
			
				|  |  |  |  |     resultEither.fold((failure) async => await _errorHandlerService.handleError(failure: failure), (apiResponse) async { | 
		
	
		
			
				|  |  |  |  |       if (apiResponse.messageStatus == 1) { | 
		
	
		
			
				|  |  |  |  |         print("Insert Device Data Success"); | 
		
	
		
			
				|  |  |  |  |         log("Insert Device Data Success"); | 
		
	
		
			
				|  |  |  |  |       } else { | 
		
	
		
			
				|  |  |  |  |         print("Insert IMEI Failed"); | 
		
	
		
			
				|  |  |  |  |         log("Insert IMEI Failed"); | 
		
	
		
			
				|  |  |  |  |       } | 
		
	
		
			
				|  |  |  |  |     }); | 
		
	
		
			
				|  |  |  |  | 
 | 
		
	
	
		
			
				
					|  |  |  | 
 |