@ -1033,24 +1033,33 @@ class AuthenticationViewModel extends ChangeNotifier {
}
Future < void > insertPatientIMEIData ( int loginType ) async {
final authenticatedUser = _appState . getAuthenticatedUser ( ) ;
if ( authenticatedUser = = null ) {
log ( " insertPatientIMEIData: authenticatedUser is null, skipping. " ) ;
return ;
}
if ( authenticatedUser . patientId = = null ) {
log ( " insertPatientIMEIData: patientId is null, skipping. " ) ;
return ;
}
final resultEither = await _authenticationRepo . insertPatientIMEIData (
patientIMEIDataRequest: PatientInsertDeviceImei (
imei: _appState . deviceToken ,
deviceTypeId: _appState . getDeviceTypeID ( ) ,
patientId: _appState . getAuthenticatedUser ( ) ! . patientId ! ,
patientIdentificationNo: _appState . getAuthenticatedUser ( ) ! . patientIdentificationNo ! ,
identificationNo: _appState . getAuthenticatedUser ( ) ! . patientIdentificationNo ! ,
firstName: _appState . getAuthenticatedUser ( ) ! . firstName ! ,
lastName: _appState . getAuthenticatedUser ( ) ! . lastName ! ,
patientTypeId: _ appState. getA uthenticatedUser( ) ! . patientType ,
mobileNo: _appState. getAuthenticatedUser ( ) ! . mobileNumber ! ,
patientId: authenticatedUser. patientId ! ,
patientIdentificationNo: authenticatedUser. patientIdentificationNo ? ? ' ' ,
identificationNo: authenticatedUser. patientIdentificationNo ? ? ' ' ,
firstName: authenticatedUser. firstName ? ? ' ' ,
lastName: authenticatedUser. lastName ? ? ' ' ,
patientTypeId: authenticatedUser. patientType ,
mobileNo: authenticatedUser. mobileNumber ? ? ' ' ,
logInTypeId: loginType ,
patientOutSa: _appState. getAuthenticatedUser ( ) ! . outSa ! ,
outSa: _ appState. getA uthenticatedUser( ) ! . outSa = = 1 ? true : false ,
patientOutSa: authenticatedUser. outSa ? ? 0 ,
outSa: authenticatedUser. outSa = = 1 ? true : false ,
biometricEnabled: loginType = = 1 | | loginType = = 2 ? false : true ,
firstNameN: _ appState. getA uthenticatedUser( ) ! . firstNameN ,
lastNameN: _ appState. getA uthenticatedUser( ) ! . lastNameN ,
zipCode: _ appState. getA uthenticatedUser( ) ! . zipCode / / selectedCountrySignup = = CountryEnum . others ? ' 0 ' : selectedCountrySignup . countryCode ,
firstNameN: authenticatedUser. firstNameN ,
lastNameN: authenticatedUser. lastNameN ,
zipCode: authenticatedUser. zipCode / / selectedCountrySignup = = CountryEnum . others ? ' 0 ' : selectedCountrySignup . countryCode ,
)
. toJson ( ) ) ;
resultEither . fold ( ( failure ) async = > await _errorHandlerService . handleError ( failure: failure ) , ( apiResponse ) async {
@ -1064,22 +1073,27 @@ class AuthenticationViewModel extends ChangeNotifier {
}
Future < void > insertPatientDeviceData ( int loginType ) async {
final authenticatedUser = _appState . getAuthenticatedUser ( ) ;
if ( authenticatedUser = = null | | authenticatedUser . patientId = = null ) {
log ( " insertPatientDeviceData: authenticatedUser or patientId is null, skipping. " ) ;
return ;
}
final resultEither = await _authenticationRepo . insertPatientDeviceData (
patientDeviceDataRequest: InsertPatientMobileDeviceInfo (
deviceToken: _appState . deviceToken ,
deviceTypeId: _appState . getDeviceTypeID ( ) ,
patientId: _appState . getAuthenticatedUser ( ) ! . patientId ! ,
patientTypeId: _ appState. getA uthenticatedUser( ) ! . patientType ,
patientOutSa: _appState. getAuthenticatedUser ( ) ! . outSa ! ,
patientId: authenticatedUser. patientId ! ,
patientTypeId: authenticatedUser. patientType ,
patientOutSa: authenticatedUser. outSa ? ? 0 ,
loginType: loginType ,
languageId: _appState . getLanguageID ( ) ,
latitude: _appState . userLat ,
longitude: _appState . userLong ,
voipToken: " " ,
deviceType: _appState . deviceTypeID ,
patientMobileNumber: _ appState. getA uthenticatedUser( ) ! . mobileNumber ,
nationalId: _ appState. getA uthenticatedUser( ) ! . patientIdentificationNo ,
gender: _ appState. getA uthenticatedUser( ) ! . gender )
patientMobileNumber: authenticatedUser. mobileNumber ,
nationalId: authenticatedUser. patientIdentificationNo ,
gender: authenticatedUser. gender )
. toJson ( ) ) ;
resultEither . fold ( ( failure ) async {
/ / await _errorHandlerService . handleError ( failure: failure ) ;