From 0d7bbc462b46f077300f21be6726c935b14630e3 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 27 Apr 2025 16:21:54 +0300 Subject: [PATCH 1/7] updates --- lib/config/config.dart | 4 ++-- lib/core/service/authentication_service.dart | 4 ++-- lib/core/service/patient/ReferralService.dart | 6 +++++- .../viewmodel/pharmacy_intervention_service.dart | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 72585642..efeed011 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -9,9 +9,9 @@ const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; const DOCTOR_ROTATION = 'https://doctorrota.hmg.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // const BASE_URL = 'http://10.20.200.111:1010/'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/'; diff --git a/lib/core/service/authentication_service.dart b/lib/core/service/authentication_service.dart index 2c0ab0d9..dcde0fff 100644 --- a/lib/core/service/authentication_service.dart +++ b/lib/core/service/authentication_service.dart @@ -40,13 +40,13 @@ class AuthenticationService extends BaseService { try { await baseAppClient.post(SELECT_DEVICE_IMEI, onSuccess: (dynamic response, int statusCode) { _imeiDetails = []; - response['List_DoctorDeviceDetails'].forEach((v) { + response['List_DoctorDeviceDetails']?.forEach((v) { _imeiDetails.add(GetIMEIDetailsModel.fromJson(v)); }); }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; - }, body: {"IMEI": imei, "TokenID": "@dm!n"}); + }, body: {"IMEI": imei, }); } catch (error) { hasError = true; super.error = error.toString(); diff --git a/lib/core/service/patient/ReferralService.dart b/lib/core/service/patient/ReferralService.dart index 25469dc2..dd066d03 100644 --- a/lib/core/service/patient/ReferralService.dart +++ b/lib/core/service/patient/ReferralService.dart @@ -1,4 +1,6 @@ import 'package:doctor_app_flutter/config/config.dart'; +import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; +import 'package:doctor_app_flutter/core/model/doctor/doctor_profile_model.dart'; import 'package:doctor_app_flutter/core/model/referral/ReferralRequest.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart'; @@ -14,8 +16,10 @@ class ReferralService extends BaseService { int? frequency, String? referringDoctorRemarks, String? extension}) async { - await getDoctorProfile(); + // await getDoctorProfile(); ReferralRequest referralRequest = ReferralRequest(); + Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile!); referralRequest.admissionNo = admissionNo; referralRequest.roomID = roomID; referralRequest.referralClinic = referralClinic.toString(); diff --git a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart index 05c8542f..79a5bb3a 100644 --- a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart +++ b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart @@ -74,7 +74,7 @@ class PharmacyInterventionService extends BaseService { var success = false; await baseAppClient.post(IS_INFECTIOUS_DISEASE_CONSULTANT, onSuccess: (dynamic response, int statusCode) { - success = response['IsInfectiousDiseases']; + success = response['IsInfectiousDiseases']; }, onFailure: (String error, int statusCode) { hasError = true; DrAppToastMsg.showErrorToast(error); From 34c08e670755621aac09b7ae4619e5cac71e3466 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 28 Apr 2025 11:40:51 +0300 Subject: [PATCH 2/7] Update to stores VersionID 9.6 --- ios/Runner.xcodeproj/project.pbxproj | 46 ++++-- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- lib/config/config.dart | 6 +- lib/screens/home/home_screen.dart | 132 +++++++----------- 4 files changed, 88 insertions(+), 98 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index a012e30c..c48ab903 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -212,7 +212,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; - LastUpgradeCheck = 1500; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = "The Chromium Authors"; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -355,19 +355,23 @@ "${BUILT_PRODUCTS_DIR}/Try/Try.framework", "${BUILT_PRODUCTS_DIR}/barcode_scan2/barcode_scan2.framework", "${BUILT_PRODUCTS_DIR}/connectivity/connectivity.framework", - "${BUILT_PRODUCTS_DIR}/device_info/device_info.framework", "${BUILT_PRODUCTS_DIR}/file_picker/file_picker.framework", - "${BUILT_PRODUCTS_DIR}/flutter_inappwebview/flutter_inappwebview.framework", + "${BUILT_PRODUCTS_DIR}/flutter_inappwebview_ios/flutter_inappwebview_ios.framework", "${BUILT_PRODUCTS_DIR}/flutter_keyboard_visibility/flutter_keyboard_visibility.framework", "${BUILT_PRODUCTS_DIR}/fluttertoast/fluttertoast.framework", "${BUILT_PRODUCTS_DIR}/local_auth_ios/local_auth_ios.framework", "${BUILT_PRODUCTS_DIR}/maps_launcher/maps_launcher.framework", "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", "${BUILT_PRODUCTS_DIR}/path_provider_foundation/path_provider_foundation.framework", + "${BUILT_PRODUCTS_DIR}/pointer_interceptor_ios/pointer_interceptor_ios.framework", "${BUILT_PRODUCTS_DIR}/shared_preferences_foundation/shared_preferences_foundation.framework", "${BUILT_PRODUCTS_DIR}/speech_to_text/speech_to_text.framework", "${BUILT_PRODUCTS_DIR}/sqflite/sqflite.framework", "${BUILT_PRODUCTS_DIR}/url_launcher_ios/url_launcher_ios.framework", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/ZoomVideoSDK/CptShare/CptShare.framework/CptShare", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/ZoomVideoSDK/ZoomVideoSDK/ZoomVideoSDK.framework/ZoomVideoSDK", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/ZoomVideoSDK/zm_annoter_dynamic/zm_annoter_dynamic.framework/zm_annoter_dynamic", + "${PODS_XCFRAMEWORKS_BUILD_DIR}/ZoomVideoSDK/zoomcml/zoomcml.framework/zoomcml", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( @@ -392,19 +396,23 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Try.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/barcode_scan2.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/file_picker.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_inappwebview.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_inappwebview_ios.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_keyboard_visibility.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/fluttertoast.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/local_auth_ios.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/maps_launcher.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider_foundation.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/pointer_interceptor_ios.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences_foundation.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/speech_to_text.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/sqflite.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher_ios.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CptShare.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ZoomVideoSDK.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/zm_annoter_dynamic.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/zoomcml.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -453,6 +461,7 @@ /* Begin XCBuildConfiguration section */ 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -505,13 +514,15 @@ }; 249021D4217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E333B59AA5538E0304102FD2 /* Pods-Runner.profile.xcconfig */; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; + ENABLE_USER_SCRIPT_SANDBOXING = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", @@ -526,7 +537,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.3.99; + MARKETING_VERSION = 1.4.19; PRODUCT_BUNDLE_IDENTIFIER = com.hmg.hmgDr; PRODUCT_NAME = Runner; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -537,7 +548,7 @@ }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB31CF90195004384FC /* Generated.xcconfig */; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -595,6 +606,7 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -649,13 +661,15 @@ }; 97C147061CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C55D4AE245B71956447BA22F /* Pods-Runner.debug.xcconfig */; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; + ENABLE_USER_SCRIPT_SANDBOXING = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", @@ -670,7 +684,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.3.99; + MARKETING_VERSION = 1.4.19; PRODUCT_BUNDLE_IDENTIFIER = com.hmg.hmgDr; PRODUCT_NAME = Runner; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -682,14 +696,16 @@ }; 97C147071CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = C8801C5E6B82B6CB497CA5C7 /* Pods-Runner.release.xcconfig */; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES; CLANG_ENABLE_MODULES = YES; CODE_SIGN_ENTITLEMENTS = Runner/RunnerRelease.entitlements; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 3A359E86ZF; ENABLE_BITCODE = NO; + ENABLE_USER_SCRIPT_SANDBOXING = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(PROJECT_DIR)/Flutter", @@ -704,7 +720,7 @@ "$(inherited)", "$(PROJECT_DIR)/Flutter", ); - MARKETING_VERSION = 1.3.99; + MARKETING_VERSION = 1.4.19; PRODUCT_BUNDLE_IDENTIFIER = com.hmg.hmgDr; PRODUCT_NAME = Runner; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 0b02bfc6..498aa0d1 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ { return BaseView( onModelReady: (model) async { - model - .startHomeScreenServices(projectsProvider, authenticationViewModel) - .then((value) { + model.startHomeScreenServices(projectsProvider, authenticationViewModel).then((value) { WidgetsBinding.instance.addPostFrameCallback((_) async { if (model.radiologyCriticalFindingModel != null) { print("onModelReady radiologyCriticalFindingModel!!!"); @@ -113,12 +111,9 @@ class _HomeScreenState extends State { //TODO Elham* make it componet Container( width: 40, - margin: EdgeInsets.only( - left: projectsProvider.isArabic ? 0 : 32, - right: projectsProvider.isArabic ? 23 : 0), + margin: EdgeInsets.only(left: projectsProvider.isArabic ? 0 : 32, right: projectsProvider.isArabic ? 23 : 0), child: IconButton( - icon: SvgPicture.asset('assets/images/svgs/menu.svg', - height: 25, width: 10), + icon: SvgPicture.asset('assets/images/svgs/menu.svg', height: 25, width: 10), iconSize: 15, color: Colors.black, onPressed: () => Scaffold.of(context).openDrawer(), @@ -126,8 +121,6 @@ class _HomeScreenState extends State { ), Column(children: [ - - // // InkWell(onTap: (){ // AppPermissionsUtils.requestVideoCallPermission( @@ -322,14 +315,10 @@ class _HomeScreenState extends State { ); } - showRadiologyFindingDialog(DashboardViewModel model) async{ - await Utils.showConfirmationDialog( - context, model.radiologyCriticalFindingModel?.notificationMesssage ??'test radiology', - () async { + showRadiologyFindingDialog(DashboardViewModel model) async { + await Utils.showConfirmationDialog(context, model.radiologyCriticalFindingModel?.notificationMesssage ?? 'test radiology', () async { GifLoaderDialogUtils.showMyDialog(context); - await model.acknowledgeRadiologyCriticalFinding( - model.radiologyCriticalFindingModel?.invoiceNo?.toString() ?? '', - model.radiologyCriticalFindingModel?.invoiceLineItemNo?.toString() ?? ''); + await model.acknowledgeRadiologyCriticalFinding(model.radiologyCriticalFindingModel?.invoiceNo?.toString() ?? '', model.radiologyCriticalFindingModel?.invoiceLineItemNo?.toString() ?? ''); GifLoaderDialogUtils.hideDialog(context); Navigator.of(context).pop(); }, isShowCancelButton: false); @@ -351,27 +340,19 @@ class _HomeScreenState extends State { _showErrorBottomSheet(context, TranslationBase.of(context).youHavePendingInterventions); } - List homePatientsCardsWidget( - DashboardViewModel model, projectsProvider) { + List homePatientsCardsWidget(DashboardViewModel model, projectsProvider) { colorIndex = 0; List backgroundColors = []; - backgroundColors.add(LinearGradient( - begin: Alignment(-1.0, -2.0), - end: Alignment(1.0, 2.0), - colors: [ - AppGlobal.appRedColor, - Color(0xFFAD3B3B), - ])); //AppGlobal.appRedColor; - backgroundColors.add( - LinearGradient(begin: Alignment.center, end: Alignment.center, colors: [ + backgroundColors.add(LinearGradient(begin: Alignment(-1.0, -2.0), end: Alignment(1.0, 2.0), colors: [ + AppGlobal.appRedColor, + Color(0xFFAD3B3B), + ])); //AppGlobal.appRedColor; + backgroundColors.add(LinearGradient(begin: Alignment.center, end: Alignment.center, colors: [ Color(0xFFC9C9C9), Color(0xFFC9C9C9), ])); - backgroundColors.add(LinearGradient( - begin: Alignment.center, - end: Alignment.center, - colors: [Color(0xFF71787E), AppGlobal.appTextColor])); + backgroundColors.add(LinearGradient(begin: Alignment.center, end: Alignment.center, colors: [Color(0xFF71787E), AppGlobal.appTextColor])); List backgroundIconColors = []; backgroundIconColors.add(Colors.white12); backgroundIconColors.add(Colors.white38); @@ -390,8 +371,7 @@ class _HomeScreenState extends State { cardIcon: DoctorApp.livecare, textColor: textColors[colorIndex], iconSize: 21, - text: - "${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}", + text: "${TranslationBase.of(context).liveCare}\n${TranslationBase.of(context).patients}", onTap: () { // TODO MOSA TEST // PatiantInformtion patient = PatiantInformtion( @@ -438,22 +418,19 @@ class _HomeScreenState extends State { )); changeColorIndex(); - if (model.doctorProfile !=null && !Utils.isVidaPlusInPatientProject(projectsProvider, model.doctorProfile!.projectID!)) { + if (model.doctorProfile != null && !Utils.isVidaPlusInPatientProject(projectsProvider, model.doctorProfile!.projectID!)) { patientCards.add(HomePatientCard( gradient: backgroundColors[colorIndex], backgroundIconColor: backgroundIconColors[colorIndex], cardIcon: DoctorApp.inpatient, textColor: textColors[colorIndex], - text: TranslationBase - .of(context) - .myInPatient, + text: TranslationBase.of(context).myInPatient, onTap: () { Navigator.push( context, FadePage( page: InPatientScreen( - specialClinic: model.getSpecialClinic( - clinicId ?? projectsProvider.doctorClinicsList[0].clinicID), + specialClinic: model.getSpecialClinic(clinicId ?? projectsProvider.doctorClinicsList[0].clinicID), ), ), ); @@ -469,12 +446,10 @@ class _HomeScreenState extends State { cardIcon: DoctorApp.search_medicines, textColor: textColors[2], text: TranslationBase.of(context).interventionPharmacyApproval, - fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: width) * - (SizeConfig.isHeightVeryShort ? 10 : 9), + fontSize: SizeConfig.getTextMultiplierBasedOnWidth(width: width) * (SizeConfig.isHeightVeryShort ? 10 : 9), onTap: () { if (!model.isInfectiousDiseaseConsultant) { - DrAppToastMsg.showErrorToast( - TranslationBase.of(context).unableToPerformTheAction); + DrAppToastMsg.showErrorToast(TranslationBase.of(context).unableToPerformTheAction); } Navigator.push( context, @@ -511,19 +486,13 @@ class _HomeScreenState extends State { textColor: textColors[colorIndex], text: TranslationBase.of(context).myOutPatient_2lines, onTap: () { - String date = AppDateUtils.convertDateToFormat( - DateTime( - DateTime.now().year, DateTime.now().month, DateTime.now().day), - 'yyyy-MM-dd'); + String date = AppDateUtils.convertDateToFormat(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day), 'yyyy-MM-dd'); Navigator.push( context, MaterialPageRoute( builder: (context) => OutPatientsScreen( - patientSearchRequestModel: PatientSearchRequestModel( - from: date, - to: date, - doctorID: authenticationViewModel.doctorProfile!.doctorID), + patientSearchRequestModel: PatientSearchRequestModel(from: date, to: date, doctorID: authenticationViewModel.doctorProfile!.doctorID), ), settings: RouteSettings(name: 'OutPatientsScreen'), )); @@ -583,10 +552,7 @@ class _HomeScreenState extends State { )); changeColorIndex(); - return [ - ...List.generate(patientCards.length, (index) => patientCards[index]) - .toList() - ]; + return [...List.generate(patientCards.length, (index) => patientCards[index]).toList()]; } changeColorIndex() { @@ -595,15 +561,17 @@ class _HomeScreenState extends State { colorIndex = 0; } } + void _showErrorBottomSheet(BuildContext context, String errorMessage) { showModalBottomSheet( - isDismissible:true, - enableDrag:false, + isDismissible: true, + enableDrag: false, context: context, shape: RoundedRectangleBorder( borderRadius: BorderRadius.vertical(top: Radius.circular(20)), ), - backgroundColor: Colors.red[50], // Light red background + backgroundColor: Colors.red[50], + // Light red background builder: (context) { return Padding( padding: const EdgeInsets.all(16.0), @@ -615,13 +583,17 @@ class _HomeScreenState extends State { children: [ Icon(Icons.error_outline, color: Colors.red, size: 40), InkWell( - onTap: () { - Navigator.pop(context); - }, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Icon(Icons.close,color: Colors.red,), - )) + onTap: () { + Navigator.pop(context); + }, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Icon( + Icons.close, + color: Colors.red, + ), + ), + ) ], ), const SizedBox(height: 10), @@ -637,26 +609,28 @@ class _HomeScreenState extends State { ), const SizedBox(height: 15), SizedBox( - width: SizeConfig.realScreenWidth! * .4, - child:AppButton( + width: SizeConfig.realScreenWidth! * .4, + child: AppButton( color: Colors.green, - onPressed: () => { // Navigator.pop(context); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => PharmacyIntervention(), - settings: RouteSettings(name: 'PharmacyIntervention'), - ))}, - title: TranslationBase.of(context).open, - - )), + onPressed: () => { + // Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PharmacyIntervention(), + settings: RouteSettings(name: 'PharmacyIntervention'), + )) + }, + title: TranslationBase.of(context).open, + )), ], ), ); }, ); } - void startZoom(){ + + void startZoom() { var zoom = ZoomVideoSdk(); InitConfig initConfig = InitConfig( domain: "zoom.us", From 6f3e4d189fa4243389f2229f99dfa90968528e74 Mon Sep 17 00:00:00 2001 From: Syed Taha Alam Date: Thu, 8 May 2025 14:51:59 +0300 Subject: [PATCH 3/7] Null check operator removed from pharmacy_intervention_service.dart. --- .../viewmodel/pharmacy_intervention_service.dart | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart index 79a5bb3a..8410d806 100644 --- a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart +++ b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_service.dart @@ -78,7 +78,6 @@ class PharmacyInterventionService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; DrAppToastMsg.showErrorToast(error); - super.error = super.error ?? "" + "\n" + error; }, body: {}); return success; @@ -97,8 +96,6 @@ class PharmacyInterventionService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; DrAppToastMsg.showErrorToast(error); - - super.error = super.error! + "\n" + error; }, body: {}); return success; } @@ -125,9 +122,6 @@ class PharmacyInterventionService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; DrAppToastMsg.showErrorToast(error); - - super.error = super.error! + "\n" + error; - }, body: request); return result; } @@ -139,11 +133,10 @@ class PharmacyInterventionService extends BaseService { var result = false; await baseAppClient.post(UPDATE_INFECTIOUS_STATUS, onSuccess: (dynamic response, int statusCode) { - result = response['IsAccepted']; + result = response['IsAccepted'] ?? false; }, onFailure: (String error, int statusCode) { hasError = true; DrAppToastMsg.showErrorToast(error); - super.error = super.error! + "\n" + error; }, body: request); return result; } @@ -158,8 +151,6 @@ class PharmacyInterventionService extends BaseService { }, onFailure: (String error, int statusCode) { hasError = true; DrAppToastMsg.showErrorToast(error); - - super.error = super.error! + "\n" + error; }, body: {}); return station; } From 2d5d77485285c05babbaa4da94eafe009b1c96d3 Mon Sep 17 00:00:00 2001 From: Syed Taha Alam Date: Sun, 11 May 2025 14:35:28 +0300 Subject: [PATCH 4/7] handling AuthorizeID to not to be null if the sharedprefence data is getting null. --- .../viewmodel/pharmacy_intervention_view_model.dart | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart index f360447a..a0449fea 100644 --- a/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart +++ b/lib/screens/pharmacy_intervention/viewmodel/pharmacy_intervention_view_model.dart @@ -95,6 +95,10 @@ class PharmacyInterventionViewModel extends BaseViewModel { NursingStation? nursingStations; + PharmacyInterventionViewModel(){ + getDoctorProfile(); + } + // InterventionHistoryList? interventionHistoryList = InterventionHistoryList.fromJson({ // "entityList": [ // { @@ -568,8 +572,10 @@ class PharmacyInterventionViewModel extends BaseViewModel { String successMessage = '' }) async { Map? user = await sharedPref.getObj(LOGGED_IN_USER); - var userId = user?['List_MemberInformation'][0]['MemberID']; - + var userId = user?['List_MemberInformation'][0]['MemberID'] ?? doctorProfile?.doctorID; + if(userId == null) { + return; + } var requestJson = { "PatientID":currentlySelectedMedication?.patientID ?? '', 'AdmissionNo': currentlySelectedMedication?.admissionNo.toString() ?? '', From ce7f633a85f46b41a6d144a4a15448d5d9163bf4 Mon Sep 17 00:00:00 2001 From: Syed Taha Alam Date: Mon, 12 May 2025 11:13:59 +0300 Subject: [PATCH 5/7] commented to not to clear the sharedpref --- lib/core/viewModel/authentication_view_model.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index cdb2bbf7..4dedbbea 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -407,7 +407,8 @@ class AuthenticationViewModel extends BaseViewModel { logout({bool isFromLogin = false}) async { localToken = ""; String? lang = await sharedPref.getString(APP_Language); - await Utils.clearSharedPref(); + //COMMENTED THE NOT TO CLEAR THE SHARED PREF + // await Utils.clearSharedPref(); doctorProfile = null; sharedPref.setString(APP_Language, lang ?? 'en'); deleteUser(); From f36518188882e660bdee687347cef4e93429994f Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 12 May 2025 16:38:43 +0300 Subject: [PATCH 6/7] Pharmacy intervention null error fix, Update to stores VersionID 9.7 --- lib/client/base_app_client.dart | 516 +++++++++++++------------------- lib/config/config.dart | 2 +- pubspec.yaml | 2 +- 3 files changed, 211 insertions(+), 309 deletions(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 4147cfed..9289173c 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -25,11 +25,11 @@ class BaseAppClient { //TODO change the post fun to nun static when you change all service post(String endPoint, {Map? body, - required Function(dynamic response, int statusCode) onSuccess, - required Function(String error, int statusCode) onFailure, - bool isAllowAny = false, - bool isLiveCare = false, - bool isFallLanguage = false}) async { + required Function(dynamic response, int statusCode) onSuccess, + required Function(String error, int statusCode) onFailure, + bool isAllowAny = false, + bool isLiveCare = false, + bool isFallLanguage = false}) async { String url; if (isLiveCare) url = BASE_URL_LIVE_CARE + endPoint; @@ -46,9 +46,7 @@ class BaseAppClient { if (body == null || body['DoctorID'] == null) { body!['DoctorID'] = doctorProfile.doctorID.toString(); } - if (body['DoctorID'] == "") - body['DoctorID'] = doctorProfile - .doctorID; // changed from null; because create update episode not working + if (body['DoctorID'] == "") body['DoctorID'] = doctorProfile.doctorID; // changed from null; because create update episode not working if (body['EditedBy'] == null) body['EditedBy'] = doctorProfile.doctorID.toString(); if (body['ProjectID'] == null) { body['ProjectID'] = doctorProfile.projectID.toString(); @@ -64,8 +62,8 @@ class BaseAppClient { body['SetupID'] = body.containsKey('SetupID') ? body['SetupID'] != null - ? body['SetupID'] - : await sharedPref.getString(DOCTOR_SETUP_ID) + ? body['SetupID'] + : await sharedPref.getString(DOCTOR_SETUP_ID) : await sharedPref.getString(DOCTOR_SETUP_ID); if (body['EditedBy'] == '') { @@ -94,21 +92,16 @@ class BaseAppClient { body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP.toString(); body['PatientOutSA'] = body['PatientOutSA'] ?? '0'; // PATIENT_OUT_SA; if (body['VidaAuthTokenID'] == null) { - body['VidaAuthTokenID'] = - await sharedPref.getString(VIDA_AUTH_TOKEN_ID); + body['VidaAuthTokenID'] = await sharedPref.getString(VIDA_AUTH_TOKEN_ID); } if (body['VidaRefreshTokenID'] == null) { - body['VidaRefreshTokenID'] = - await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); + body['VidaRefreshTokenID'] = await sharedPref.getString(VIDA_REFRESH_TOKEN_ID); } int? projectID = await sharedPref.getInt(PROJECT_ID); if (projectID == 2 || projectID == 3) body['PatientOutSA'] = true; - else if ((body.containsKey('facilityId') && body['facilityId'] == 2 || - body['facilityId'] == 3) || - body['ProjectID'] == 2 || - body['ProjectID'] == 3) + else if ((body.containsKey('facilityId') && body['facilityId'] == 2 || body['facilityId'] == 3) || body['ProjectID'] == 2 || body['ProjectID'] == 3) body['PatientOutSA'] = 'true'; else body['PatientOutSA'] = 'false'; @@ -135,27 +128,15 @@ class BaseAppClient { var asd = json.encode(body); var asd2; if (await Utils.checkConnection()) { - final response = await http.post(Uri.parse(url), - body: json.encode(body), - headers: { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }); + final response = await http.post(Uri.parse(url), body: json.encode(body), headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}); final int statusCode = response.statusCode; if (statusCode < 200 || statusCode >= 400) { onFailure(Utils.generateContactAdminMsg(), statusCode); - if (body['DoctorID'] != null) - postFailureResponse( - doctorId: body['DoctorID'], - url: url, - request: json.encode(body), - response: response.body, - exception: "$statusCode"); + if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: "$statusCode"); } else { var parsed = json.decode(response.body.toString()); if (parsed['ErrorType'] == 4) { - helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], - parsed['AndroidLink'], parsed['IOSLink']); + helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], parsed['AndroidLink'], parsed['IOSLink']); } if (parsed['IsAuthenticated'] != null && !parsed['IsAuthenticated']) { @@ -163,19 +144,11 @@ class BaseAppClient { if (parsed['ErrorCode'] == '699') { onSuccess(parsed, statusCode); } else { - if (body['DoctorID'] != null) - postFailureResponse( - doctorId: body['DoctorID'], - url: url, - request: json.encode(body), - response: response.body, - exception: getError(parsed)); + if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: getError(parsed)); onFailure(getError(parsed), statusCode); } } else if (!isAllowAny) { - await Provider.of(AppGlobal.CONTEX, - listen: false) - .logout(); + await Provider.of(AppGlobal.CONTEX, listen: false).logout(); //todo nofailure is placed here and but have to handle the response here as well Utils.showErrorToast('Your session expired Please login again'); locator().pushNamedAndRemoveUntil(ROOT); @@ -185,13 +158,7 @@ class BaseAppClient { } } else if (parsed['MessageStatus'] == 1) { if (!parsed['IsAuthenticated']) { - if (body['DoctorID'] != null) - postFailureResponse( - doctorId: body['DoctorID'], - url: url, - request: json.encode(body), - response: response.body, - exception: getError(parsed)); + if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: getError(parsed)); onFailure(getError(parsed), statusCode); } else onSuccess(parsed, statusCode); @@ -205,18 +172,13 @@ class BaseAppClient { return; } } - if (body['DoctorID'] != null) { - postFailureResponse( - doctorId: body['DoctorID'], - url: url, - request: json.encode(body), - response: response.body, - exception: getError(parsed)); - } - onFailure(getError(parsed), statusCode); + if (body['DoctorID'] != null) { + postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: getError(parsed)); } + onFailure(getError(parsed), statusCode); } - } else { + } + } else { onFailure('Please Check The Internet Connection', -1); } } catch (e) { @@ -225,264 +187,204 @@ class BaseAppClient { } } - postPatient(String endPoint, - {Map? body, - required Function(dynamic response, int statusCode) onSuccess, - required Function(String error, int statusCode) onFailure, - PatiantInformtion? patient, - bool isExternal = false}) async { + postPatient(String endPoint, + {Map? body, + required Function(dynamic response, int statusCode) onSuccess, + required Function(String error, int statusCode) onFailure, + PatiantInformtion? patient, + bool isExternal = false}) async { String url = BASE_URL + endPoint; try { - Map headers = { - 'Content-Type': 'application/json', - 'Accept': 'application/json' - }; - - String? token = await sharedPref.getString(TOKEN); - Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); - - if (profile != null) { - DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); - if (body!['DoctorID'] == null) { - body['DoctorID'] = doctorProfile.doctorID; - } - } - if (body!['DoctorID'] == 0) { - body['DoctorID'] = null; - } - var languageID = - await sharedPref.getStringWithDefaultValue(APP_Language, 'en'); - body['SetupID'] = body!.containsKey('SetupID') - ? body['SetupID'] != null - ? body['SetupID'] - : await sharedPref.getString(DOCTOR_SETUP_ID) - : await sharedPref.getString(DOCTOR_SETUP_ID); - - body['VersionID'] = VERSION_ID; - body['Channel'] = CHANNEL; - body['LanguageID'] = languageID == 'ar' ? 1 : 2; - - body['IPAdress'] = "10.20.10.20"; - body['generalid'] = GENERAL_ID; - body['PatientOutSA'] = body.containsKey('PatientOutSA') - ? body['PatientOutSA'] != null - ? body['PatientOutSA'] - : PATIENT_OUT_SA_PATIENT_REQ - : PATIENT_OUT_SA_PATIENT_REQ; - - if (body.containsKey('isDentalAllowedBackend')) { - body['isDentalAllowedBackend'] = - body.containsKey('isDentalAllowedBackend') - ? body['isDentalAllowedBackend'] != null - ? body['isDentalAllowedBackend'] - : IS_DENTAL_ALLOWED_BACKEND - : IS_DENTAL_ALLOWED_BACKEND; - } + Map headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}; - body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; - - body['PatientType'] = body.containsKey('PatientType') - ? body['PatientType'] != null - ? body['PatientType'] - : patient!.patientType != null - ? patient.patientType - : PATIENT_TYPE - : PATIENT_TYPE; - - body['PatientTypeID'] = body.containsKey('PatientTypeID') - ? body['PatientTypeID'] != null - ? body['PatientTypeID'] - : patient!.patientType != null - ? patient.patientType - : PATIENT_TYPE_ID - : PATIENT_TYPE_ID; - - body['TokenID'] = - body.containsKey('TokenID') ? body['TokenID'] ?? token : token; - body['PatientID'] = body['PatientID'] != null - ? body['PatientID'] - : patient!.patientId ?? patient.patientMRN; - - body['PatientOutSA'] = 0; //user['OutSA']; //TODO change it - body['SessionID'] = SESSION_ID; //getSe - - int? projectID = await sharedPref.getInt(PROJECT_ID); - if (projectID == 2 || projectID == 3) - body['PatientOutSA'] = true; - else - body['PatientOutSA'] = false; - - // if(!body.containsKey('ProjectID')) { - // if (projectID != null) { - // body['ProjectID'] = 313; - // } else { - // body['ProjectID'] = 0; - // } - // } - - // body['DoctorID'] = 24; //3844083 - // body['TokenID'] = "@dm!n"; - - print("URL : $url"); - print("Body : ${json.encode(body)}"); - var asd = json.encode(body); - var asd2; - if (await Utils.checkConnection()) { - final response = await http.post(Uri.parse(url.trim()), - body: json.encode(body), headers: headers); - final int statusCode = response.statusCode; - print("statusCode :$statusCode"); - if (statusCode < 200 || statusCode >= 400 || json == null) { - onFailure('Error While Fetching data', statusCode); - } else { - // var parsed = json.decode(response.body.toString()); - var parsed = json.decode(utf8.decode(response.bodyBytes)); - if (parsed['Response_Message'] != null) { - onSuccess(parsed, statusCode); - } else { - if (parsed['ErrorType'] == 4) { - helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], - parsed['AndroidLink'], parsed['IOSLink']); - } - if (parsed['IsAuthenticated'] == null) { - if (parsed['isSMSSent'] == true) { - onSuccess(parsed, statusCode); - } else if (parsed['MessageStatus'] == 1) { - onSuccess(parsed, statusCode); - } else if (parsed['Result'] == 'OK') { - onSuccess(parsed, statusCode); - } else { - if (parsed != null) { - onSuccess(parsed, statusCode); - } else { - if (body['DoctorID'] != null) - postFailureResponse( - doctorId: body['DoctorID'], - url: url, - request: json.encode(body), - response: response.body, - exception: getError(parsed)); - onFailure(getError(parsed), statusCode); - } - } - } else if (parsed['MessageStatus'] == 1 || - parsed['SMSLoginRequired'] == true) { - onSuccess(parsed, statusCode); - } else if (parsed['MessageStatus'] == 2 && - parsed['IsAuthenticated']) { - if (parsed['SameClinicApptList'] != null) { - onSuccess(parsed, statusCode); - } else { - if (parsed['message'] == null && - parsed['ErrorEndUserMessage'] == null) { - if (parsed['ErrorSearchMsg'] == null) { - if (body['DoctorID'] != null) - postFailureResponse( - doctorId: body['DoctorID'], - url: url, - request: json.encode(body), - response: response.body, - exception: - "Server Error found with no available message"); - - onFailure("Server Error found with no available message", - statusCode); - } else { - if (body['DoctorID'] != null) - postFailureResponse( - doctorId: body['DoctorID'], - url: url, - request: json.encode(body), - response: response.body, - exception: parsed['ErrorSearchMsg']); - onFailure(parsed['ErrorSearchMsg'], statusCode); - } - } else { - if (body['DoctorID'] != null) - postFailureResponse( - doctorId: body['DoctorID'], - url: url, - request: json.encode(body), - response: response.body, - exception: parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage']); - onFailure( - parsed['message'] ?? - parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage'], - statusCode); - } - } - } else { - if (parsed['SameClinicApptList'] != null) { - onSuccess(parsed, statusCode); - } else { - if (parsed['message'] != null) { - if (body['DoctorID'] != null) - postFailureResponse( - doctorId: body['DoctorID'], - url: url, - request: json.encode(body), - response: response.body, - exception: parsed['message']); - - onFailure(parsed['message'] ?? parsed['message'], statusCode); - } else { - if (body['DoctorID'] != null) - postFailureResponse( - doctorId: body['DoctorID'], - url: url, - request: json.encode(body), - response: response.body, - exception: parsed['ErrorEndUserMessage'] ?? - parsed['ErrorMessage']); - - onFailure( - parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], - statusCode); - } - } - } - } - } - } else { - onFailure('Please Check The Internet Connection', -1); - } + String? token = await sharedPref.getString(TOKEN); + Map? profile = await sharedPref.getObj(DOCTOR_PROFILE); + + if (profile != null) { + DoctorProfileModel doctorProfile = DoctorProfileModel.fromJson(profile); + if (body!['DoctorID'] == null) { + body['DoctorID'] = doctorProfile.doctorID; + } + } + if (body!['DoctorID'] == 0) { + body['DoctorID'] = null; + } + var languageID = await sharedPref.getStringWithDefaultValue(APP_Language, 'en'); + body['SetupID'] = body!.containsKey('SetupID') + ? body['SetupID'] != null + ? body['SetupID'] + : await sharedPref.getString(DOCTOR_SETUP_ID) + : await sharedPref.getString(DOCTOR_SETUP_ID); + + body['VersionID'] = VERSION_ID; + body['Channel'] = CHANNEL; + body['LanguageID'] = languageID == 'ar' ? 1 : 2; + + body['IPAdress'] = "10.20.10.20"; + body['generalid'] = GENERAL_ID; + body['PatientOutSA'] = body.containsKey('PatientOutSA') + ? body['PatientOutSA'] != null + ? body['PatientOutSA'] + : PATIENT_OUT_SA_PATIENT_REQ + : PATIENT_OUT_SA_PATIENT_REQ; + + if (body.containsKey('isDentalAllowedBackend')) { + body['isDentalAllowedBackend'] = body.containsKey('isDentalAllowedBackend') + ? body['isDentalAllowedBackend'] != null + ? body['isDentalAllowedBackend'] + : IS_DENTAL_ALLOWED_BACKEND + : IS_DENTAL_ALLOWED_BACKEND; + } + + body['DeviceTypeID'] = Platform.isAndroid ? 1 : 2; + + body['PatientType'] = body.containsKey('PatientType') + ? body['PatientType'] != null + ? body['PatientType'] + : patient!.patientType != null + ? patient.patientType + : PATIENT_TYPE + : PATIENT_TYPE; + + body['PatientTypeID'] = body.containsKey('PatientTypeID') + ? body['PatientTypeID'] != null + ? body['PatientTypeID'] + : patient!.patientType != null + ? patient.patientType + : PATIENT_TYPE_ID + : PATIENT_TYPE_ID; + + body['TokenID'] = body.containsKey('TokenID') ? body['TokenID'] ?? token : token; + body['PatientID'] = body['PatientID'] != null ? body['PatientID'] : patient!.patientId ?? patient.patientMRN; + + body['PatientOutSA'] = 0; //user['OutSA']; //TODO change it + body['SessionID'] = SESSION_ID; //getSe + + int? projectID = await sharedPref.getInt(PROJECT_ID); + if (projectID == 2 || projectID == 3) + body['PatientOutSA'] = true; + else + body['PatientOutSA'] = false; + + // if(!body.containsKey('ProjectID')) { + // if (projectID != null) { + // body['ProjectID'] = 313; + // } else { + // body['ProjectID'] = 0; + // } + // } + + // body['DoctorID'] = 24; //3844083 + // body['TokenID'] = "@dm!n"; + + print("URL : $url"); + print("Body : ${json.encode(body)}"); + var asd = json.encode(body); + var asd2; + if (await Utils.checkConnection()) { + final response = await http.post(Uri.parse(url.trim()), body: json.encode(body), headers: headers); + final int statusCode = response.statusCode; + print("statusCode :$statusCode"); + if (statusCode < 200 || statusCode >= 400 || json == null) { + onFailure('Error While Fetching data', statusCode); + } else { + // var parsed = json.decode(response.body.toString()); + var parsed = json.decode(utf8.decode(response.bodyBytes)); + if (parsed['Response_Message'] != null) { + onSuccess(parsed, statusCode); + } else { + if (parsed['ErrorType'] == 4) { + helpers.navigateToUpdatePage(parsed['ErrorEndUserMessage'], parsed['AndroidLink'], parsed['IOSLink']); + } + if (parsed['IsAuthenticated'] == null) { + if (parsed['isSMSSent'] == true) { + onSuccess(parsed, statusCode); + } else if (parsed['MessageStatus'] == 1) { + onSuccess(parsed, statusCode); + } else if (parsed['Result'] == 'OK') { + onSuccess(parsed, statusCode); + } else { + if (parsed != null) { + onSuccess(parsed, statusCode); + } else { + if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: getError(parsed)); + onFailure(getError(parsed), statusCode); + } + } + } else if (parsed['MessageStatus'] == 1 || parsed['SMSLoginRequired'] == true) { + onSuccess(parsed, statusCode); + } else if (parsed['MessageStatus'] == 2 && parsed['IsAuthenticated']) { + if (parsed['SameClinicApptList'] != null) { + onSuccess(parsed, statusCode); + } else { + if (parsed['message'] == null && parsed['ErrorEndUserMessage'] == null) { + if (parsed['ErrorSearchMsg'] == null) { + if (body['DoctorID'] != null) + postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: "Server Error found with no available message"); + + onFailure("Server Error found with no available message", statusCode); + } else { + if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: parsed['ErrorSearchMsg']); + onFailure(parsed['ErrorSearchMsg'], statusCode); + } + } else { + if (body['DoctorID'] != null) + postFailureResponse( + doctorId: body['DoctorID'], + url: url, + request: json.encode(body), + response: response.body, + exception: parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']); + onFailure(parsed['message'] ?? parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + } + } + } else { + if (parsed['SameClinicApptList'] != null) { + onSuccess(parsed, statusCode); + } else { + if (parsed['message'] != null) { + if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: parsed['message']); + + onFailure(parsed['message'] ?? parsed['message'], statusCode); + } else { + if (body['DoctorID'] != null) + postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']); + + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode); + } + } + } + } + } + } else { + onFailure('Please Check The Internet Connection', -1); + } } catch (e) { - print(e); - onFailure(e.toString(), -1); - } + print(e); + onFailure(e.toString(), -1); } + } - String getError(parsed) { + String getError(parsed) { //TODO change this fun String? error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; if (parsed["ValidationErrors"] != null) { - error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; - - if (parsed["ValidationErrors"]["ValidationErrors"] != null && - parsed["ValidationErrors"]["ValidationErrors"].length != 0) { - for (var i = 0; - i < parsed["ValidationErrors"]["ValidationErrors"].length; - i++) { - error = error! + - parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + - "\n"; - } - } + error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; + + if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { + for (var i = 0; i < parsed["ValidationErrors"]["ValidationErrors"].length; i++) { + error = error! + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + "\n"; + } + } } if (error == null || error == "null" || error == "null\n") { - return Utils.generateContactAdminMsg(); + return Utils.generateContactAdminMsg(); } return error; - } + } - get( - {required String endPoint, - required Function(dynamic response, int statusCode) onSuccess, - required Function(String error, int statusCode) onFailure}) async { + get({required String endPoint, required Function(dynamic response, int statusCode) onSuccess, required Function(String error, int statusCode) onFailure}) async { String token = await sharedPref.getString(TOKEN); String url = DOCTOR_ROTATION + endPoint + '&token=' + token; print(url); @@ -490,10 +392,10 @@ class BaseAppClient { final int statusCode = response.statusCode; if (statusCode < 200 || statusCode >= 400) { - onFailure(Utils.generateContactAdminMsg(), statusCode); + onFailure(Utils.generateContactAdminMsg(), statusCode); } else { - var parsed = json.decode(response.body.toString()); - onSuccess(parsed, statusCode); - } + var parsed = json.decode(response.body.toString()); + onSuccess(parsed, statusCode); } } +} diff --git a/lib/config/config.dart b/lib/config/config.dart index 3607a8c8..2385fe15 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -413,7 +413,7 @@ const TRANSACTION_NO = 0; const LANGUAGE_ID = 2; const STAMP = '2020-04-27T12:17:17.721Z'; const IP_ADDRESS = '9.9.9.9'; -const VERSION_ID = 9.6; +const VERSION_ID = 9.7; const CHANNEL = 9; const SESSION_ID = 'BlUSkYymTt'; const IS_LOGIN_FOR_DOCTOR_APP = true; diff --git a/pubspec.yaml b/pubspec.yaml index b6962700..fb9088fb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: A new Flutter project. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.4.22+33 +version: 1.4.24+1 environment: From a54ebb91ab058629c83413988913edaf49533983 Mon Sep 17 00:00:00 2001 From: Syed Taha Alam Date: Sun, 22 Jun 2025 15:57:19 +0300 Subject: [PATCH 7/7] request and response are being reported to firestore --- lib/client/base_app_client.dart | 10 +++++++ lib/utils/exception_report.dart | 49 ++++++++++++++++++++++++++++++++- 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 9289173c..1066f9d1 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -130,6 +130,16 @@ class BaseAppClient { if (await Utils.checkConnection()) { final response = await http.post(Uri.parse(url), body: json.encode(body), headers: {'Content-Type': 'application/json', 'Accept': 'application/json'}); final int statusCode = response.statusCode; + + if (body['DoctorID'] != null) { + postRequestAndResponse( + doctorId: body['DoctorID'], + completeUrl: url, + request: json.encode(body), + response: response.body, + urlSuffix: endPoint, + statusCode: statusCode.toString()); + } if (statusCode < 200 || statusCode >= 400) { onFailure(Utils.generateContactAdminMsg(), statusCode); if (body['DoctorID'] != null) postFailureResponse(doctorId: body['DoctorID'], url: url, request: json.encode(body), response: response.body, exception: "$statusCode"); diff --git a/lib/utils/exception_report.dart b/lib/utils/exception_report.dart index 2e039703..a83013fe 100644 --- a/lib/utils/exception_report.dart +++ b/lib/utils/exception_report.dart @@ -1,4 +1,23 @@ -// import 'package:cloud_firestore/cloud_firestore.dart'; + +import 'package:cloud_firestore/cloud_firestore.dart'; + +List monitoredEndpoints = [ + "Services/Sentry.svc/REST/MemberLogIN_New", + 'Services/DoctorApplication.svc/REST/GetProjectInfo', + 'Services/DoctorApplication.svc/REST/DoctorApp_GetDeviceDetailsByIMEI', + 'Services/DoctorApplication.svc/REST/SendActivationCodeForDoctorApp', + 'Services/DoctorApplication.svc/REST/CheckActivationCodeForDoctorApp', + 'Services/Doctors.svc/REST/GetDocProfiles', + 'Services/DoctorApplication.svc/REST/DoctorApp_GetDoctorNotRepliedCounts', + 'Services/DoctorApplication.svc/REST/GetClinicsForDoctor', + 'Services/DoctorApplication.svc/REST/GetDoctorDashboardKPI', + 'Services/DoctorApplication.svc/REST/GetSpecialClinicalCareList', + 'Services/DoctorApplication.svc/REST/IsInfectiousDiseasesConsultant', + 'Services/DoctorApplication.svc/REST/IsInterventionAccessLevel3Pending', + 'Services/DoctorApplication.svc/REST/CheckDoctorHasLiveCare', + 'Services/DoctorApplication.svc/REST/FetchRadCriticalFinding', + 'Services/DoctorApplication.svc/REST/DoctorApp_InsertOrUpdateDeviceDetails' +]; void postFailureResponse({ required dynamic doctorId, @@ -16,4 +35,32 @@ void postFailureResponse({ // final firestore = FirebaseFirestore.instance; // final collectionRef = firestore.collection(doctorId.toString()); // await collectionRef.doc(DateTime.now().toIso8601String()).set(data); +} + + +void postRequestAndResponse({ + required dynamic doctorId, + required String completeUrl, + required String urlSuffix, + required String request, + required String response, + required String statusCode, +}) async { + if(!monitoredEndpoints.contains(urlSuffix)) { + return; + } + print(" the url is being logged "); + Map data = { + "url" : completeUrl, + "request" : request, + "response" : response, + "statusCode" : statusCode, + }; + final firestore = FirebaseFirestore.instance; + // Sanitize urlSuffix to be Firestore-safe + final safeSuffix = urlSuffix.replaceAll(RegExp(r'[^a-zA-Z0-9_-]'), '_'); + final collectionRef = firestore.collection('doctors') + .doc(doctorId.toString()) + .collection(safeSuffix); + await collectionRef.doc(DateTime.now().toIso8601String()).set(data); } \ No newline at end of file