|
|
|
|
@ -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.getAuthenticatedUser()!.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.getAuthenticatedUser()!.outSa == 1 ? true : false,
|
|
|
|
|
patientOutSa: authenticatedUser.outSa ?? 0,
|
|
|
|
|
outSa: authenticatedUser.outSa == 1 ? true : false,
|
|
|
|
|
biometricEnabled: loginType == 1 || loginType == 2 ? false : true,
|
|
|
|
|
firstNameN: _appState.getAuthenticatedUser()!.firstNameN,
|
|
|
|
|
lastNameN: _appState.getAuthenticatedUser()!.lastNameN,
|
|
|
|
|
zipCode: _appState.getAuthenticatedUser()!.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.getAuthenticatedUser()!.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.getAuthenticatedUser()!.mobileNumber,
|
|
|
|
|
nationalId: _appState.getAuthenticatedUser()!.patientIdentificationNo,
|
|
|
|
|
gender: _appState.getAuthenticatedUser()!.gender)
|
|
|
|
|
patientMobileNumber: authenticatedUser.mobileNumber,
|
|
|
|
|
nationalId: authenticatedUser.patientIdentificationNo,
|
|
|
|
|
gender: authenticatedUser.gender)
|
|
|
|
|
.toJson());
|
|
|
|
|
resultEither.fold((failure) async {
|
|
|
|
|
// await _errorHandlerService.handleError(failure: failure);
|
|
|
|
|
|