Crashlytics fixes

haroon_dev
haroon amjad 2 days ago
parent 31b972e32f
commit 22ab9b7d2d

@ -824,7 +824,11 @@ class AuthenticationViewModel extends ChangeNotifier {
onSuccess: (dynamic respData) async {
try {
if (respData != null) {
dynamic data = await SelectDeviceByImeiRespModelElement.fromJson(respData.toJson());
SelectDeviceByImeiRespModelElement data = SelectDeviceByImeiRespModelElement.fromJson(respData.toJson());
if (data.mobile == null || data.mobile == "" || data.identificationNo == null || data.identificationNo == "") {
return;
}
_appState.setSelectDeviceByImeiRespModelElement(data);
LoaderBottomSheet.hideLoader();
@ -856,8 +860,6 @@ class AuthenticationViewModel extends ChangeNotifier {
}
Future<void> checkUserAuthentication({required OTPTypeEnum otpTypeEnum, Function(dynamic)? onSuccess, Function(String)? onError}) async {
// TODO: THIS SHOULD BE REMOVED LATER ON AND PASSED FROM APP STATE DIRECTLY INTO API CLIENT. BECAUSE THIS API ONLY NEEDS FEW PARAMS FROM USER
loginTypeEnum = otpTypeEnum == OTPTypeEnum.sms ? LoginTypeEnum.sms : LoginTypeEnum.whatsapp;
// if (phoneNumberController.text.isEmpty) {

@ -45,7 +45,6 @@ class MedicalFileViewModel extends ChangeNotifier {
List<SickLeaveList> patientSickLeavesViewList = [];
bool isSickLeavesSortByClinic = true;
bool isSickLeavesDataNeedsReloading = true;
List<GetAllergiesResponseModel> patientAllergiesList = [];
@ -61,6 +60,7 @@ class MedicalFileViewModel extends ChangeNotifier {
List<MedicalReportList> patientMedicalReportsViewList = [];
bool isMedicalReportsSortByClinic = true;
bool isMedicalReportsDataNeedsReloading = true;
List<PatientAppointmentHistoryResponseModel> patientMedicalReportAppointmentHistoryList = [];
PatientAppointmentHistoryResponseModel? patientMedicalReportSelectedAppointment;
@ -192,7 +192,7 @@ class MedicalFileViewModel extends ChangeNotifier {
}
setIsPatientMedicalReportsLoading(bool val) {
if (val) {
if (val && isMedicalReportsDataNeedsReloading) {
onMedicalReportTabChange(0);
patientMedicalReportList.clear();
patientMedicalReportsByClinic.clear();
@ -200,8 +200,8 @@ class MedicalFileViewModel extends ChangeNotifier {
patientMedicalReportsViewList.clear();
patientMedicalReportPDFBase64 = "";
isMedicalReportsSortByClinic = true;
isPatientMedicalReportsListLoading = val;
}
isPatientMedicalReportsListLoading = val;
notifyListeners();
}
@ -373,6 +373,10 @@ class MedicalFileViewModel extends ChangeNotifier {
}
Future<void> getPatientMedicalReportList({Function(dynamic)? onSuccess, Function(String)? onError}) async {
if (!isMedicalReportsDataNeedsReloading) {
return;
}
patientMedicalReportList.clear();
patientMedicalReportRequestedList.clear();
patientMedicalReportReadyList.clear();
@ -385,6 +389,7 @@ class MedicalFileViewModel extends ChangeNotifier {
(failure) async => await errorHandlerService.handleError(
failure: failure,
onOkPressed: () {
isMedicalReportsDataNeedsReloading = true;
onError!(failure.message);
},
),
@ -400,6 +405,7 @@ class MedicalFileViewModel extends ChangeNotifier {
}
onMedicalReportTabChange(0);
isPatientMedicalReportsListLoading = false;
isMedicalReportsDataNeedsReloading = false;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);

@ -3,6 +3,7 @@ import 'package:dartz/dartz.dart';
import 'package:hmg_patient_app_new/core/api/api_client.dart';
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/common_models/generic_api_model.dart';
import 'package:hmg_patient_app_new/core/common_models/tamara_request_model.dart';
import 'package:hmg_patient_app_new/core/exceptions/api_failure.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/get_tamara_installments_details_response_model.dart';
import 'package:hmg_patient_app_new/features/payfort/models/apple_pay_request_insert_model.dart';
@ -34,6 +35,8 @@ abstract class PayfortRepo {
Future<Either<Failure, GenericApiModel<dynamic>>> payfortRequestInsert({required PayfortRequestInsertModel payfortRequestInsertModel});
Future<Either<Failure, GenericApiModel<dynamic>>> payfortResponseInsert({required PayfortResponseInsertModel payfortResponseInsertModel});
Future<Either<Failure, GenericApiModel<dynamic>>> tamaraRequestInsert({required TamaraRequestModel tamaraRequestModel});
}
class PayfortRepoImp implements PayfortRepo {
@ -350,4 +353,31 @@ class PayfortRepoImp implements PayfortRepo {
return Left(UnknownFailure(e.toString()));
}
}
@override
Future<Either<Failure, GenericApiModel>> tamaraRequestInsert({required TamaraRequestModel tamaraRequestModel}) async {
try {
GenericApiModel<dynamic>? apiResponse;
Failure? failure;
await apiClient.post(TAMARA_REQUEST_INSERT, body: tamaraRequestModel.toJson(), onFailure: (error, statusCode, {messageStatus, failureType}) {
failure = failureType;
}, onSuccess: (response, statusCode, {messageStatus, errorMessage}) {
try {
apiResponse = GenericApiModel<dynamic>(
messageStatus: messageStatus,
statusCode: statusCode,
errorMessage: null,
data: response,
);
} catch (e) {
failure = DataParsingFailure(e.toString());
}
}, isAllowAny: true, isPaymentServices: true);
if (failure != null) return Left(failure!);
if (apiResponse == null) return Left(ServerFailure("Unknown error"));
return Right(apiResponse!);
} catch (e) {
return Left(UnknownFailure(e.toString()));
}
}
}

@ -9,6 +9,7 @@ import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.dart
import 'package:hmg_patient_app_new/core/api_consts.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/cache_consts.dart';
import 'package:hmg_patient_app_new/core/common_models/tamara_request_model.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/get_tamara_installments_details_response_model.dart';
@ -116,6 +117,25 @@ class PayfortViewModel extends ChangeNotifier {
);
}
Future<void> tamaraRequestInsert({required TamaraRequestModel tamaraRequestModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.tamaraRequestInsert(tamaraRequestModel: tamaraRequestModel);
result.fold(
(failure) async => await errorHandlerService.handleError(failure: failure),
(apiResponse) {
if (apiResponse.messageStatus == 2) {
// dialogService.showErrorDialog(message: apiResponse.errorMessage!, onOkPressed: () {});
} else if (apiResponse.messageStatus == 1) {
// payfortProjectDetailsRespModel = apiResponse.data!;
notifyListeners();
if (onSuccess != null) {
onSuccess(apiResponse);
}
}
},
);
}
Future<void> payfortResponseInsert({required PayfortResponseInsertModel payfortResponseInsertModel, Function(dynamic)? onSuccess, Function(String)? onError}) async {
final result = await payfortRepo.payfortResponseInsert(payfortResponseInsertModel: payfortResponseInsertModel);

@ -152,16 +152,13 @@ class AppointmentDoctorCard extends StatelessWidget {
),
AppCustomChipWidget(
labelPadding: EdgeInsetsDirectional.only(start: -6.w, end: 6.w),
icon: !patientAppointmentHistoryResponseModel.isLiveCareAppointment!
? AppAssets.walkin_appointment_icon
icon: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false) ? AppAssets.walkin_appointment_icon
: AppAssets.small_livecare_icon,
iconColor: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.textColor : Colors.white,
labelText: patientAppointmentHistoryResponseModel.isLiveCareAppointment!
? LocaleKeys.livecare.tr(context: context)
iconColor: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false) ? AppColors.textColor : Colors.white,
labelText: (patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false) ? LocaleKeys.livecare.tr(context: context)
: LocaleKeys.walkin.tr(context: context),
backgroundColor:
!patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.greyColor : AppColors.successColor,
textColor: !patientAppointmentHistoryResponseModel.isLiveCareAppointment! ? AppColors.textColor : Colors.white,
backgroundColor: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false) ? AppColors.greyColor : AppColors.successColor,
textColor: !(patientAppointmentHistoryResponseModel.isLiveCareAppointment ?? false) ? AppColors.textColor : Colors.white,
),
],
),

@ -389,7 +389,8 @@ class _BookAppointmentPageState extends State<BookAppointmentPage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Utils.buildImgWithNetwork(
url: myAppointmentsVM.patientFavouriteDoctorsList[index].doctorImageUrl!,
url: myAppointmentsVM.patientFavouriteDoctorsList[index].doctorImageUrl ?? "https://eservices-test-bucket.s3.me-central-1.amazonaws.com/unkown_male.png",
// url: myAppointmentsVM.patientFavouriteDoctorsList[index].doctorImageUrl!,
iconColor: AppColors.transparent,
width: 64.h,
height: 64.h,

@ -11,6 +11,7 @@ import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/features/authentication/models/resp_models/authenticated_user_resp_model.dart';
import 'package:hmg_patient_app_new/features/payfort/payfort_view_model.dart';
enum _PAYMENT_TYPE { PACKAGES, PHARMACY, PATIENT }
@ -217,6 +218,8 @@ class MyInAppBrowser extends InAppBrowser {
tamaraRequestModel.appointmentDate = (appoDate != null && appoDate != "") ? appoDate : null;
tamaraRequestModel.isSchedule = ((appoNo != null && appoNo != "") && (appoDate != null && appoDate != "")) ? true : false;
getIt.get<PayfortViewModel>().tamaraRequestInsert(tamaraRequestModel: tamaraRequestModel);
// service.tamaraInsertRequest(tamaraRequestModel, context).then((res) {
// // if (context != null) GifLoaderDialogUtils.hideDialog(context);
generateTamaraURL(amount, orderDesc, transactionID, projId, emailId, paymentMethod, patientType, patientName, patientID, authenticatedUser, isLiveCareAppo, servID, LiveServID, appoDate, appoNo,

@ -198,7 +198,8 @@ class TextInputWidget extends StatelessWidget {
],
),
),
(suffix != null) ? suffix! : SizedBox.shrink()
// (suffix != null) ? suffix : SizedBox.shrink()
suffix ?? SizedBox.shrink()
],
),
),

Loading…
Cancel
Save