diff --git a/android/app/libs/PenNavUI.aar b/android/app/libs/PenNavUI.aar index 7832df8..a565860 100644 Binary files a/android/app/libs/PenNavUI.aar and b/android/app/libs/PenNavUI.aar differ diff --git a/android/app/libs/PenguinRenderer.aar b/android/app/libs/PenguinRenderer.aar index 2926e9a..b498726 100644 Binary files a/android/app/libs/PenguinRenderer.aar and b/android/app/libs/PenguinRenderer.aar differ diff --git a/android/app/src/main/kotlin/com/ejada/hmg/penguin/PenguinView.kt b/android/app/src/main/kotlin/com/ejada/hmg/penguin/PenguinView.kt index 6c7306d..3925ca5 100644 --- a/android/app/src/main/kotlin/com/ejada/hmg/penguin/PenguinView.kt +++ b/android/app/src/main/kotlin/com/ejada/hmg/penguin/PenguinView.kt @@ -320,6 +320,7 @@ internal class PenguinView( if(clinicId.isEmpty()) return navigateTo(clinicId) +// navigateTo("3-1") } /** diff --git a/assets/langs/ar-SA.json b/assets/langs/ar-SA.json index cb2b71a..e91536e 100644 --- a/assets/langs/ar-SA.json +++ b/assets/langs/ar-SA.json @@ -1523,5 +1523,10 @@ "bmi": "مؤشر كتلة الجسم", "yesPleaseINeedHelp": "نعم، من فضلك أريد المساعدة", "noThanksIKnowTheClinic": "لا شكراً، أعرف العيادة", - "unableToSendOTP": "تعذر إرسال رمز التحقق لمرة واحدة" + "unableToSendOTP": "تعذر إرسال رمز التحقق لمرة واحدة", + + "confirmYourLocation": "قم بتأكيد موقعك", + "confirmYourLocationDesc": "يرجى تأكيد موقعك الحالي لعرض الاتجاهات المناسبة.", + "insideHospital": "أنا داخل المستشفى", + "outsideHospital": "أنا خارج المستشفى" } diff --git a/assets/langs/en-US.json b/assets/langs/en-US.json index d937f6b..5aa377d 100644 --- a/assets/langs/en-US.json +++ b/assets/langs/en-US.json @@ -1516,5 +1516,9 @@ "bmi": "BMI", "yesPleaseINeedHelp": "Yes, Please I need help", "noThanksIKnowTheClinic": "No, Thanks. I Know the clinic", - "unableToSendOTP": "Unable to send Verification OTP" + "unableToSendOTP": "Unable to send Verification OTP", + "confirmYourLocation": "Confirm Your Location", + "confirmYourLocationDesc": "Please confirm your present location to view appropriate directions.", + "insideHospital": "I am inside the hospital", + "outsideHospital": "I am outside the hospital" } diff --git a/ios/Runner/Penguin/PenguinView.swift b/ios/Runner/Penguin/PenguinView.swift index 508fb74..e683a35 100644 --- a/ios/Runner/Penguin/PenguinView.swift +++ b/ios/Runner/Penguin/PenguinView.swift @@ -309,22 +309,13 @@ class PenguinView: NSObject, FlutterPlatformView, PIEventsDelegate, PenNavInitia PenNavUIManager.shared.eventsDelegate = self - - - print("====== after eventsDelegate onPenNavSuccess =========") - - PenNavUIManager.shared.navigate(to: "108") - - +// print("====== after onPenNavSuccess navigate =========") +// PenNavUIManager.shared.navigate(to: "3-1") // Present the Penguin UI on top of the Flutter view controller - + print("====== after onPenNavSuccess present =========") PenNavUIManager.shared.present(root: controller, view: _view) - - - - print("====== after present onPenNavSuccess =========") print(model?.clinicID) @@ -347,11 +338,21 @@ class PenguinView: NSObject, FlutterPlatformView, PIEventsDelegate, PenNavInitia let clientID = self.model?.clientID, !clientID.isEmpty else { - print("Error: Config Client ID is nil or empty") + print("Error: Config Clinic ID is nil or empty") return } + + print("====== after onPenNavSuccess navigate =========") +// PenNavUIManager.shared.navigate(to: "3-1") { success, error in + PenNavUIManager.shared.navigate(to: clinicID) { success, error in + if success { + print("Nav Success") + } else { + print("Nav Error") + } + } @@ -373,20 +374,20 @@ class PenguinView: NSObject, FlutterPlatformView, PIEventsDelegate, PenNavInitia - guard let token = token else { - - print("Token is nil") - - return - - } - - print("Token Generated") - - print(token); +// guard let token = token else { +// +// print("Token is nil") +// +// return +// +// } +// +// print("Token Generated") +// +// print(token); - +// // self?.handleNavigation(clinicID: clinicID, token: token) { success, errorMessage in // // if success { @@ -425,7 +426,8 @@ class PenguinView: NSObject, FlutterPlatformView, PIEventsDelegate, PenNavInitia PenNavUIManager.shared.setToken(token: token) - PenNavUIManager.shared.navigate(to: clinicID) +// PenNavUIManager.shared.navigate(to: clinicID) + PenNavUIManager.shared.navigate(to: "3-1") completion(true,nil) diff --git a/lib/core/api_consts.dart b/lib/core/api_consts.dart index e833ea9..7ff24f8 100644 --- a/lib/core/api_consts.dart +++ b/lib/core/api_consts.dart @@ -681,7 +681,7 @@ const DASHBOARD = 'Services/Patients.svc/REST/PatientDashboard'; class ApiConsts { static const maxSmallScreen = 660; - static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.uat; + static AppEnvironmentTypeEnum appEnvironmentType = AppEnvironmentTypeEnum.prod; // static String baseUrl = 'https://uat.hmgwebservices.com/'; // HIS API URL UAT diff --git a/lib/features/hospital/hospital_selection_view_model.dart b/lib/features/hospital/hospital_selection_view_model.dart index 57bd360..24c7b9b 100644 --- a/lib/features/hospital/hospital_selection_view_model.dart +++ b/lib/features/hospital/hospital_selection_view_model.dart @@ -97,7 +97,7 @@ class HospitalSelectionBottomSheetViewModel extends ChangeNotifier { initPenguinSDK(hospital.iD, clinicID: clinicID); } - initPenguinSDK(int projectID, {String clinicID = "1"}) async { + initPenguinSDK(int projectID, {String clinicID = ""}) async { NavigationClinicDetails data = NavigationClinicDetails(); data.projectId = projectID.toString(); data.clinicId = clinicID; diff --git a/lib/generated/locale_keys.g.dart b/lib/generated/locale_keys.g.dart index 416d2a4..d389dea 100644 --- a/lib/generated/locale_keys.g.dart +++ b/lib/generated/locale_keys.g.dart @@ -1515,5 +1515,9 @@ abstract class LocaleKeys { static const yesPleaseINeedHelp = 'yesPleaseINeedHelp'; static const noThanksIKnowTheClinic = 'noThanksIKnowTheClinic'; static const unableToSendOTP = 'unableToSendOTP'; + static const confirmYourLocation = 'confirmYourLocation'; + static const confirmYourLocationDesc = 'confirmYourLocationDesc'; + static const insideHospital = 'insideHospital'; + static const outsideHospital = 'outsideHospital'; } diff --git a/lib/presentation/appointments/appointment_details_page.dart b/lib/presentation/appointments/appointment_details_page.dart index 953fd4a..3d62baf 100644 --- a/lib/presentation/appointments/appointment_details_page.dart +++ b/lib/presentation/appointments/appointment_details_page.dart @@ -9,6 +9,7 @@ import 'package:hmg_patient_app_new/core/app_state.dart'; import 'package:hmg_patient_app_new/core/dependencies.dart'; import 'package:hmg_patient_app_new/core/utils/calender_utils_new.dart'; import 'package:hmg_patient_app_new/core/utils/date_util.dart'; +import 'package:hmg_patient_app_new/core/utils/penguin_method_channel.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; @@ -17,6 +18,7 @@ import 'package:hmg_patient_app_new/features/book_appointments/book_appointments import 'package:hmg_patient_app_new/features/book_appointments/models/resp_models/doctors_list_response_model.dart'; import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart'; import 'package:hmg_patient_app_new/features/contact_us/models/feedback_type.dart'; +import 'package:hmg_patient_app_new/features/hospital/AppPermission.dart'; import 'package:hmg_patient_app_new/features/lab/lab_view_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/models/resp_models/patient_appointment_history_response_model.dart'; import 'package:hmg_patient_app_new/features/my_appointments/my_appointments_view_model.dart'; @@ -40,6 +42,7 @@ import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:hmg_patient_app_new/widgets/loader/bottomsheet_loader.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:map_launcher/map_launcher.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import '../medical_file/widgets/medical_file_card.dart'; @@ -230,19 +233,23 @@ class _AppointmentDetailsPageState extends State { width: MediaQuery.of(context).size.width * 0.785, child: CustomButton( onPressed: () async { - await MapLauncher.showMarker( - mapType: MapType.google, - coords: Coords(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), - double.parse(widget.patientAppointmentHistoryResponseModel.longitude!)), - title: widget.patientAppointmentHistoryResponseModel.projectName ?? "Habib Hospital", - ).catchError((err) { - MapLauncher.showMarker( - mapType: Platform.isIOS ? MapType.apple : MapType.google, + if (widget.patientAppointmentHistoryResponseModel.projectID == 130 || widget.patientAppointmentHistoryResponseModel.projectID == 120) { + showDirectionsBottomSheet(); + } else { + await MapLauncher.showMarker( + mapType: MapType.google, coords: Coords(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), double.parse(widget.patientAppointmentHistoryResponseModel.longitude!)), title: widget.patientAppointmentHistoryResponseModel.projectName ?? "Habib Hospital", - ); - }); + ).catchError((err) { + MapLauncher.showMarker( + mapType: Platform.isIOS ? MapType.apple : MapType.google, + coords: Coords(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), + double.parse(widget.patientAppointmentHistoryResponseModel.longitude!)), + title: widget.patientAppointmentHistoryResponseModel.projectName ?? "Habib Hospital", + ); + }); + } }, text: LocaleKeys.getDirections.tr(context: context), backgroundColor: AppColors.textColor.withValues(alpha: 0.8), @@ -819,6 +826,89 @@ class _AppointmentDetailsPageState extends State { ); } + void showDirectionsBottomSheet() { + showCommonBottomSheetWithoutHeight( + context, + title: "", + isDismissible: true, + isCloseButtonVisible: false, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + LocaleKeys.confirmYourLocation.tr(context: context).toText28(color: AppColors.textColor, isBold: true, height: 1.5), + SizedBox(height: 4.h), + LocaleKeys.confirmYourLocationDesc.tr(context: context).toText12( + color: AppColors.greyTextColor, + fontWeight: FontWeight.w500, + ), + SizedBox(height: 24.h), + CustomButton( + text: LocaleKeys.insideHospital.tr(context: context), + onPressed: () { + Navigator.pop(context); + initPenguinSDK(widget.patientAppointmentHistoryResponseModel.projectID == 130 ? 1 : (widget.patientAppointmentHistoryResponseModel.projectID == 120 ? 3 : -1), + clinicID: widget.patientAppointmentHistoryResponseModel.clinicID.toString()); + }, + backgroundColor: AppColors.primaryRedColor, + borderColor: AppColors.primaryRedColor, + textColor: AppColors.whiteColor, + fontSize: 16.f, + fontWeight: FontWeight.w500, + borderRadius: 12.r, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 56.h, + ), + SizedBox(height: 8.h), + CustomButton( + text: LocaleKeys.outsideHospital.tr(context: context), + onPressed: () async { + Navigator.pop(context); + await MapLauncher.showMarker( + mapType: MapType.google, + coords: Coords(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), double.parse(widget.patientAppointmentHistoryResponseModel.longitude!)), + title: widget.patientAppointmentHistoryResponseModel.projectName ?? "Habib Hospital", + ).catchError((err) { + MapLauncher.showMarker( + mapType: Platform.isIOS ? MapType.apple : MapType.google, + coords: Coords(double.parse(widget.patientAppointmentHistoryResponseModel.latitude!), double.parse(widget.patientAppointmentHistoryResponseModel.longitude!)), + title: widget.patientAppointmentHistoryResponseModel.projectName ?? "Habib Hospital", + ); + }); + }, + backgroundColor: AppColors.chipSecondaryLightRedColor, + borderColor: AppColors.chipSecondaryLightRedColor, + textColor: AppColors.primaryRedColor, + fontSize: 16.f, + fontWeight: FontWeight.w500, + borderRadius: 12.r, + // padding: EdgeInsets.fromLTRB(10, 0, 10, 0), + height: 56.h, + ), + ], + ).paddingSymmetrical(24.w, 20.h), + callBackFunc: () {}, + ); + } + + initPenguinSDK(int projectID, {String clinicID = ""}) async { + NavigationClinicDetails data = NavigationClinicDetails(); + data.projectId = projectID.toString(); + data.clinicId = clinicID; + // data.clinicId = "1"; + final bool permited = await AppPermission.askPenguinPermissions(); + if (!permited) { + Map statuses = await [ + Permission.location, + Permission.bluetooth, + Permission.bluetoothConnect, + Permission.bluetoothScan, + Permission.activityRecognition, + ].request().whenComplete(() { + PenguinMethodChannel().launch("penguin", getIt.get().isArabic() ? "ar" : "en", getIt.get().getAuthenticatedUser()?.patientId?.toString() ?? "", true, details: data); + }); + } + } + openDoctorScheduleCalendar() async { DoctorsListResponseModel doctor = DoctorsListResponseModel( clinicID: widget.patientAppointmentHistoryResponseModel.clinicID, diff --git a/lib/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart b/lib/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart index d1abf2f..f07b9a4 100644 --- a/lib/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart +++ b/lib/presentation/appointments/widgets/appointment_checkin_bottom_sheet.dart @@ -58,17 +58,17 @@ class AppointmentCheckinBottomSheet extends StatelessWidget { projectDetailListModel = Utils.getProjectDetailObj(appState, patientAppointmentHistoryResponseModel.projectID); double dist = Utils.distance(value.latitude, value.longitude, double.parse(projectDetailListModel.latitude!), double.parse(projectDetailListModel.longitude!)).ceilToDouble() * 1000; print(dist); - // if (dist <= projectDetailListModel.geofenceRadius!) { + if (dist <= projectDetailListModel.geofenceRadius!) { sendCheckInRequest(projectDetailListModel.checkInQrCode!, 3, context); - // } else { - // showCommonBottomSheetWithoutHeight(context, - // title: LocaleKeys.error.tr(context: context), - // child: Utils.getErrorWidget( - // loadingText: LocaleKeys.ensureWithinHospitalLocation.tr(context: context), - // ), callBackFunc: () { - // Navigator.of(context).pop(); - // }, isFullScreen: false); - // } + } else { + showCommonBottomSheetWithoutHeight(context, + title: LocaleKeys.error.tr(context: context), + child: Utils.getErrorWidget( + loadingText: LocaleKeys.ensureWithinHospitalLocation.tr(context: context), + ), callBackFunc: () { + Navigator.of(context).pop(); + }, isFullScreen: false); + } }); }), SizedBox(height: 16.h),