From 9057a96d7f67383b05e5cd493dc8163afb0e8bb7 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 7 Jun 2022 18:48:22 +0300 Subject: [PATCH] Updates & fixes --- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 3 +- lib/config/shared_pref_kay.dart | 1 + lib/core/service/client/base_app_client.dart | 4 +- lib/main.dart | 2 +- .../components/DocAvailableAppointments.dart | 2 - .../components/SearchByClinic.dart | 2 +- lib/pages/ToDoList/payment_method_select.dart | 2 +- .../fragments/home_page_fragment2.dart | 26 +++- .../livecare/live_care_payment_page.dart | 62 +++++++- lib/pages/livecare/livecare_home.dart | 12 +- lib/pages/livecare/widgets/clinic_list.dart | 38 +++-- lib/pages/login/login.dart | 8 +- .../ask_doctor/ViewDoctorResponsesPage.dart | 4 +- .../medical/ask_doctor/ask_doctor_page.dart | 25 ++-- .../medical/ask_doctor/doctor_response.dart | 17 ++- .../medical/balance/confirm_payment_page.dart | 2 - .../prescription_items_page.dart | 7 +- .../syncHealthData.dart | 8 +- .../livecare_services/livecare_provider.dart | 3 +- lib/uitl/CalendarUtils.dart | 12 +- lib/uitl/date_uitl.dart | 2 +- lib/uitl/push-notification-handler.dart | 135 +++++++++--------- lib/uitl/translations_delegate_base.dart | 1 + lib/uitl/utils.dart | 2 +- lib/widgets/in_app_browser/InAppBrowser.dart | 6 +- 26 files changed, 242 insertions(+), 148 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index d1a2c22d..3ac3e1d6 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -25,7 +25,7 @@ var BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // var BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; // var PHARMACY_BASE_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; - +// // // Pharmacy Production URLs var BASE_PHARMACY_URL = 'https://mdlaboratories.com/exacartapi/api/'; var PHARMACY_BASE_URL = 'https://mdlaboratories.com/exacartapi/api/'; @@ -395,7 +395,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnar var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 8.2; +var VERSION_ID = 8.3; var SETUP_ID = '91877'; var LANGUAGE = 2; var PATIENT_OUT_SA = 0; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 050e7c37..b8fa04ab 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -541,7 +541,7 @@ const Map localizedValues = { "refferal": {"en": "E-Refferal", "ar": "الإحالة الإلكترونية"}, "refferalTitle": {"en": "E-Refferal", "ar": "خدمات"}, "refferalSubTitle": {"en": "Service", "ar": "الإحالة الإلكترونية"}, - "healthCare": {"en": "Health Care", "ar": "الصحية المزلية"}, + "healthCare": {"en": "Health Care", "ar": "الصحية المنزلية"}, "emergency": {"en": "Emergency", "ar": "الطوارئ"}, "erservices": {"en": "Emergency", "ar": "الطوارئ"}, "services2": {"en": "Services", "ar": "خدمات"}, @@ -1812,4 +1812,5 @@ const Map localizedValues = { "bluetoothPermission": { "en": "Dr. Al Habib app needs to access Bluetooth permission to connect blood pressure & blood sugar devices with the app to analyze the data", "ar": "يحتاج تطبيق دكتور الحبيب إلى الوصول إلى البلوتوث لربط أجهزة ضغط الدم وسكر الدم بالتطبيق لتحليل البيانات وتحميلها على ملفك الطبي حتى يتمكن الطبيب من الاطلاع عليها." }, "privacyPolicy": {"en": "Privacy Policy", "ar": "سياسة الخصوصية"}, "termsConditions": {"en": "Terms & Conditions", "ar": "الأحكام والشروط"}, + "liveCarePermissions": {"en": "LiveCare required Camera & Microphone permissions, Please allow these to proceed.", "ar": "يتطلب لايف كير أذونات الكاميرا والميكروفون ، يرجى السماح لها بالمتابعة."}, }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 7ce1c055..d5fb7e3b 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -2,6 +2,7 @@ const TOKEN = 'token'; const APP_LANGUAGE = 'language'; const USER_PROFILE = 'user-profile'; const PUSH_TOKEN = 'push-token'; +const APNS_TOKEN = 'apns-token'; const REGISTER_DATA_FOR_REGISTER = 'register-data-for-register'; const LOGIN_TOKEN_ID = 'register-data-for-register'; const REGISTER_DATA_FOR_LOGIIN = 'register-data-for-login'; diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index a6c13d1c..5c7214d6 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -132,7 +132,7 @@ class BaseAppClient { // body['IdentificationNo'] = 2076117163; // body['MobileNo'] = "966503109207"; - // body['PatientID'] = 793807; //3844083 + // body['PatientID'] = 3569409; //3844083 // body['TokenID'] = "@dm!n"; // Patient ID: 3027574 @@ -488,7 +488,7 @@ class BaseAppClient { 'Mobilenumber': user != null ? Utils.getPhoneNumberWithoutZero(user['MobileNumber'].toString()) : "", 'Statictoken': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9', 'Username': user != null ? user['PatientID'].toString() : "", - 'Host': "mdlaboratories.com", + // 'Host': "mdlaboratories.com", }); final int statusCode = response.statusCode; // print("statusCode :$statusCode"); diff --git a/lib/main.dart b/lib/main.dart index 254e0456..0be89cc5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -74,7 +74,7 @@ class _MyApp extends State { // var font = projectProvider.isArabic ? 'Cairo' : 'WorkSans'; // Re-enable once going live - // if (Platform.isAndroid) checkForUpdate(); + if (Platform.isAndroid) checkForUpdate(); ThemeNotifier(defaultTheme()); super.initState(); diff --git a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart index 01f425cf..d7d78d89 100644 --- a/lib/pages/BookAppointment/components/DocAvailableAppointments.dart +++ b/lib/pages/BookAppointment/components/DocAvailableAppointments.dart @@ -230,8 +230,6 @@ class _DocAvailableAppointmentsState extends State wit Map _eventsParsed; List slotsList = []; DateTime date; - // print("TIMEZONE"); - // print(DateTime.now().timeZoneName); final DateFormat formatter = DateFormat('HH:mm'); final DateFormat dateFormatter = DateFormat('yyyy-MM-dd'); for (var i = 0; i < freeSlotsResponse.length; i++) { diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 6aad6b69..1b8641a0 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -534,7 +534,7 @@ class _SearchByClinicState extends State { Navigator.push( context, FadePage( - page: LiveCareBookAppointment(clinicName: "Family Medicine", liveCareClinicID: dropdownValue.split("-")[2], liveCareServiceID: dropdownValue.split("-")[3]), + page: LiveCareBookAppointment(clinicName: dropdownTitle, liveCareClinicID: dropdownValue.split("-")[2], liveCareServiceID: dropdownValue.split("-")[3]), ), ).then((value) { setState(() { diff --git a/lib/pages/ToDoList/payment_method_select.dart b/lib/pages/ToDoList/payment_method_select.dart index e389830a..46cad3aa 100644 --- a/lib/pages/ToDoList/payment_method_select.dart +++ b/lib/pages/ToDoList/payment_method_select.dart @@ -198,7 +198,7 @@ class _PaymentMethodState extends State { ), ), ), - // if (projectViewModel.havePrivilege(90)) + if (projectViewModel.havePrivilege(90)) // Container( // width: double.infinity, // child: InkWell( diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index d75e3b3c..56b16c10 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -1,6 +1,8 @@ +import 'dart:convert'; import 'dart:math' as math; import 'package:auto_size_text/auto_size_text.dart'; +import 'package:crypto/crypto.dart'; import 'package:diplomaticquarterapp/config/size_config.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -23,9 +25,8 @@ import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:payfort_plugin/payfort_plugin.dart'; import 'package:provider/provider.dart'; -import 'package:pay/pay.dart'; class HomePageFragment2 extends StatefulWidget { DashboardViewModel model; @@ -102,7 +103,23 @@ class _HomePageFragment2State extends State { onLoginClick: () { widget.onLoginClick(); projectViewModel.analytics.loginRegistration.login_register_initiate(); - // navigateTo(context, CallHomePage()); + + // var output; + // PayfortPlugin.getID.then((deviceID) { + // //use this deviceID to send it to your server to get YOR_MERCHANT_REF and YOUR_SDK_TOKEN + // print("DeviceID: $deviceID"); + // output = sha256 + // .convert( + // utf8.encode("asD123@saereaccess_code=BsM6He4FMBaZ86W64kjZdevice_id=" + deviceID + "language=enmerchant_identifier=ipxnRXXqservice_command=SDK_TOKENasD123@saere")) + // .toString(); + // print("signature: $output"); + // PayfortPlugin.performPaymentRequest('ipxnRXXq', '099529edbf88418e92a0cb915eba0f3b', 'ahmed', 'en', 'haroon6138@mail.com', '10000', 'PURCHASE', 'SAR', '0' // 0 for test mode and 1 for production + // ) + // .then((value) => { + // // value object contains payfort response, such card number, transaction reference, ... + // print("card number ${value["card_number"]}") + // }); + // }); }, ), // height: MediaQuery.of(context).size.width / 2.6, @@ -288,8 +305,7 @@ class _HomePageFragment2State extends State { onTap: () { projectViewModel.analytics.offerPackages.log(); AuthenticatedUser user = projectViewModel.user; - if(projectViewModel.havePrivilege(82)) - Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesOfferTabPage(user))); + if (projectViewModel.havePrivilege(82)) Navigator.of(context).push(MaterialPageRoute(builder: (context) => PackagesOfferTabPage(user))); }, child: Stack( children: [ diff --git a/lib/pages/livecare/live_care_payment_page.dart b/lib/pages/livecare/live_care_payment_page.dart index 7aed9a3b..1ab20ffb 100644 --- a/lib/pages/livecare/live_care_payment_page.dart +++ b/lib/pages/livecare/live_care_payment_page.dart @@ -1,13 +1,18 @@ +import 'dart:io'; + import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/LiveCare/ERAppointmentFeesResponse.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; +import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -41,7 +46,6 @@ class _LiveCarePatmentPageState extends State { description: TranslationBase.of(context).erConsultation, body: Container( width: double.infinity, - height: double.infinity, child: Column( children: [ @@ -257,8 +261,6 @@ class _LiveCarePatmentPageState extends State { margin: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0), child: getPaymentMethods(), ), - - ], ), ), @@ -272,7 +274,7 @@ class _LiveCarePatmentPageState extends State { Expanded( child: DefaultButton( TranslationBase.of(context).cancel, - () { + () { Navigator.pop(context, false); }, ), @@ -281,12 +283,18 @@ class _LiveCarePatmentPageState extends State { Expanded( child: DefaultButton( TranslationBase.of(context).next, - () { + () { if (_selected == 0) { AppToast.showErrorToast(message: TranslationBase.of(context).pleaseAcceptTerms); } else { - projectViewModel.analytics.liveCare.livecare_immediate_consultation_TnC(clinic: widget.clinicName); - Navigator.pop(context, true); + askVideoCallPermission().then((value) { + if (value) { + projectViewModel.analytics.liveCare.livecare_immediate_consultation_TnC(clinic: widget.clinicName); + Navigator.pop(context, true); + } else { + openPermissionsDialog(); + } + }); } }, color: CustomColors.green, @@ -301,6 +309,46 @@ class _LiveCarePatmentPageState extends State { ); } + Future askVideoCallPermission() async { + if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted)) { + return false; + } + if (Platform.isAndroid && !(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) { + await drawOverAppsMessageDialog(context).then((value) { + return false; + }); + } + return true; + } + + openPermissionsDialog() { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).liveCarePermissions, + okText: TranslationBase.of(context).settings, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () async { + openAppSettings(); + Navigator.pop(context); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + + Future drawOverAppsMessageDialog(BuildContext context) async { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: TranslationBase.of(context).drawOverAppsPermission, + okText: TranslationBase.of(context).confirm, + cancelText: TranslationBase.of(context).cancel_nocaps, + okFunction: () async { + await PlatformBridge.shared().askDrawOverAppsPermission(); + Navigator.pop(context); + }, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } + void onRadioChanged(int value) { setState(() { _selected = value; diff --git a/lib/pages/livecare/livecare_home.dart b/lib/pages/livecare/livecare_home.dart index 396b629d..653a5fc8 100644 --- a/lib/pages/livecare/livecare_home.dart +++ b/lib/pages/livecare/livecare_home.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/FamilyFiles/PatientERVirtualHistoryResponse.dart'; @@ -5,6 +6,7 @@ import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePendingReque import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_list.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/livecare_logs.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -31,12 +33,13 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt ErRequestHistoryList pendingERRequestHistoryList; ProjectViewModel projectViewModel; + AppSharedPreferences sharedPref = AppSharedPreferences(); @override void initState() { _tabController = new TabController(length: 2, vsync: this); erRequestHistoryList = List(); - + LiveCareHome.isLiveCareTypeSelected = false; pendingERRequestHistoryList = new ErRequestHistoryList(); imagesInfo.add(ImagesInfo( imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/er-consultation_en/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/er-consultation_ar/ar/0.png')); @@ -47,6 +50,13 @@ class _LiveCareHomeState extends State with SingleTickerProviderSt super.initState(); } + @override + void dispose() { + LiveCareHome.isLiveCareTypeSelected = false; + sharedPref.remove(LIVECARE_CLINIC_DATA); + super.dispose(); + } + @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index 7f3359f5..1b2b4384 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -59,7 +59,7 @@ class _clinic_listState extends State { var languageID; var currentSelectedLiveCareType; - int selectedClinicID = 1; + int selectedClinicID; String selectedClinicName = "-"; AppSharedPreferences sharedPref = AppSharedPreferences(); @@ -190,15 +190,21 @@ class _clinic_listState extends State { navigateTo(context, LiveCarePatmentPage(getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName)).then( (value) { if (value) { - askVideoCallPermission().then((value) { - if (value) { - if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { - addNewCallForPatientER(projectViewModel.user.patientID.toString() + "" + DateTime.now().millisecondsSinceEpoch.toString()); - } else { - navigateToPaymentMethod(getERAppointmentFeesList, context); - } - } - }); + if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { + addNewCallForPatientER(projectViewModel.user.patientID.toString() + "" + DateTime.now().millisecondsSinceEpoch.toString()); + } else { + navigateToPaymentMethod(getERAppointmentFeesList, context); + } + + // askVideoCallPermission().then((value) { + // if (value) { + // if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { + // addNewCallForPatientER(projectViewModel.user.patientID.toString() + "" + DateTime.now().millisecondsSinceEpoch.toString()); + // } else { + // navigateToPaymentMethod(getERAppointmentFeesList, context); + // } + // } + // }); } }, ); @@ -328,8 +334,6 @@ class _clinic_listState extends State { GifLoaderDialogUtils.showMyDialog(context); service.checkPaymentStatus(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo), context).then((res) { GifLoaderDialogUtils.hideDialog(context); - print("Printing Payment Status Reponse!!!!"); - print(res); String paymentInfo = res['Response_Message']; if (paymentInfo == 'Success') { addNewCallForPatientER(Utils.getAppointmentTransID(appo.projectID, appo.clinicID, appo.appointmentNo)); @@ -380,9 +384,13 @@ class _clinic_listState extends State { liveCareOfflineClinicsListResponse.add(clinic); } }); - - selectedClinicID = liveCareClinicsListResponse.patientERGetClinicsList[0].serviceID; - selectedClinicName = liveCareClinicsListResponse.patientERGetClinicsList[0].serviceName; + if(liveCareClinicIDs != null) { + selectedClinicID = int.parse(liveCareClinicIDs.split("-")[2]); + selectedClinicName = liveCareClinicIDs.split("-")[0]; + } else { + selectedClinicID = liveCareClinicsListResponse.patientERGetClinicsList[0].serviceID; + selectedClinicName = liveCareClinicsListResponse.patientERGetClinicsList[0].serviceName; + } isDataLoaded = true; }); } else { diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index 9454b631..84a16f15 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -377,10 +377,10 @@ class _Login extends State { }); } - var voipToken = await sharedPref.getString("VOIPToken"); - setState(() { - nationalIDorFile.text = voipToken; - }); + // var voipToken = await sharedPref.getString("VOIPToken"); + // setState(() { + // nationalIDorFile.text = voipToken; + // }); } } diff --git a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index 978636e0..489e9281 100644 --- a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart +++ b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart @@ -44,7 +44,7 @@ class ViewDoctorResponsesPage extends StatelessWidget { itemBuilder: (context, _index) { return Container( padding: const EdgeInsets.only(left: 20, right: 12, top: 12, bottom: 12), - height: 110, + height: 130, decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(10.0), @@ -86,7 +86,7 @@ class ViewDoctorResponsesPage extends StatelessWidget { Container( margin: EdgeInsets.only(top: 10.0), child: Text( - doctorResponse.transactions[_index]['DoctorResponse'], + doctorResponse.transactions[_index]['InfoStatusDescription'], style: TextStyle( fontSize: 16, color: Color(0xff2E303A), diff --git a/lib/pages/medical/ask_doctor/ask_doctor_page.dart b/lib/pages/medical/ask_doctor/ask_doctor_page.dart index 877c52fc..19636d62 100644 --- a/lib/pages/medical/ask_doctor/ask_doctor_page.dart +++ b/lib/pages/medical/ask_doctor/ask_doctor_page.dart @@ -33,11 +33,7 @@ class AskDoctorPage extends StatelessWidget { return Container( margin: EdgeInsets.only(left: 50.0, right: 50.0), child: Center( - child: Text(TranslationBase.of(context).askDocEmpty, textAlign: TextAlign.center, style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w400, - color: CustomColors.accentColor - )), + child: Text(TranslationBase.of(context).askDocEmpty, textAlign: TextAlign.center, style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: CustomColors.accentColor)), ), ); } @@ -81,23 +77,20 @@ class AskDoctorPage extends StatelessWidget { return DoctorView( doctor: doctorList, isLiveCareAppointment: false, + isShowFlag: false, onTap: () { GifLoaderDialogUtils.showMyDialog(context); service.getCallInfoHoursResult(doctorId: _doctor.doctorID, projectId: _doctor.projectID).then((res) { GifLoaderDialogUtils.hideDialog(context); - if (res['ErrorEndUserMessage'] == null) { - Navigator.push( - context, - FadePage( - page: RequestTypePage(doctorList: _doctor), - ), - ); - } else { - AppToast.showErrorToast(message: res['ErrorEndUserMessage']); - } + Navigator.push( + context, + FadePage( + page: RequestTypePage(doctorList: _doctor), + ), + ); }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); - if (err != null) AppToast.showErrorToast(message: err); + if (err != null) AppToast.showErrorToast(message: err.toString()); print(err); }); }, diff --git a/lib/pages/medical/ask_doctor/doctor_response.dart b/lib/pages/medical/ask_doctor/doctor_response.dart index b827529b..37e5f1c9 100644 --- a/lib/pages/medical/ask_doctor/doctor_response.dart +++ b/lib/pages/medical/ask_doctor/doctor_response.dart @@ -71,7 +71,7 @@ class DoctorResponse extends StatelessWidget { ); }, child: Container( - height: 75, + height: 100, margin: EdgeInsets.only(top: 8, bottom: 8), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), @@ -101,8 +101,8 @@ class DoctorResponse extends StatelessWidget { Padding( padding: const EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), child: Icon(projectViewModel.isArabic - ? Icons.arrow_back_ios - : Icons.arrow_forward_ios), + ? Icons.arrow_forward_ios + : Icons.arrow_back_ios), ) ], ), @@ -144,7 +144,7 @@ class DoctorResponse extends StatelessWidget { return InkWell( onTap: () {}, child: Container( - height: 70, + height: 85, margin: EdgeInsets.only(top: 8, bottom: 8), decoration: BoxDecoration( borderRadius: BorderRadius.circular(8), @@ -171,9 +171,12 @@ class DoctorResponse extends StatelessWidget { ), ), ), - Icon(projectViewModel.isArabic - ? Icons.arrow_forward - : Icons.arrow_back_ios) + Padding( + padding: const EdgeInsets.all(8.0), + child: Icon(projectViewModel.isArabic + ? Icons.arrow_forward_ios + : Icons.arrow_back_ios), + ) ], ), ), diff --git a/lib/pages/medical/balance/confirm_payment_page.dart b/lib/pages/medical/balance/confirm_payment_page.dart index 4c63f91d..fcb893a2 100644 --- a/lib/pages/medical/balance/confirm_payment_page.dart +++ b/lib/pages/medical/balance/confirm_payment_page.dart @@ -221,7 +221,6 @@ class _ConfirmPaymentPageState extends State { }); } - // startApplePay(); // if() // GifLoaderDialogUtils.showMyDialog(context); @@ -238,7 +237,6 @@ class _ConfirmPaymentPageState extends State { } startApplePay() { - // GifLoaderDialogUtils.showMyDialog(context); ApplePayResponse applePayResponse; var _paymentItems = [ PaymentItem( diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index 4b5f951d..3a611a20 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -384,10 +384,9 @@ class PrescriptionItemsPage extends StatelessWidget { padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), child: DefaultButton( TranslationBase.of(context).resendOrder, - // ((!projectViewModel.havePrivilege(62)) || projectViewModel.user.outSA == 1 || model.isMedDeliveryAllowed == false) - // ? null - // : - () => { + model.isMedDeliveryAllowed == false + ? null + : () => { Navigator.push( context, FadePage( diff --git a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart index 156fb55a..38da7db3 100644 --- a/lib/pages/medical/smart_watch_health_data/syncHealthData.dart +++ b/lib/pages/medical/smart_watch_health_data/syncHealthData.dart @@ -51,14 +51,14 @@ class _syncHealthDataButtonState extends State { if (Platform.isAndroid) { if (await PermissionService.isHealthDataPermissionEnabled()) { await health.requestAuthorization(types).then((value) { - if(value) { + if (value) { readAll(); } }); } else { Utils.showPermissionConsentDialog(context, TranslationBase.of(context).physicalActivityPermission, () async { await health.requestAuthorization(types).then((value) { - if(value) { + if (value) { readAll(); } }); @@ -66,7 +66,7 @@ class _syncHealthDataButtonState extends State { } } else { await health.requestAuthorization(types).then((value) { - if(value) { + if (value) { readAll(); } }); @@ -82,8 +82,6 @@ class _syncHealthDataButtonState extends State { Med_InsertTransactionsInputsList.clear(); DateTime startDate = DateTime.now().subtract(new Duration(days: 30)); - await checkPermissions(); - try { List healthData = await health.getHealthDataFromTypes(startDate, DateTime.now(), types); _healthDataList.addAll(healthData); diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index 0abfb7be..b30960b4 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -201,6 +201,7 @@ class LiveCareService extends BaseService { Map request; String deviceToken; + String voipToken = await sharedPref.getString(APNS_TOKEN); getDeviceToken().then((value) { print(value); deviceToken = value; @@ -215,7 +216,7 @@ class LiveCareService extends BaseService { "ErServiceID": serviceID, "ClientRequestID": clientRequestID, "DeviceToken": deviceToken, - "VoipToken": "", + "VoipToken": voipToken, "IsFlutter": true, "Latitude": await this.sharedPref.getDouble(USER_LAT), "Longitude": await this.sharedPref.getDouble(USER_LONG), diff --git a/lib/uitl/CalendarUtils.dart b/lib/uitl/CalendarUtils.dart index ee602391..ae943617 100644 --- a/lib/uitl/CalendarUtils.dart +++ b/lib/uitl/CalendarUtils.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:ui'; import 'package:device_calendar/device_calendar.dart'; +import 'package:timezone/timezone.dart'; final DeviceCalendarPlugin deviceCalendarPlugin = DeviceCalendarPlugin(); @@ -52,8 +53,17 @@ class CalendarUtils { // daysOfWeek: daysOfWeek, endDate: scheduleDateTime, ); + + Location _currentLocation; + if (DateTime.now().timeZoneName == "+04") + _currentLocation = getLocation('Asia/Dubai'); + else + _currentLocation = getLocation('Asia/Riyadh'); + + TZDateTime scheduleDateTimeUTZ = TZDateTime.from(scheduleDateTime, _currentLocation); + print("eventId " + eventId); - Event event = Event(writableCalendars.id, recurrenceRule: recurrenceRule, start: scheduleDateTime, end: scheduleDateTime.add(Duration(minutes: 30)), title: title, description: description); + Event event = Event(writableCalendars.id, recurrenceRule: recurrenceRule, start: scheduleDateTimeUTZ, end: scheduleDateTimeUTZ.add(Duration(minutes: 30)), title: title, description: description); deviceCalendarPlugin.createOrUpdateEvent(event).catchError((e) { print("catchError " + e.toString()); }).whenComplete(() { diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index 7b0dfcaa..1c9db2f5 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -7,7 +7,7 @@ class DateUtil { static DateTime convertStringToDate(String date) { if (date != null) { const start = "/Date("; - const end = "+0300)/"; + const end = "+0300)"; final startIndex = date.indexOf(start); final endIndex = date.indexOf(end, startIndex + start.length); return DateTime.fromMillisecondsSinceEpoch( diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart index 7d31f484..a6f43184 100644 --- a/lib/uitl/push-notification-handler.dart +++ b/lib/uitl/push-notification-handler.dart @@ -151,70 +151,77 @@ class PushNotificationHandler { init() async { // VoIP Callbacks - // voIPKit.getVoIPToken().then((value) { - // print('🎈 example: getVoIPToken: $value'); - // // sharedPref.setString("VOIPToken", value); - // }); - // - // voIPKit.onDidReceiveIncomingPush = ( - // Map payload, - // ) async { - // print('🎈 example: onDidReceiveIncomingPush $payload'); - // _timeOut(); - // }; - // - // voIPKit.onDidRejectIncomingCall = ( - // String uuid, - // String callerId, - // ) { - // if (isTalking) { - // return; - // } - // - // print('🎈 example: onDidRejectIncomingCall $uuid, $callerId'); - // voIPKit.endCall(); - // timeOutTimer?.cancel(); - // - // // setState(() { - // // isTalking = false; - // // }); - // }; - // - // voIPKit.onDidAcceptIncomingCall = ( - // String uuid, - // String callerId, - // ) { - // // print('🎈 example: isTalking $isTalking'); - // // if (isTalking) { - // // return; - // // } - // - // print('🎈 example: onDidAcceptIncomingCall $uuid, $callerId'); - // - // String sessionID = callerId.split("*")[0]; - // String token = callerId.split("*")[1]; - // - // print("🎈 SessionID: $sessionID"); - // print("🎈 Token: $token"); - // - // voIPKit.acceptIncomingCall(callerState: CallStateType.calling); - // voIPKit.callConnected(); - // timeOutTimer?.cancel(); - // - // print("🎈 CALL ACCEPTED!!!"); - // - // Future.delayed(new Duration(milliseconds: 1000)).then((value) async { - // print("🎈 Incoming Call!!!"); - // callPage(sessionID, token); - // }); - // - // // print("🎈 Identity: $identity"); - // // print("🎈 Name: $name"); - // - // // setState(() { - // // isTalking = true; - // // }); - // }; + voIPKit.getVoIPToken().then((value) { + print('🎈 example: getVoIPToken: $value'); + AppSharedPreferences().setString(APNS_TOKEN, value); + }); + + voIPKit.onDidUpdatePushToken = ( + String token, + ) { + print('🎈 example: onDidUpdatePushToken: $token'); + AppSharedPreferences().setString(APNS_TOKEN, token); + }; + + voIPKit.onDidReceiveIncomingPush = ( + Map payload, + ) async { + print('🎈 example: onDidReceiveIncomingPush $payload'); + _timeOut(); + }; + + voIPKit.onDidRejectIncomingCall = ( + String uuid, + String callerId, + ) { + if (isTalking) { + return; + } + + print('🎈 example: onDidRejectIncomingCall $uuid, $callerId'); + voIPKit.endCall(); + timeOutTimer?.cancel(); + + // setState(() { + // isTalking = false; + // }); + }; + + voIPKit.onDidAcceptIncomingCall = ( + String uuid, + String callerId, + ) { + // print('🎈 example: isTalking $isTalking'); + // if (isTalking) { + // return; + // } + + print('🎈 example: onDidAcceptIncomingCall $uuid, $callerId'); + + String sessionID = callerId.split("*")[0]; + String token = callerId.split("*")[1]; + + print("🎈 SessionID: $sessionID"); + print("🎈 Token: $token"); + + voIPKit.acceptIncomingCall(callerState: CallStateType.calling); + voIPKit.callConnected(); + timeOutTimer?.cancel(); + + print("🎈 CALL ACCEPTED!!!"); + + Future.delayed(new Duration(milliseconds: 2000)).then((value) async { + print("🎈 Incoming Call!!!"); + callPage(sessionID, token); + }); + + // print("🎈 Identity: $identity"); + // print("🎈 Name: $name"); + + // setState(() { + // isTalking = true; + // }); + }; if (Platform.isAndroid && (!await FlutterHmsGmsAvailability.isHmsAvailable)) { final fcmToken = await FirebaseMessaging.instance.getToken(); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 2930d0fd..1a537ab2 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2847,6 +2847,7 @@ class TranslationBase { String get bluetoothPermission => localizedValues["bluetoothPermission"][locale.languageCode]; String get privacyPolicy => localizedValues["privacyPolicy"][locale.languageCode]; String get termsConditions => localizedValues["termsConditions"][locale.languageCode]; + String get liveCarePermissions => localizedValues["liveCarePermissions"][locale.languageCode]; } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index da65edbd..4fa4057a 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -165,7 +165,7 @@ class Utils { } String loginIDPattern(loginType) { - var length = loginType == 1 ? 10 : 4; + var length = loginType == 1 ? 10 : 1; return "([0-9]{" + length.toString() + "})"; } diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index 5ccffc59..e20bd015 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -24,13 +24,14 @@ var _InAppBrowserOptions = InAppBrowserClassOptions( crossPlatform: InAppBrowserOptions(hideUrlBar: true), ios: IOSInAppBrowserOptions( hideToolbarBottom: false, + toolbarBottomBackgroundColor: Colors.white, )); class MyInAppBrowser extends InAppBrowser { _PAYMENT_TYPE paymentType; - static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE - // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWeb/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT + // static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL LIVE + static String APPLE_PAY_PAYFORT_URL = 'https://hmgwebservices.com/PayFortWeb/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT @@ -247,6 +248,7 @@ class MyInAppBrowser extends InAppBrowser { form = form.replaceFirst('PATIENT_OUT_SA', authUser.outSA == 0 ? false.toString() : true.toString()); form = form.replaceFirst('PATIENT_TYPE_ID', patientData == null ? patientType.toString() : "1"); + // form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN) + "," + await sharedPref.getString(APNS_TOKEN)); form = form.replaceFirst('DEVICE_TOKEN', await sharedPref.getString(PUSH_TOKEN)); form = form.replaceFirst('LATITUDE_VALUE', this.lat.toString()); form = form.replaceFirst('LONGITUDE_VALUE', this.long.toString());