From 420aef3195bc8510b4c009c98b4f6bfa91491697 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 31 May 2023 16:28:09 +0300 Subject: [PATCH 01/17] Updates --- lib/config/localized_values.dart | 6 ++--- .../labs/request_send_lab_report_email.dart | 6 ++++- lib/core/service/medical/labs_service.dart | 1 + .../fragments/home_page_fragment2.dart | 24 +++++++++---------- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 9737f921..d64a2fe6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -326,8 +326,8 @@ const Map localizedValues = { "nearester": {"en": "Nearest ER", "ar": "أقرب طوارى"}, "locationa": {"en": "Location", "ar": "الموقع"}, "call_now": {"en": "Call now", "ar": "اتصل الان"}, - "ambulancerequest": {"en": "Ambulance", "ar": "طلب نقل "}, - "requestA": {"en": "Request", "ar": "اسعاف"}, + "ambulancerequest": {"en": "Ambulance", "ar": "خدمات النقل "}, + "requestA": {"en": "Request", "ar": "الاسعافي"}, "NoBookedAppointments": {"en": "No Booked Appointments", "ar": "لا توجد مواعيد محجوزة"}, "NoConfirmedAppointments": {"en": "No Confirmed Appointments", "ar": "لا توجد مواعيد مؤكدة"}, "noArrivedAppointments": {"en": "No Arrived Appointments", "ar": "لم يتم حضورها"}, @@ -926,7 +926,7 @@ const Map localizedValues = { "ar": "تعرض هذه الخدمة أقرب فرع من بين جميع فروع مجموعة الحبيب الطبية بناءً على موقعك الحالي." }, "er": {"en": "ER", "ar": "الطوارىء"}, - "transportation-Service": {"en": "Ambulance Request", "ar": "طلب نقل اسعاف"}, + "transportation-Service": {"en": "Ambulance Request", "ar": "خدمات النقل الاسعافي"}, "info-ambulance": { "en": "Through this service, you can request evacuation by ambulance, whether from home or to home, in addition to a set of other services", "ar": "عن طريق هذه الخدمة يمكنك طلب اخلاء بواسطة سيارة اسعاف سواء من المزل او الى المنزل بالاضافة الى مجموعة من الخدمات الاخرى" diff --git a/lib/core/model/labs/request_send_lab_report_email.dart b/lib/core/model/labs/request_send_lab_report_email.dart index 118da906..65ac1762 100644 --- a/lib/core/model/labs/request_send_lab_report_email.dart +++ b/lib/core/model/labs/request_send_lab_report_email.dart @@ -24,6 +24,7 @@ class RequestSendLabReportEmail { String projectID; String invoiceNo; String orderDate; + String orderNo; RequestSendLabReportEmail( {this.versionID, @@ -50,7 +51,8 @@ class RequestSendLabReportEmail { this.doctorName, this.projectID, this.invoiceNo, - this.orderDate}); + this.orderDate, + this.orderNo}); RequestSendLabReportEmail.fromJson(Map json) { versionID = json['VersionID']; @@ -78,6 +80,7 @@ class RequestSendLabReportEmail { projectID = json['ProjectID']; invoiceNo = json['InvoiceNo']; orderDate = json['OrderDate']; + orderNo = json['OrderNo']; } Map toJson() { @@ -107,6 +110,7 @@ class RequestSendLabReportEmail { data['ProjectID'] = this.projectID; data['InvoiceNo'] = this.invoiceNo; data['OrderDate'] = this.orderDate; + data['OrderNo'] = this.orderNo; return data; } } diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 484bfff8..078703df 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -189,6 +189,7 @@ class LabsService extends BaseService { _requestSendLabReportEmail.patientMobileNumber = userObj.mobileNumber; _requestSendLabReportEmail.projectName = patientLabOrder.projectName; _requestSendLabReportEmail.setupID = patientLabOrder.setupID; + _requestSendLabReportEmail.orderNo = patientLabOrder.orderNo; await baseAppClient.post(SEND_LAB_RESULT_EMAIL, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/pages/landing/fragments/home_page_fragment2.dart b/lib/pages/landing/fragments/home_page_fragment2.dart index bb7a4156..207310b4 100644 --- a/lib/pages/landing/fragments/home_page_fragment2.dart +++ b/lib/pages/landing/fragments/home_page_fragment2.dart @@ -394,18 +394,18 @@ class _HomePageFragment2State extends State { ], ), ), - projectViewModel.havePrivilege(82) || bypassPrivilageCheck - ? Container() - : Container( - width: double.infinity, - height: double.infinity, - clipBehavior: Clip.antiAlias, - decoration: containerRadiusWithGradientServices(20, lightColor: CustomColors.lightGreyColor.withOpacity(0.7), darkColor: CustomColors.lightGreyColor.withOpacity(0.7)), - child: Icon( - Icons.lock_outline, - size: 40, - ), - ) + // projectViewModel.havePrivilege(82) || bypassPrivilageCheck + // ? Container() + // : Container( + // width: double.infinity, + // height: double.infinity, + // clipBehavior: Clip.antiAlias, + // decoration: containerRadiusWithGradientServices(20, lightColor: CustomColors.lightGreyColor.withOpacity(0.7), darkColor: CustomColors.lightGreyColor.withOpacity(0.7)), + // child: Icon( + // Icons.lock_outline, + // size: 40, + // ), + // ) ], ), ), From 2d93b9753d18aede53894b2c23f92942958dd4f8 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 12 Jun 2023 16:13:12 +0300 Subject: [PATCH 02/17] Ask doctor improvements --- lib/config/config.dart | 4 ++ .../service/medical/ask_doctor_services.dart | 69 ++++++++++--------- .../medical/ask_doctor_view_model.dart | 11 +++ .../medical/ask_doctor/request_type.dart | 4 +- lib/widgets/in_app_browser/InAppBrowser.dart | 4 +- 5 files changed, 57 insertions(+), 35 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index b84ee11e..5ff4e6f1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -400,6 +400,8 @@ var ADD_ACTIVE_PRESCRIPTIONS_REPORT_BY_PATIENT_ID = 'Services/Patients.svc/Rest/ var GET_CALL_INFO_HOURS_RESULT = 'Services/Doctors.svc/REST/GetCallInfoHoursResult'; var GET_CALL_REQUEST_TYPE_LOV = 'Services/Doctors.svc/REST/GetCallRequestType_LOV'; +var GET_QUESTION_TYPES = 'Services/OUTPs.svc/REST/getQuestionsTypes'; + var UPDATE_DIABETIC_RESULT = 'Services/Patients.svc/REST/Patient_UpdateDiabeticResult'; var SEND_AVERAGE_BLOOD_SUGAR_REPORT = 'Services/Notifications.svc/REST/SendAverageBloodSugarReport'; @@ -414,7 +416,9 @@ var UPDATE_WEIGHT_PRESSURE_RESULT = 'Services/Patients.svc/REST/Patient_UpdateWe var DEACTIVATE_WEIGHT_PRESSURE_RESULT = 'services/Patients.svc/REST/Patient_DeactivateWeightMeasurementStatus'; var GET_DOCTOR_RESPONSE = 'Services/Patients.svc/REST/GetDoctorResponse'; var UPDATE_READ_STATUS = 'Services/Patients.svc/REST/UpdateReadStatus'; + var INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo'; +var INSERT_APPOINTMENT_QUESTION = 'Services/OUTPs.svc/REST/insertAppointmentQuestion'; var GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; diff --git a/lib/core/service/medical/ask_doctor_services.dart b/lib/core/service/medical/ask_doctor_services.dart index 57ab856b..80ee3e6d 100644 --- a/lib/core/service/medical/ask_doctor_services.dart +++ b/lib/core/service/medical/ask_doctor_services.dart @@ -18,9 +18,8 @@ class AskDoctorService extends BaseService { dynamic localRes; - await baseAppClient.post(GET_CALL_INFO_HOURS_RESULT, - onSuccess: (dynamic response, int statusCode) { - localRes = response; + await baseAppClient.post(GET_CALL_INFO_HOURS_RESULT, onSuccess: (dynamic response, int statusCode) { + localRes = response; }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; @@ -29,11 +28,10 @@ class AskDoctorService extends BaseService { } Future getCallRequestTypeLOV() async { - hasError =false; + hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; - await baseAppClient.post(GET_CALL_REQUEST_TYPE_LOV, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_CALL_REQUEST_TYPE_LOV, onSuccess: (dynamic response, int statusCode) { askDoctorReqTypes.clear(); response['ListReqTypes'].forEach((reqType) { askDoctorReqTypes.add(AskDoctorReqTypes.fromJson(reqType)); @@ -44,16 +42,28 @@ class AskDoctorService extends BaseService { }, body: body); } + Future getQuestionTypes() async { + hasError = false; + Map body = Map(); + body['isDentalAllowedBackend'] = false; + await baseAppClient.post(GET_QUESTION_TYPES, onSuccess: (dynamic response, int statusCode) { + askDoctorReqTypes.clear(); + response['QuestionsTypes'].forEach((reqType) { + askDoctorReqTypes.add(AskDoctorReqTypes.fromJson(reqType)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + } + Future getDoctorResponse() async { - hasError =false; + hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; - body['from'] = - "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} 00:00:00"; - body['from'] = - "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}:00"; - await baseAppClient.post(GET_DOCTOR_RESPONSE, - onSuccess: (dynamic response, int statusCode) { + body['from'] = "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} 00:00:00"; + body['from'] = "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} ${DateTime.now().hour}:${DateTime.now().minute}:00"; + await baseAppClient.post(GET_DOCTOR_RESPONSE, onSuccess: (dynamic response, int statusCode) { doctorResponseList.clear(); response['List_DoctorResponse'].forEach((reqType) { doctorResponseList.add(DoctorResponse.fromJson(reqType)); @@ -65,12 +75,11 @@ class AskDoctorService extends BaseService { } Future updateReadStatus({int transactionNo}) async { - hasError =false; + hasError = false; Map body = Map(); body['isDentalAllowedBackend'] = false; body['TransactionNo'] = transactionNo; - await baseAppClient.post(UPDATE_READ_STATUS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(UPDATE_READ_STATUS, onSuccess: (dynamic response, int statusCode) { //TODO fix it }, onFailure: (String error, int statusCode) { hasError = true; @@ -78,31 +87,27 @@ class AskDoctorService extends BaseService { }, body: body); } - - Future sendRequestLOV({DoctorList doctorList,String requestType,String remark}) async { - hasError =false; + Future sendRequestLOV({DoctorList doctorList, String requestType, String remark}) async { + hasError = false; Map body = Map(); body['ProjectID'] = doctorList.projectID; body['SetupID'] = doctorList.setupID; body['DoctorID'] = doctorList.doctorID; body['PatientMobileNumber'] = user.mobileNumber; body['IsMessageSent'] = false; - body['RequestDate'] = DateUtil.yearMonthDay(DateTime.now()); - body['RequestTime'] = DateUtil.time(DateTime.now()); + body['RequestDate'] = DateUtil.convertDateToString(DateTime.now()); + body['RequestTime'] = DateUtil.convertDateToString(DateTime.now()); body['Remarks'] = remark; - body['Status'] = 2;// 4 for testing only.."cancelled status insert" else should be changed to 1 in live version + body['Status'] = 2; // 4 for testing only.."cancelled status insert" else should be changed to 1 in live version body['CreatedBy'] = 102; - body['CreatedOn'] = DateUtil.yearMonthDay(DateTime.now()); + body['CreatedOn'] = DateUtil.convertDateToString(DateTime.now()); body['EditedBy'] = 102; - body['EditedOn'] = DateUtil.yearMonthDay(DateTime.now()); + body['EditedOn'] = DateUtil.convertDateToString(DateTime.now()); body['isDentalAllowedBackend'] = false; - await baseAppClient.post(INSERT_CALL_INFO, - onSuccess: (dynamic response, int statusCode) { - - }, onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + body['QuestionType'] = num.parse(requestType); + await baseAppClient.post(INSERT_APPOINTMENT_QUESTION, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } - } diff --git a/lib/core/viewModels/medical/ask_doctor_view_model.dart b/lib/core/viewModels/medical/ask_doctor_view_model.dart index d060db1f..abe2220c 100644 --- a/lib/core/viewModels/medical/ask_doctor_view_model.dart +++ b/lib/core/viewModels/medical/ask_doctor_view_model.dart @@ -54,6 +54,17 @@ class AskDoctorViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getQuestionTypes() async { + setState(ViewState.Busy); + await _askDoctorService.getQuestionTypes(); + if (_askDoctorService.hasError) { + error = _askDoctorService.error; + setState(ViewState.ErrorLocal); + AppToast.showErrorToast(message: error); + } else + setState(ViewState.Idle); + } + Future getCallInfoHoursResult({int projectId, int doctorId}) async { setState(ViewState.Busy); await _askDoctorService.getCallInfoHoursResult(projectId: projectId, doctorId: doctorId); diff --git a/lib/pages/medical/ask_doctor/request_type.dart b/lib/pages/medical/ask_doctor/request_type.dart index 66cd9344..4ceb5bf5 100644 --- a/lib/pages/medical/ask_doctor/request_type.dart +++ b/lib/pages/medical/ask_doctor/request_type.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/viewModels/medical/ask_doctor_view_mod import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; @@ -26,7 +27,7 @@ class _RequestTypePageState extends State { @override Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => model.getCallRequestTypeLOVs(), + onModelReady: (model) => model.getQuestionTypes(), builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).requestType, @@ -111,6 +112,7 @@ class _RequestTypePageState extends State { model.sendRequestLOV(doctorList: widget.doctorList, requestType: parameterCode.toString(), remark: question).then((value) { if (model.state != ViewState.ErrorLocal || model.state != ViewState.Error) { Navigator.pop(context); + AppToast.showSuccessToast(message: TranslationBase.of(context).RRTRequestSuccess); } }) }, diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index e91990b4..f62248b8 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -37,9 +37,9 @@ class MyInAppBrowser extends InAppBrowser { // 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/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS From 3fda1da16aca17aba502f56abd04044304ff74a6 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 18 Jun 2023 20:23:57 +0300 Subject: [PATCH 03/17] updates --- lib/core/service/medical/ask_doctor_services.dart | 5 ++++- lib/models/Appointments/DoctorListResponse.dart | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/core/service/medical/ask_doctor_services.dart b/lib/core/service/medical/ask_doctor_services.dart index 80ee3e6d..84c4f9d1 100644 --- a/lib/core/service/medical/ask_doctor_services.dart +++ b/lib/core/service/medical/ask_doctor_services.dart @@ -104,8 +104,11 @@ class AskDoctorService extends BaseService { body['EditedBy'] = 102; body['EditedOn'] = DateUtil.convertDateToString(DateTime.now()); body['isDentalAllowedBackend'] = false; + body['AppointmentNo'] = doctorList.appointmentNo; + body['ClinicID'] = doctorList.clinicID; body['QuestionType'] = num.parse(requestType); - await baseAppClient.post(INSERT_APPOINTMENT_QUESTION, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + + await baseAppClient.post(INSERT_CALL_INFO, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); diff --git a/lib/models/Appointments/DoctorListResponse.dart b/lib/models/Appointments/DoctorListResponse.dart index 122f560f..f7a19c3a 100644 --- a/lib/models/Appointments/DoctorListResponse.dart +++ b/lib/models/Appointments/DoctorListResponse.dart @@ -1,5 +1,6 @@ class DoctorList { num clinicID; + dynamic appointmentNo; String clinicName; String doctorTitle; num iD; @@ -45,6 +46,7 @@ class DoctorList { DoctorList( {this.clinicID, + this.appointmentNo, this.clinicName, this.doctorTitle, this.iD, @@ -90,6 +92,7 @@ class DoctorList { DoctorList.fromJson(Map json) { clinicID = json['ClinicID']; + appointmentNo = json['AppointmentNo']; clinicName = json['ClinicName']; doctorTitle = json['DoctorTitle']; iD = json['ID']; @@ -138,6 +141,7 @@ class DoctorList { Map toJson() { final Map data = new Map(); data['ClinicID'] = this.clinicID; + data['AppointmentNo'] = this.appointmentNo; data['ClinicName'] = this.clinicName; data['DoctorTitle'] = this.doctorTitle; data['ID'] = this.iD; From f29d33d7e781bc18a6015d6466aa0fa3daa0df25 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Tue, 20 Jun 2023 12:43:44 +0300 Subject: [PATCH 04/17] Changes for voice command search --- .../others/floating_button_search.dart | 163 ++++++++++-------- pubspec.yaml | 41 +++-- .../lib/speech_recognition_error.dart | 1 + 3 files changed, 116 insertions(+), 89 deletions(-) diff --git a/lib/widgets/others/floating_button_search.dart b/lib/widgets/others/floating_button_search.dart index 5a571df8..8e5c16b5 100644 --- a/lib/widgets/others/floating_button_search.dart +++ b/lib/widgets/others/floating_button_search.dart @@ -66,8 +66,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_tts/flutter_tts.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; -// import 'package:speech_to_text/speech_recognition_error.dart'; -// import 'package:speech_to_text/speech_to_text.dart' as stt; +import 'package:speech_to_text/speech_recognition_error.dart'; +import 'package:speech_to_text/speech_to_text.dart' as stt; +import 'package:speech_to_text/speech_to_text.dart'; import 'package:url_launcher/url_launcher.dart'; class FloatingSearchButton extends StatefulWidget { @@ -83,7 +84,8 @@ class _FloatingSearchButton extends State with TickerProvi RobotProvider eventProvider = RobotProvider(); bool isLoading = false; bool isError = false; - // stt.SpeechToText speech = stt.SpeechToText(); + stt.SpeechToText speech = stt.SpeechToText(); + FlutterTts tts = FlutterTts(); String error = ''; String _currentLocaleId = ""; String lastError; @@ -92,7 +94,6 @@ class _FloatingSearchButton extends State with TickerProvi double minSoundLevel = 50000; double maxSoundLevel = -50000; String reconizedWord = ''; - FlutterTts flutterTts = FlutterTts(); var selectedLang; bool isSearching = false; Map results = {}; @@ -113,7 +114,7 @@ class _FloatingSearchButton extends State with TickerProvi void initState() { controller = AnimationController(vsync: this, duration: Duration(seconds: 1)); offset = Tween(begin: Offset(0.0, 1.0), end: Offset(0.0, 0.0)).animate(controller); - + startIosTts(); if (IS_VOICE_COMMAND_CLOSED == true) { controller.reverse(from: -1); } else { @@ -192,20 +193,20 @@ class _FloatingSearchButton extends State with TickerProvi : Image.asset('assets/images/gif/robot-idle.gif'), ), onTap: () async { - // if (Platform.isAndroid) { - // if (await PermissionService.isMicrophonePermissionEnabled()) { - // new RoboSearch(context: context).showAlertDialog(context); - // initSpeechState().then((value) => {startVoiceSearch()}); - // } else { - // Utils.showPermissionConsentDialog(context, TranslationBase.of(context).recordAudioPermission, () { - // new RoboSearch(context: context).showAlertDialog(context); - // initSpeechState().then((value) => {startVoiceSearch()}); - // }); - // } - // } else { - // new RoboSearch(context: context).showAlertDialog(context); - // initSpeechState().then((value) => {startVoiceSearch()}); - // } + if (Platform.isAndroid) { + if (await PermissionService.isMicrophonePermissionEnabled()) { + new RoboSearch(context: context).showAlertDialog(context); + initSpeechState().then((value) => {startVoiceSearch()}); + } else { + Utils.showPermissionConsentDialog(context, TranslationBase.of(context).recordAudioPermission, () { + new RoboSearch(context: context).showAlertDialog(context); + initSpeechState().then((value) => {startVoiceSearch()}); + }); + } + } else { + new RoboSearch(context: context).showAlertDialog(context); + initSpeechState().then((value) => {startVoiceSearch()}); + } }, ), Positioned( @@ -234,44 +235,60 @@ class _FloatingSearchButton extends State with TickerProvi ])); } - // startVoiceSearch() async { - // bool available = await speech.initialize(onStatus: statusListener, onError: errorListener); - // _currentLocaleId = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - // - // if (available) { - // speech.listen( - // onResult: resultListener, - // //listenMode: ListenMode.confirmation, - // localeId: _currentLocaleId == 'en' ? 'en_US' : 'ar_SA', - // ); - // } else { - // print("The user has denied the use of speech recognition."); - // } - // // some time later... - // //speech.stop(); - // // speech.listen( - // // onResult: resultListener, - // // listenFor: Duration(seconds: 10), - // // localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', - // // onSoundLevelChange: soundLevelListener, - // // cancelOnError: true, - // // partialResults: true, - // // onDevice: true, - // // listenMode: ListenMode.deviceDefault); - // } + + startIosTts() async{ + await tts.setSharedInstance(true); + await tts.setLanguage("en-US"); + tts.setIosAudioCategory( + IosTextToSpeechAudioCategory.playback, + [IosTextToSpeechAudioCategoryOptions.mixWithOthers], + IosTextToSpeechAudioMode.voicePrompt); + } + startVoiceSearch() async { + bool available = await speech.initialize(); + _currentLocaleId = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + // + // if (available) { + // speech.listen( + // onResult: resultListener, + // //listenMode: ListenMode.confirmation, + // localeId: _currentLocaleId == 'en' ? 'en_US' : 'ar_SA', + // ); + // } else { + // print("The user has denied the use of speech recognition."); + // } + // some time later... + if(available) { + speech.stop(); + speech.listen( + onResult: resultListener, + listenFor: Duration(seconds: 10), + localeId: _currentLocaleId == 'en' ? 'en-US' : 'ar-SA', + onSoundLevelChange: soundLevelListener, + cancelOnError: true, + partialResults: true, + onDevice: true, + listenMode: ListenMode.deviceDefault); + } + } void resultListener(result) { + _stopListening(); reconizedWord = result.recognizedWords; event.setValue({"searchText": reconizedWord}); if (result.finalResult == true) { Future.delayed(const Duration(seconds: 1), () { + _speak(reconizedWord); - RoboSearch.closeAlertDialog(context); + RoboSearch.closeAlertDialog(context); //Navigator.of(context).pop(); }); } } - + void _stopListening() async { + await speech.stop(); + // setState(() {}); + } Future _speak(reconizedWord) async { getPages(reconizedWord); } @@ -315,10 +332,10 @@ class _FloatingSearchButton extends State with TickerProvi // }); } - // void errorListener(SpeechRecognitionError error) { - // event.setValue({"searchText": 'null'}); - // RoboSearch.closeAlertDialog(context); - // } + void errorListener(SpeechRecognitionError error) { + event.setValue({"searchText": 'null'}); + RoboSearch.closeAlertDialog(context); + } void statusListener(String status) { //setState(() { @@ -807,7 +824,7 @@ class _FloatingSearchButton extends State with TickerProvi ); } - speak({isInit}) async { + speak({isInit =false}) async { //if (mounted) { setState(() { this.networkImage = results['AnimationURL']; @@ -817,12 +834,18 @@ class _FloatingSearchButton extends State with TickerProvi if (isInit == true) { event.setValue({"animationEnable": 'true'}); } + + // var voice = await tts.getVoice(); + // print(voice); if (isArabic == false && results['ReturnMessage'] != null && isInit == false) { - await flutterTts.setVoice({"name": "en-au-x-aub-network", "locale": "en-AU"}); - await flutterTts.speak(results['ReturnMessage']); + // await tts.synthesizeToFile("Hello World", Platform.isAndroid ? "tts.wav" : "tts.caf"); + + await tts.setVoice({"name": "Karen", "locale": "en-AU"}); + // await tts.setVoice({"name" : voice[35]["name"],"locale": voice[35]["locale"]}); + await tts.speak(results['ReturnMessage']); } else if (results['ReturnMessage_Ar'] != null && isInit == false) { - await flutterTts.setVoice({"name": "ar-xa-x-ard-network", "locale": "ar"}); - await flutterTts.speak(results['ReturnMessage_Ar']); + //await tts.setVoice({"name" : voice[0]["name"],"locale": voice[0]["locale"]}); + await tts.speak(results['ReturnMessage_Ar']); } stopAnimation(isInit: isInit); @@ -850,7 +873,7 @@ class _FloatingSearchButton extends State with TickerProvi } initialSpeak() async { - await flutterTts.awaitSpeakCompletion(true); + // await flutterTts.awaitSpeakCompletion(true); results = { 'ReturnMessage_Ar': "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي.", 'ReturnMessage': "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file." @@ -875,21 +898,21 @@ class _FloatingSearchButton extends State with TickerProvi }); }); } else { - flutterTts.setCompletionHandler(() async { - event.setValue({"animationEnable": 'false'}); - setState(() { - this.networkImage = null; - this.isAnimationEnable = false; - }); - }); + // tts.setCompletionHandler(() async { + // event.setValue({"animationEnable": 'false'}); + // setState(() { + // this.networkImage = null; + // this.isAnimationEnable = false; + // }); + // }); } - flutterTts.setCompletionHandler(() async { - event.setValue({"animationEnable": 'false'}); - setState(() { - this.networkImage = null; - this.isAnimationEnable = false; - }); - }); + // flutterTts.setCompletionHandler(() async { + // event.setValue({"animationEnable": 'false'}); + // setState(() { + // this.networkImage = null; + // this.isAnimationEnable = false; + // }); + // }); } signOut() async { diff --git a/pubspec.yaml b/pubspec.yaml index a7222ce6..970ebdcc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.61+1 +version: 4.5.64+1 environment: sdk: ">=2.7.0 <3.0.0" @@ -15,7 +15,7 @@ dependencies: sdk: flutter intl: ^0.17.0 # web view -# webview_flutter: ^2.3.1 + # webview_flutter: ^2.3.1 # http client http: ^0.13.4 @@ -23,7 +23,7 @@ dependencies: async: ^2.8.1 audio_wave: ^0.1.4 -# audio_session: ^0.1.13 + # audio_session: ^0.1.13 # State Management provider: ^6.0.1 @@ -34,7 +34,7 @@ dependencies: health: ^3.0.3 #chart - fl_chart: ^0.40.2 + fl_chart: ^0.45.0 #Camera Preview camera: ^0.10.1 @@ -54,7 +54,7 @@ dependencies: maps_launcher: ^2.0.1 url_launcher: ^6.0.15 shared_preferences: ^2.0.0 -# flutter_flexible_toast: ^0.1.4 + # flutter_flexible_toast: ^0.1.4 fluttertoast: ^8.0.8 firebase_messaging: ^14.1.0 firebase_analytics: ^10.0.5 @@ -98,7 +98,7 @@ dependencies: flutter_polyline_points: ^1.0.0 location: ^4.3.0 # Qr code Scanner -# barcode_scan_fix: ^1.0.2 + # barcode_scan_fix: ^1.0.2 barcode_scan2: ^4.2.2 # Rating Stars @@ -108,7 +108,7 @@ dependencies: syncfusion_flutter_calendar: ^19.3.55 # SVG Images -# flutter_svg: ^0.23.0+1 + # flutter_svg: ^0.23.0+1 #Calendar Events manage_calendar_events: ^2.0.1 @@ -152,7 +152,7 @@ dependencies: #google maps places google_maps_place_picker_mb: ^3.0.0 -# google_maps_place_picker: ^2.1.0-nullsafety.3 + # google_maps_place_picker: ^2.1.0-nullsafety.3 map_launcher: ^1.1.3 #countdown timer for Upcoming List flutter_countdown_timer: ^4.1.0 @@ -161,23 +161,25 @@ dependencies: native_device_orientation: ^1.0.0 wakelock: ^0.5.6 after_layout: ^1.1.0 -# twilio_programmable_video: ^0.11.0+1 + # twilio_programmable_video: ^0.11.0+1 cached_network_image: ^3.1.0+1 -# flutter_tts: -# path: flutter_tts-voice_enhancement - flutter_tts: ^3.6.1 + # flutter_tts: + # path: flutter_tts-voice_enhancement + flutter_tts: ^3.7.0 wifi: ^0.1.5 vibration: ^1.7.3 flutter_nfc_kit: ^3.3.1 -# speech_to_text: ^6.1.1 -# path: speech_to_text + geofencing: ^0.1.0 - in_app_update: ^3.0.0 + speech_to_text: ^6.1.1 + # path: speech_to_text - in_app_review: ^2.0.3 + in_app_update: ^4.0.1 + + in_app_review: ^2.0.6 badges: ^2.0.1 flutter_app_icon_badge: ^2.0.0 @@ -191,7 +193,7 @@ dependencies: carousel_slider: ^4.0.0 flutter_material_pickers: ^3.1.2 flutter_staggered_grid_view: ^0.4.1 -# flutter_hms_gms_availability: ^2.0.0 + # flutter_hms_gms_availability: ^2.0.0 huawei_hmsavailability: ^6.6.0+300 huawei_location: 6.0.0+302 @@ -201,15 +203,16 @@ dependencies: equatable: ^2.0.3 signalr_core: ^1.1.1 wave: ^0.2.0 -# sms_retriever: ^1.0.0 + # sms_retriever: ^1.0.0 sms_otp_auto_verify: ^2.1.0 flutter_ios_voip_kit: ^0.0.5 google_api_availability: ^3.0.1 +# flutter_callkit_incoming: ^1.0.3+3 # firebase_core: 1.12.0 dependency_overrides: provider : ^5.0.0 -# permission_handler : ^10.2.0 + # permission_handler : ^10.2.0 flutter_svg: ^1.0.0 # firebase_messaging_platform_interface: any # flutter_inappwebview: 5.7.2+3 diff --git a/speech_to_text/lib/speech_recognition_error.dart b/speech_to_text/lib/speech_recognition_error.dart index 2ab6cd4d..1b47b0c9 100644 --- a/speech_to_text/lib/speech_recognition_error.dart +++ b/speech_to_text/lib/speech_recognition_error.dart @@ -1,5 +1,6 @@ import 'package:json_annotation/json_annotation.dart'; + part 'speech_recognition_error.g.dart'; /// A single error returned from the underlying speech services. From 6877244d0e385aebb4e7fe0d2348bcb4ab9f8385 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 2 Jul 2023 15:57:29 +0300 Subject: [PATCH 05/17] CR# 5805 Ask Doc Improvements dev completed. --- lib/config/config.dart | 1 + lib/config/localized_values.dart | 3 + .../service/medical/ask_doctor_services.dart | 33 +++ .../ask_doctor/ViewDoctorResponsesPage.dart | 248 +++++++++++++++++- .../medical/ask_doctor/doctor_response.dart | 20 +- lib/uitl/translations_delegate_base.dart | 3 + 6 files changed, 287 insertions(+), 21 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 5ff4e6f1..4981aca0 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -419,6 +419,7 @@ var UPDATE_READ_STATUS = 'Services/Patients.svc/REST/UpdateReadStatus'; var INSERT_CALL_INFO = 'Services/Doctors.svc/REST/InsertCallInfo'; var INSERT_APPOINTMENT_QUESTION = 'Services/OUTPs.svc/REST/insertAppointmentQuestion'; +var RATE_DOCTOR_RESPONSE = 'Services/OUTPs.svc/REST/insertAppointmentQuestionRating'; var GET_PATIENT_ALLERGIES = 'Services/Patients.svc/REST/GetPatientAllergies'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index d64a2fe6..f08b9c41 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1884,4 +1884,7 @@ const Map localizedValues = { "pharmaLiveCareJoinConsultation": {"en": "Join the virtual consultation from booth", "ar": "انضم إلى الاستشارة الافتراضية من الكبينة"}, "pharmaLiveCareJoinConsultation1": {"en": "Wait for the doctor in the pharma booth to join you", "ar": "انتظر حتى ينضم إليك الطبيب في كبينة لايف كير الصيدلية"}, "emergencyServicesSubtitle": {"en": "Always at your service", "ar": "في خدمتكم دائما"}, + "rateDoctorResponse": {"en": "Rate Doctor Response", "ar": "تقييم استجابة الطبيب"}, + "comments": {"en": "Comments", "ar": "تعليقات"}, + "rateDoctorResponseHeading": {"en": "Please rate the doctor response:", "ar": "يرجى تقييم استجابة الطبيب:"}, }; \ No newline at end of file diff --git a/lib/core/service/medical/ask_doctor_services.dart b/lib/core/service/medical/ask_doctor_services.dart index 84c4f9d1..a6482431 100644 --- a/lib/core/service/medical/ask_doctor_services.dart +++ b/lib/core/service/medical/ask_doctor_services.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/ask_doctor/AskDoctorReqTypes.dart'; import 'package:diplomaticquarterapp/core/model/ask_doctor/DoctorResponse.dart'; @@ -113,4 +115,35 @@ class AskDoctorService extends BaseService { super.error = error; }, body: body); } + + Future rateDoctorResponse({int transactionNo, int questionType, int rate, String notes, String mobileNo, String idNo, String patientName, int projectID, String language}) async { + hasError = false; + dynamic localRes; + Map body = Map(); + body['MobileNo'] = mobileNo; + body['IdentificationNo'] = idNo; + body['PatientName'] = patientName; + body['IsUserLoggedIn'] = true; + body['ProjectID'] = projectID; + body['UILanguage'] = language; + body['BrowserInfo'] = Platform.localHostname; + body['COCTypeName'] = 3; + body['FormTypeID'] = 3; + body['DeviceInfo'] = Platform.localHostname; + body['Resolution'] = "400x847"; + body['AppVersion'] = VERSION_ID; + body['ForDemo'] = false; + body['isVidaPlus'] = false; + body['TransactionNo'] = transactionNo; + body['QuestionType'] = questionType; + body['Rate'] = rate; + body['Notes'] = notes; + await baseAppClient.post(RATE_DOCTOR_RESPONSE, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + return Future.value(localRes); + } } diff --git a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index 489e9281..c6fdb47f 100644 --- a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart +++ b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart @@ -1,21 +1,39 @@ import 'package:diplomaticquarterapp/core/model/ask_doctor/DoctorResponse.dart'; +import 'package:diplomaticquarterapp/core/service/medical/ask_doctor_services.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/ask_doctor_view_model.dart'; +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; -class ViewDoctorResponsesPage extends StatelessWidget { +class ViewDoctorResponsesPage extends StatefulWidget { final DoctorResponse doctorResponse; const ViewDoctorResponsesPage({Key key, this.doctorResponse}) : super(key: key); + @override + State createState() => _ViewDoctorResponsesPageState(); +} + +class _ViewDoctorResponsesPageState extends State { + int rate = 1; + TextEditingController textController = new TextEditingController(); + ProjectViewModel projectViewModel; + @override Widget build(BuildContext context) { + projectViewModel = Provider.of(context); return BaseView( - onModelReady: (model) => model.updateReadStatus(transactionNo: doctorResponse.transactionNo), + onModelReady: (model) => model.updateReadStatus(transactionNo: widget.doctorResponse.transactionNo), builder: (_, model, w) => AppScaffold( isShowAppBar: true, showNewAppBar: true, @@ -44,7 +62,7 @@ class ViewDoctorResponsesPage extends StatelessWidget { itemBuilder: (context, _index) { return Container( padding: const EdgeInsets.only(left: 20, right: 12, top: 12, bottom: 12), - height: 130, + height: 160, decoration: BoxDecoration( borderRadius: BorderRadius.all( Radius.circular(10.0), @@ -64,7 +82,7 @@ class ViewDoctorResponsesPage extends StatelessWidget { children: [ Container( child: Text( - (doctorResponse.doctorName ?? ""), + (widget.doctorResponse.doctorName ?? ""), style: TextStyle( fontSize: 16, fontWeight: FontWeight.w600, @@ -75,7 +93,7 @@ class ViewDoctorResponsesPage extends StatelessWidget { ), Container( child: Text( - (DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(doctorResponse.createdOn)) ?? ""), + (DateUtil.getDayMonthYearDateFormatted(DateUtil.convertStringToDate(widget.doctorResponse.createdOn)) ?? ""), style: TextStyle( fontSize: 14, color: Color(0xff2E303A), @@ -86,7 +104,7 @@ class ViewDoctorResponsesPage extends StatelessWidget { Container( margin: EdgeInsets.only(top: 10.0), child: Text( - doctorResponse.transactions[_index]['InfoStatusDescription'], + widget.doctorResponse.transactions[_index]['DoctorResponse'], style: TextStyle( fontSize: 16, color: Color(0xff2E303A), @@ -94,11 +112,227 @@ class ViewDoctorResponsesPage extends StatelessWidget { ), ), ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: DefaultButton( + TranslationBase.of(context).rateDoctorResponse, + () { + openResponseRateDialog(context); + }, + color: CustomColors.accentColor, + ), + ), ], ), ); }, separatorBuilder: (context, index) => SizedBox(height: 14), - itemCount: doctorResponse.transactions.length); + itemCount: widget.doctorResponse.transactions.length); + } + + void openResponseRateDialog(BuildContext context) { + showModalBottomSheet( + context: context, + enableDrag: true, + isDismissible: true, + isScrollControlled: true, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.only(topLeft: Radius.circular(12), topRight: Radius.circular(12)), + ), + backgroundColor: Colors.white, + builder: (context) { + return StatefulBuilder(builder: (BuildContext context, StateSetter setState) { + return Container( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + height: 16.0, + ), + Text( + TranslationBase.of(context).rateDoctorResponseHeading, + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: Color(0xff2E303A), + letterSpacing: -0.64, + ), + ), + Padding( + padding: const EdgeInsets.all(24.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Container( + margin: rate == 1 ? EdgeInsets.only(left: 3.0, right: 3.0) : EdgeInsets.only(left: 0.0, right: 0.0), + decoration: rate == 1 + ? BoxDecoration(borderRadius: BorderRadius.circular(100), border: Border.all(width: 3, color: CustomColors.green)) + : BoxDecoration(borderRadius: BorderRadius.circular(100), border: Border.all(width: 3, color: CustomColors.white)), + child: IconButton( + onPressed: () { + rate = 1; + setState(() {}); + }, + iconSize: 35, + icon: SvgPicture.asset('assets/images/new/appointment-rating/5.svg'), + ), + ), + Container( + margin: rate == 0 ? EdgeInsets.only(left: 3.0, right: 3.0) : EdgeInsets.only(left: 0.0, right: 0.0), + decoration: rate == 0 + ? BoxDecoration(borderRadius: BorderRadius.circular(100), border: Border.all(width: 3, color: CustomColors.green)) + : BoxDecoration(borderRadius: BorderRadius.circular(100), border: Border.all(width: 3, color: CustomColors.white)), + child: IconButton( + onPressed: () { + rate = 0; + setState(() {}); + }, + iconSize: 35, + icon: SvgPicture.asset('assets/images/new/appointment-rating/1.svg'), + ), + ), + ], + ), + ), + if (rate == 0) + Container( + padding: const EdgeInsets.all(24.0), + child: Padding( + padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + child: inputWidget(TranslationBase.of(context).comments, "", textController, isEnable: true), + ), + ), + SizedBox( + height: 16.0, + ), + Container( + margin: EdgeInsets.fromLTRB(24.0, 0.0, 24.0, 24.0), + child: DefaultButton( + TranslationBase.of(context).submit, + () { + rateDoctorResponse(); + }, + color: CustomColors.accentColor, + ), + ), + ], + ), + ); + }); + }).then((value) { + rate = 1; + setState(() {}); + }); + } + + void rateDoctorResponse() { + GifLoaderDialogUtils.showMyDialog(context); + AskDoctorService service = new AskDoctorService(); + service + .rateDoctorResponse( + transactionNo: widget.doctorResponse.transactionNo, + questionType: widget.doctorResponse.requestType, + rate: rate, + notes: textController.text, + mobileNo: projectViewModel.user.mobileNumber, + idNo: projectViewModel.user.patientIdentificationNo, + patientName: projectViewModel.user.firstName + " " + projectViewModel.user.lastName, + projectID: widget.doctorResponse.projectID, + language: projectViewModel.isArabic ? "ar" : "en") + .then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res['MessageStatus'] == 1) { + AppToast.showSuccessToast(message: res['SuccessMsg']); + Navigator.of(context).pop(); + } else { + AppToast.showErrorToast(message: res['ErrorEndUserMessage']); + } + }).catchError((err) { + print(err); + GifLoaderDialogUtils.hideDialog(context); + }); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(10), + color: isEnable ? Colors.white : CustomColors.grey2.withOpacity(0.4), + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.all(40.0), + keyboardType: TextInputType.text, + controller: _controller, + onChanged: (value) => {}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, + ), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + fillColor: CustomColors.accentColor, + hintStyle: TextStyle( + fontSize: isEnable ? 14 : 24, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: isEnable ? Color(0xff575757) : CustomColors.black, + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, + ), + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); } } diff --git a/lib/pages/medical/ask_doctor/doctor_response.dart b/lib/pages/medical/ask_doctor/doctor_response.dart index 37e5f1c9..0dd9b9a1 100644 --- a/lib/pages/medical/ask_doctor/doctor_response.dart +++ b/lib/pages/medical/ask_doctor/doctor_response.dart @@ -85,24 +85,20 @@ class DoctorResponse extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(8.0), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts('${doctor.doctorName}'), SizedBox( height: 5, ), - Texts( - '${doctor.requestTypeDescription}'), + Texts('${doctor.requestTypeDescription}'), ], ), ), ), Padding( padding: const EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0), - child: Icon(projectViewModel.isArabic - ? Icons.arrow_forward_ios - : Icons.arrow_back_ios), + child: Icon(projectViewModel.isArabic ? Icons.arrow_back_ios : Icons.arrow_forward_ios), ) ], ), @@ -158,24 +154,20 @@ class DoctorResponse extends StatelessWidget { child: Padding( padding: const EdgeInsets.all(8.0), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts('${doctor.doctorName}'), SizedBox( height: 5, ), - Texts( - '${doctor.requestTypeDescription}'), + Texts('${doctor.requestTypeDescription}'), ], ), ), ), Padding( padding: const EdgeInsets.all(8.0), - child: Icon(projectViewModel.isArabic - ? Icons.arrow_forward_ios - : Icons.arrow_back_ios), + child: Icon(projectViewModel.isArabic ? Icons.arrow_back_ios : Icons.arrow_forward_ios), ) ], ), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index bdaa3798..e0b93147 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2892,6 +2892,9 @@ class TranslationBase { String get pharmaLiveCareJoinConsultation => localizedValues["pharmaLiveCareJoinConsultation"][locale.languageCode]; String get pharmaLiveCareJoinConsultation1 => localizedValues["pharmaLiveCareJoinConsultation1"][locale.languageCode]; String get emergencyServicesSubtitle => localizedValues["emergencyServicesSubtitle"][locale.languageCode]; + String get rateDoctorResponse => localizedValues["rateDoctorResponse"][locale.languageCode]; + String get comments => localizedValues["comments"][locale.languageCode]; + String get rateDoctorResponseHeading => localizedValues["rateDoctorResponseHeading"][locale.languageCode]; } From f2ab76eb247c34ecb48350a1aeddf7e00a6ed257 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 9 Jul 2023 10:17:29 +0300 Subject: [PATCH 06/17] updates --- lib/core/service/medical/ask_doctor_services.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/core/service/medical/ask_doctor_services.dart b/lib/core/service/medical/ask_doctor_services.dart index a6482431..bfb45e77 100644 --- a/lib/core/service/medical/ask_doctor_services.dart +++ b/lib/core/service/medical/ask_doctor_services.dart @@ -109,6 +109,8 @@ class AskDoctorService extends BaseService { body['AppointmentNo'] = doctorList.appointmentNo; body['ClinicID'] = doctorList.clinicID; body['QuestionType'] = num.parse(requestType); + body['RequestType'] = num.parse(requestType); + body['RequestTypeID'] = num.parse(requestType); await baseAppClient.post(INSERT_CALL_INFO, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; From 0306c777ed56794e4120658af3ed5218d89d95d1 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Sun, 9 Jul 2023 10:54:28 +0300 Subject: [PATCH 07/17] rating bug fixed --- lib/extensions/string_extensions.dart | 3 ++- lib/widgets/new_design/doctor_header.dart | 28 +++++++++++------------ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index e1700bc5..6ba96b08 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -1,6 +1,7 @@ extension CapExtension on String { + String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}"; String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}'; String get allInCaps => this.toUpperCase(); - String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.inCaps).join(" ") : ""; + String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.isNotEmpty ? str.inCaps: str).join(" ") : ""; } diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index 2c9bb42a..bcbd55f8 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -298,12 +298,12 @@ class DoctorHeader extends StatelessWidget { width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), child: Text(TranslationBase.of(context).excellent, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), - getRatingLine(doctorDetailsList[0].patientNumber, Colors.green[700]), + getRatingLine(doctorDetailsList[0].ratio, Colors.green[700]), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Text(getRatingWidth(doctorDetailsList[0].patientNumber).round().toString() + "%", + child: Text(getRatingWidth(doctorDetailsList[0].ratio).round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], @@ -319,12 +319,12 @@ class DoctorHeader extends StatelessWidget { width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), child: Text(TranslationBase.of(context).v_good, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), - getRatingLine(doctorDetailsList[1].patientNumber, Color(0xffB7B723)), + getRatingLine(doctorDetailsList[1].ratio, Color(0xffB7B723)), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Text(getRatingWidth(doctorDetailsList[1].patientNumber).round().toString() + "%", + child: Text(doctorDetailsList[1].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], @@ -340,12 +340,12 @@ class DoctorHeader extends StatelessWidget { width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), child: Text(TranslationBase.of(context).good, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), - getRatingLine(doctorDetailsList[2].patientNumber, Color(0xffEBA727)), + getRatingLine(doctorDetailsList[2].ratio, Color(0xffEBA727)), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Text(getRatingWidth(doctorDetailsList[2].patientNumber).round().toString() + "%", + child: Text(doctorDetailsList[2].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], @@ -361,12 +361,12 @@ class DoctorHeader extends StatelessWidget { width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), child: Text(TranslationBase.of(context).average, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), - getRatingLine(doctorDetailsList[3].patientNumber, Color(0xffEB7227)), + getRatingLine(doctorDetailsList[3].ratio, Color(0xffEB7227)), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Text(getRatingWidth(doctorDetailsList[3].patientNumber).round().toString() + "%", + child: Text(doctorDetailsList[3].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], @@ -383,12 +383,12 @@ class DoctorHeader extends StatelessWidget { width: 100.0, margin: EdgeInsets.only(top: 10.0, left: 15.0, right: 15.0), child: Text(TranslationBase.of(context).below_average, style: TextStyle(fontSize: 13.0, color: Colors.black, fontWeight: FontWeight.w600))), - getRatingLine(doctorDetailsList[4].patientNumber, Color(0xffE20C0C)), + getRatingLine(doctorDetailsList[4].ratio, Color(0xffE20C0C)), ], ), Container( margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), - child: Text(getRatingWidth(doctorDetailsList[4].patientNumber).round().toString() + "%", + child: Text(doctorDetailsList[4].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), ], @@ -410,12 +410,12 @@ class DoctorHeader extends StatelessWidget { pageBuilder: (context, animation1, animation2) {}); } - double getRatingWidth(int patientNumber) { - var width = (patientNumber / this.headerModel.totalReviews) * 100; + double getRatingWidth(double patientNumber) { + var width = patientNumber; return width.roundToDouble(); } - Widget getRatingLine(int patientNumber, Color color) { + Widget getRatingLine(double patientNumber, Color color) { return Container( margin: EdgeInsets.only(top: 10.0), child: Stack(children: [ @@ -427,7 +427,7 @@ class DoctorHeader extends StatelessWidget { ), ), SizedBox( - width: getRatingWidth(patientNumber) * 1.35, + width: patientNumber * 1.35, height: 4.0, child: Container( color: color, From 27373b697235a9a343dbf4272301ab54b4724607 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Tue, 11 Jul 2023 10:06:37 +0300 Subject: [PATCH 08/17] doctor header. --- lib/widgets/new_design/doctor_header.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/widgets/new_design/doctor_header.dart b/lib/widgets/new_design/doctor_header.dart index bcbd55f8..549c182a 100644 --- a/lib/widgets/new_design/doctor_header.dart +++ b/lib/widgets/new_design/doctor_header.dart @@ -302,7 +302,7 @@ class DoctorHeader extends StatelessWidget { ], ), Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), child: Text(getRatingWidth(doctorDetailsList[0].ratio).round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), @@ -323,7 +323,7 @@ class DoctorHeader extends StatelessWidget { ], ), Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), child: Text(doctorDetailsList[1].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), @@ -344,7 +344,7 @@ class DoctorHeader extends StatelessWidget { ], ), Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), child: Text(doctorDetailsList[2].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), @@ -365,7 +365,7 @@ class DoctorHeader extends StatelessWidget { ], ), Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), child: Text(doctorDetailsList[3].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), @@ -387,7 +387,7 @@ class DoctorHeader extends StatelessWidget { ], ), Container( - margin: EdgeInsets.only(top: 10.0, left: 20.0, right: 20.0), + margin: EdgeInsets.only(top: 10.0, left: 10.0, right: 10.0), child: Text(doctorDetailsList[4].ratio.round().toString() + "%", style: TextStyle(fontSize: 14.0, color: Colors.black, fontWeight: FontWeight.w600)), ), From 4b0a41d7d8efb8ddffc04b26b4f204eec5262450 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 12 Jul 2023 12:54:43 +0300 Subject: [PATCH 09/17] updates --- lib/config/config.dart | 4 ++-- pubspec.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 4981aca0..e261a875 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,8 +20,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; - var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; + // var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; diff --git a/pubspec.yaml b/pubspec.yaml index 39370e58..5d9f5e79 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -174,7 +174,7 @@ dependencies: geofencing: ^0.1.0 -# speech_to_text: ^6.1.1 + speech_to_text: ^6.1.1 # path: speech_to_text in_app_update: ^3.0.0 From d9404d3abefd3e27f2cd048aceca2abf15045beb Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 13 Jul 2023 11:30:13 +0300 Subject: [PATCH 10/17] Medical Report changes --- lib/pages/medical/reports/report_home_page.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 6e6d991a..08f1e43a 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -27,7 +27,7 @@ class _HomeReportPageState extends State with SingleTickerProvid @override void initState() { super.initState(); - _tabController = TabController(length: 4, vsync: this); + _tabController = TabController(length: 3, vsync: this); } @override @@ -86,10 +86,10 @@ class _HomeReportPageState extends State with SingleTickerProvid TranslationBase.of(context).ready, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), ), - Text( - TranslationBase.of(context).completed, - style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - ), + // Text( + // TranslationBase.of(context).completed, + // style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + // ), Text( TranslationBase.of(context).cancelled, style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), @@ -104,7 +104,7 @@ class _HomeReportPageState extends State with SingleTickerProvid children: [ ReportListWidget(reportList: model.reportsOrderRequestList, emailAddress: model.user.emailAddress), ReportListWidget(reportList: model.reportsOrderReadyList, emailAddress: model.user.emailAddress), - ReportListWidget(reportList: model.reportsOrderCompletedList, emailAddress: model.user.emailAddress), + // ReportListWidget(reportList: model.reportsOrderCompletedList, emailAddress: model.user.emailAddress), ReportListWidget(reportList: model.reportsOrderCanceledList, emailAddress: model.user.emailAddress), ], ), From 83859e05f1ee4a5b92c13460434a0c4369bc63f7 Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Sun, 16 Jul 2023 11:48:28 +0300 Subject: [PATCH 11/17] family file approve reject button refresh --- lib/pages/DrawerPages/family/my-family.dart | 30 ++++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index f7d58b36..fa7d4a6a 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -446,11 +446,10 @@ class _MyFamily extends State with TickerProviderStateMixin { this.familyFileProvider.deativateActivateMemberFile(request).then((value) => refreshFamily(context)); } - refreshFamily(context) { - setState(() { - sharedPref.remove(FAMILY_FILE); - checkUserData(); - }); + refreshFamily(context) async { + + await sharedPref.remove(FAMILY_FILE); + await checkUserData(); } switchUser(user, context) { @@ -525,17 +524,23 @@ class _MyFamily extends State with TickerProviderStateMixin { Map request = {}; request["ID"] = ID; request["Status"] = status; - this.familyFileProvider.acceptRejectFamily(request).then((value) => {GifLoaderDialogUtils.hideDialog(context), refreshFamily(context)}); + this.familyFileProvider.acceptRejectFamily(request).then((value) async{ + + await refreshFamily(context); + GifLoaderDialogUtils.hideDialog(context); + }); } checkUserData() async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); - var data2 = AuthenticatedUser.fromJson(await this.sharedPref.getObject(MAIN_USER)); + // var data2 = AuthenticatedUser.fromJson(await this.sharedPref.getObject(MAIN_USER)); await getFamilyFiles(); - setState(() { + this.user = data; - }); + setState(() { + + }); } } @@ -552,16 +557,20 @@ class _MyFamily extends State with TickerProviderStateMixin { GifLoaderDialogUtils.showMyDialog(context); try { if (familySharedRecords == null) { + familySharedRecords = await familyFileProvider.getSharedRecordByStatus(); } + sentRecordsList =[]; familySharedRecords.getAllSharedRecordsByStatusList.forEach((element) { if (element.status == 3) { familySharedRecordsList.add(element); } sentRecordsList.add(element); }); - + approvedRecordsList =[]; + pendingRecordsList =[]; GetAllSharedRecordsByStatusResponse pendingAndApprovedRecords = await getUserViewRequest(); + pendingAndApprovedRecords.getAllSharedRecordsByStatusList.forEach((element) { print(element.toJson()); if (element.status == 2) { @@ -571,6 +580,7 @@ class _MyFamily extends State with TickerProviderStateMixin { } }); } catch (ex) { + familySharedRecords = GetAllSharedRecordsByStatusResponse(getAllSharedRecordsByStatusList: []); } GifLoaderDialogUtils.hideDialog(context); From 047877fb08e5e76d13670dce831935a1067093f3 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Sun, 16 Jul 2023 14:10:55 +0300 Subject: [PATCH 12/17] Add Doctor response rate comments validation --- lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index c6fdb47f..2e930330 100644 --- a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart +++ b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart @@ -210,7 +210,11 @@ class _ViewDoctorResponsesPageState extends State { child: DefaultButton( TranslationBase.of(context).submit, () { - rateDoctorResponse(); + if (textController.text.isEmpty) { + AppToast.showErrorToast(message: "Please enter comments"); + } else { + rateDoctorResponse(); + } }, color: CustomColors.accentColor, ), From 1a45dd57e9a36aebccf8576e0e3c8bffc9ad005c Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 17 Jul 2023 16:27:39 +0300 Subject: [PATCH 13/17] LiveCare Fix --- lib/pages/livecare/widgets/LiveCareHistoryCard.dart | 5 +++-- lib/services/livecare_services/livecare_provider.dart | 3 --- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index def0461d..9e08af05 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -240,9 +240,10 @@ class _LiveCareHistoryCardState extends State { LiveCareService service = new LiveCareService(); GifLoaderDialogUtils.showMyDialog(context); service.sendLiveCareInvoiceEmail(widget.erRequestHistoryList.appointmentNo.toString(), widget.erRequestHistoryList.projectID, authUser.emailAddress, context).then((res) { - AppToast.showSuccessToast(message: TranslationBase(context).emailSentSuccessfully); + GifLoaderDialogUtils.hideDialog(context); + AppToast.showSuccessToast(message: TranslationBase.of(context).emailSentSuccessfully); }).catchError((err) { - AppToast.showErrorToast(message: err); + AppToast.showErrorToast(message: err.toString()); print(err); }); } diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index a784d161..2a18c79c 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -281,15 +281,12 @@ class LiveCareService extends BaseService { Future sendLiveCareInvoiceEmail(String appoNo, int projectID, String emailAddress, BuildContext context) async { Map request; - if (await this.sharedPref.getObject(USER_PROFILE) != null) { var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); authUser = data; } request = {"To": emailAddress, "ProjectID": projectID, "AppointmentNo": appoNo}; - dynamic localRes; - await baseAppClient.post(SEND_LIVECARE_INVOICE_EMAIL, onSuccess: (response, statusCode) async { localRes = response; }, onFailure: (String error, int statusCode) { From 1eccaf0aac18f5122cd3c06009b51f92b210b58a Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Tue, 18 Jul 2023 11:02:33 +0300 Subject: [PATCH 14/17] Regex added to allow characters only. --- lib/pages/medical/sickleave_workplace_update_page.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/pages/medical/sickleave_workplace_update_page.dart b/lib/pages/medical/sickleave_workplace_update_page.dart index 3b4a1f1b..517f251c 100644 --- a/lib/pages/medical/sickleave_workplace_update_page.dart +++ b/lib/pages/medical/sickleave_workplace_update_page.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/uitl/utils_new.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/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; @@ -143,6 +144,9 @@ class _WorkplaceUpdatePageState extends State { scrollPadding: EdgeInsets.zero, keyboardType: TextInputType.name, controller: _controller, + inputFormatters: [ + FilteringTextInputFormatter.allow(RegExp("[a-zA-Zء-ي ]")), + ], onChanged: (value) => {_onPassportTextChanged(value)}, style: TextStyle( fontSize: 14, From 3fb8876c31f6ee0eff253077c8593573ad3c3b44 Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Wed, 19 Jul 2023 09:54:34 +0300 Subject: [PATCH 15/17] Manual Insurance Card Update --- lib/config/config.dart | 6 +++--- lib/config/localized_values.dart | 1 + .../insurance/UpdateInsuranceManually.dart | 9 +++++--- lib/pages/insurance/insurance_page.dart | 21 ++++++++++++++++--- .../ask_doctor/ViewDoctorResponsesPage.dart | 20 +++++++++--------- lib/uitl/translations_delegate_base.dart | 1 + lib/widgets/in_app_browser/InAppBrowser.dart | 4 ++-- pubspec.yaml | 2 +- 8 files changed, 42 insertions(+), 22 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index e261a875..93128eff 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,8 +20,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; - // var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; + var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -323,7 +323,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 10.5; +var VERSION_ID = 10.6; 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 f08b9c41..47d36da3 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1887,4 +1887,5 @@ const Map localizedValues = { "rateDoctorResponse": {"en": "Rate Doctor Response", "ar": "تقييم استجابة الطبيب"}, "comments": {"en": "Comments", "ar": "تعليقات"}, "rateDoctorResponseHeading": {"en": "Please rate the doctor response:", "ar": "يرجى تقييم استجابة الطبيب:"}, + "updateInsuranceManuallyDialog": {"en": "Would you like to update your insurance manually?", "ar": "هل ترغب في تحديث التأمين الخاص بك يدويًا؟"}, }; \ No newline at end of file diff --git a/lib/pages/insurance/UpdateInsuranceManually.dart b/lib/pages/insurance/UpdateInsuranceManually.dart index a9ee8a67..32378aa0 100644 --- a/lib/pages/insurance/UpdateInsuranceManually.dart +++ b/lib/pages/insurance/UpdateInsuranceManually.dart @@ -159,9 +159,12 @@ class _UpdateInsuranceManuallyState extends State { padding: EdgeInsets.all(18), child: DefaultButton( TranslationBase.of(context).submit, - isFormValid() ? () { - submitManualInsuranceUpdateRequest(); - } : null, + () { + if(isFormValid()) + submitManualInsuranceUpdateRequest(); + else + AppToast.showErrorToast(message: TranslationBase.of(context).enterInsuranceDetails); + }, disabledColor: Colors.grey, ), ), diff --git a/lib/pages/insurance/insurance_page.dart b/lib/pages/insurance/insurance_page.dart index 2ea4213f..324c9fa1 100644 --- a/lib/pages/insurance/insurance_page.dart +++ b/lib/pages/insurance/insurance_page.dart @@ -1,6 +1,6 @@ import 'package:diplomaticquarterapp/core/service/insurance_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/insurance_card_View_model.dart'; -import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/pages/insurance/UpdateInsuranceManually.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; @@ -9,6 +9,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import '../../locator.dart'; +import '../../widgets/dialogs/confirm_dialog.dart'; import 'insurance_card_update_details.dart'; class InsurancePage extends StatelessWidget { @@ -144,7 +145,9 @@ class InsurancePage extends StatelessWidget { getDetails({String setupID, int projectID, String patientIdentificationID, int patientID, String name, bool isFamily, int parentID = 0, BuildContext context}) { GifLoaderDialogUtils.showMyDialog(context); - _insuranceCardService.getPatientInsuranceDetails(setupID: setupID, projectID: projectID, patientID: patientID, patientIdentificationID: patientIdentificationID, isFamily: isFamily, parentID: parentID).then((value) { + _insuranceCardService + .getPatientInsuranceDetails(setupID: setupID, projectID: projectID, patientID: patientID, patientIdentificationID: patientIdentificationID, isFamily: isFamily, parentID: parentID) + .then((value) { GifLoaderDialogUtils.hideDialog(context); if (!_insuranceCardService.hasError && _insuranceCardService.isHaveInsuranceCard) { Navigator.push( @@ -159,8 +162,20 @@ class InsurancePage extends StatelessWidget { model.getInsuranceUpdated(); }); } else { - AppToast.showErrorToast(message: _insuranceCardService.error); + // AppToast.showErrorToast(message: _insuranceCardService.error); + updateManually(context, _insuranceCardService.error); } }); } + + void updateManually(BuildContext context, String errorMsg) { + ConfirmDialog dialog = new ConfirmDialog( + context: context, + confirmMessage: errorMsg + ". " + TranslationBase.of(context).updateInsuranceManuallyDialog, + okText: TranslationBase.of(context).yes, + cancelText: TranslationBase.of(context).no, + okFunction: () => {Navigator.pop(context), Navigator.push(context, FadePage(page: UpdateInsuranceManually()))}, + cancelFunction: () => {}); + dialog.showAlertDialog(context); + } } diff --git a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index 2e930330..893a59df 100644 --- a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart +++ b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart @@ -112,16 +112,16 @@ class _ViewDoctorResponsesPageState extends State { ), ), ), - Container( - margin: EdgeInsets.only(top: 10.0), - child: DefaultButton( - TranslationBase.of(context).rateDoctorResponse, - () { - openResponseRateDialog(context); - }, - color: CustomColors.accentColor, - ), - ), + // Container( + // margin: EdgeInsets.only(top: 10.0), + // child: DefaultButton( + // TranslationBase.of(context).rateDoctorResponse, + // () { + // openResponseRateDialog(context); + // }, + // color: CustomColors.accentColor, + // ), + // ), ], ), ); diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index e0b93147..a9a4b4bb 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2895,6 +2895,7 @@ class TranslationBase { String get rateDoctorResponse => localizedValues["rateDoctorResponse"][locale.languageCode]; String get comments => localizedValues["comments"][locale.languageCode]; String get rateDoctorResponseHeading => localizedValues["rateDoctorResponseHeading"][locale.languageCode]; + String get updateInsuranceManuallyDialog => localizedValues["updateInsuranceManuallyDialog"][locale.languageCode]; } diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index f62248b8..e91990b4 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -37,9 +37,9 @@ class MyInAppBrowser extends InAppBrowser { // 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/PayFortWebLive/PayFortApi/MakeApplePayRequest'; // Payfort Payment Gateway URL UAT - static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT + // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWeb/pages/SendPayFortRequest.aspx'; // Payfort Payment Gateway URL UAT - // static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE + static String SERVICE_URL = 'https://hmgwebservices.com/PayFortWebLive/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL LIVE // static String SERVICE_URL = 'https://uat.hmgwebservices.com/payfortforvidaplus/pages/SendPayFortRequest.aspx'; //Payfort Payment Gateway URL UAT VIDA PLUS diff --git a/pubspec.yaml b/pubspec.yaml index 5d9f5e79..1c7c9b15 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.64+1 +version: 4.5.022+4050022 environment: sdk: ">=2.7.0 <3.0.0" From a60f66a0691b5beaf802425bdf85a35ca60febfe Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Thu, 27 Jul 2023 16:25:25 +0300 Subject: [PATCH 16/17] Updates --- lib/config/config.dart | 5 +- lib/config/localized_values.dart | 1 + lib/core/model/reports/request_reports.dart | 36 +- lib/core/service/medical/reports_service.dart | 69 +-- .../medical/reports_view_model.dart | 1 + .../conference/web_rtc/call_home_page_.dart | 408 ++++++------- lib/pages/landing/landing_page.dart | 3 +- lib/pages/livecare/incoming_call.dart | 2 +- .../ask_doctor/ViewDoctorResponsesPage.dart | 20 +- .../medical/reports/report_home_page.dart | 196 +++++-- .../medical/reports/report_list_widget.dart | 47 +- lib/pages/webRTC/call_page.dart | 328 +++++------ lib/pages/webRTC/signaling.dart | 554 +++++++++--------- lib/routes.dart | 2 +- lib/uitl/SignalRUtil.dart | 346 +++++------ lib/uitl/translations_delegate_base.dart | 1 + lib/widgets/drawer/app_drawer_widget.dart | 8 +- lib/widgets/in_app_browser/InAppBrowser.dart | 17 +- pubspec.yaml | 10 +- 19 files changed, 1065 insertions(+), 989 deletions(-) diff --git a/lib/config/config.dart b/lib/config/config.dart index 93128eff..0fad39b1 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,8 +20,8 @@ var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; // var BASE_URL = 'http://10.50.100.198:2018/'; - var BASE_URL = 'https://uat.hmgwebservices.com/'; -// var BASE_URL = 'https://hmgwebservices.com/'; + // var BASE_URL = 'https://uat.hmgwebservices.com/'; +var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -182,6 +182,7 @@ var SAVE_BLOOD_AGREEMENT = 'Services/PatientVarification.svc/REST/AddUserAgreeme var REPORTS = 'Services/Doctors.svc/REST/GetPatientMedicalReportStatusInfo'; var INSERT_REQUEST_FOR_MEDICAL_REPORT = 'Services/Doctors.svc/REST/InsertRequestForMedicalReport'; var SEND_MEDICAL_REPORT_EMAIL = 'Services/Notifications.svc/REST/SendMedicalReportEmail'; +var GET_INPATIENT_ADMISSIONS = 'Services/inps.svc/REST/getAdmissionForMedicalReport'; ///Rate // var IS_LAST_APPOITMENT_RATED = 'Services/Doctors.svc/REST/IsLastAppoitmentRated'; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 47d36da3..a69002f6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1888,4 +1888,5 @@ const Map localizedValues = { "comments": {"en": "Comments", "ar": "تعليقات"}, "rateDoctorResponseHeading": {"en": "Please rate the doctor response:", "ar": "يرجى تقييم استجابة الطبيب:"}, "updateInsuranceManuallyDialog": {"en": "Would you like to update your insurance manually?", "ar": "هل ترغب في تحديث التأمين الخاص بك يدويًا؟"}, + "viewReport": {"en": "View Report", "ar": "عرض التقرير"}, }; \ No newline at end of file diff --git a/lib/core/model/reports/request_reports.dart b/lib/core/model/reports/request_reports.dart index 14359591..9bb44280 100644 --- a/lib/core/model/reports/request_reports.dart +++ b/lib/core/model/reports/request_reports.dart @@ -15,24 +15,26 @@ class RequestReports { String tokenID; int patientTypeID; int patientType; + int projectID; RequestReports( {this.isReport, - this.encounterType, - this.requestType, - this.versionID, - this.channel, - this.languageID, - this.iPAdress, - this.generalid, - this.patientOutSA, - this.sessionID, - this.isDentalAllowedBackend, - this.deviceTypeID, - this.patientID, - this.tokenID, - this.patientTypeID, - this.patientType}); + this.encounterType, + this.requestType, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID, + this.patientID, + this.tokenID, + this.patientTypeID, + this.patientType, + this.projectID}); RequestReports.fromJson(Map json) { isReport = json['IsReport']; @@ -51,6 +53,7 @@ class RequestReports { tokenID = json['TokenID']; patientTypeID = json['PatientTypeID']; patientType = json['PatientType']; + projectID = json['ProjectID']; } Map toJson() { @@ -71,6 +74,7 @@ class RequestReports { data['TokenID'] = this.tokenID; data['PatientTypeID'] = this.patientTypeID; data['PatientType'] = this.patientType; + data['ProjectID'] = this.projectID; return data; } -} \ No newline at end of file +} diff --git a/lib/core/service/medical/reports_service.dart b/lib/core/service/medical/reports_service.dart index bf340814..a496c6df 100644 --- a/lib/core/service/medical/reports_service.dart +++ b/lib/core/service/medical/reports_service.dart @@ -8,17 +8,11 @@ class ReportsService extends BaseService { List reportsList = List(); List appointHistoryList = List(); String userAgreementContent = ""; - RequestReports _requestReports = RequestReports( - isReport: true, - encounterType: 1, - requestType: 1, - patientOutSA: 0, - ); + RequestReports _requestReports = RequestReports(isReport: true, encounterType: 1, requestType: 1, patientOutSA: 0, projectID: 0); Future getReports() async { hasError = false; - await baseAppClient.post(REPORTS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(REPORTS, onSuccess: (dynamic response, int statusCode) { reportsList.clear(); response['GetPatientMedicalStatus'].forEach((reports) { reportsList.add(Reports.fromJson(reports)); @@ -29,12 +23,25 @@ class ReportsService extends BaseService { }, body: _requestReports.toJson()); } + Future getInpatientAdmissionsList() async { + hasError = false; + await baseAppClient.post(GET_INPATIENT_ADMISSIONS, onSuccess: (dynamic response, int statusCode) { + reportsList.clear(); + print(response['AdmissionsForMedicalReport']); + response['AdmissionsForMedicalReport'].forEach((reports) { + // reportsList.add(Reports.fromJson(reports)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestReports.toJson()); + } + Future getPatentAppointmentHistory() async { hasError = false; Map body = new Map(); body['IsForMedicalReport'] = true; - await baseAppClient.post(GET_PATIENT_AppointmentHistory, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_PATIENT_AppointmentHistory, onSuccess: (dynamic response, int statusCode) { appointHistoryList = []; response['AppoimentAllHistoryResultList'].forEach((appoint) { appointHistoryList.add(AppointmentHistory.fromJson(appoint)); @@ -47,8 +54,7 @@ class ReportsService extends BaseService { Future getUserTermsAndConditions() async { hasError = false; - await baseAppClient.post(GET_USER_TERMS, - onSuccess: (dynamic response, int statusCode) { + await baseAppClient.post(GET_USER_TERMS, onSuccess: (dynamic response, int statusCode) { userAgreementContent = response['UserAgreementContent']; }, onFailure: (String error, int statusCode) { hasError = true; @@ -60,9 +66,7 @@ class ReportsService extends BaseService { Map body = Map(); body['RSummaryReport'] = isSummary; hasError = false; - await baseAppClient.post(UPDATE_HEALTH_TERMS, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(UPDATE_HEALTH_TERMS, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); @@ -73,16 +77,13 @@ class ReportsService extends BaseService { body['EmailAddress'] = email; body['isDentalAllowedBackend'] = false; hasError = false; - await baseAppClient.post(UPDATE_PATENT_EMAIL, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { - hasError = true; - super.error = error; - }, body: body); + await baseAppClient.post(UPDATE_PATENT_EMAIL, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); } - Future insertRequestForMedicalReport( - AppointmentHistory appointmentHistory) async { + Future insertRequestForMedicalReport(AppointmentHistory appointmentHistory) async { Map body = new Map(); body['ClinicID'] = appointmentHistory.clinicID; body['DoctorID'] = appointmentHistory.doctorID; @@ -98,23 +99,13 @@ class ReportsService extends BaseService { body['Status'] = 1; body['CreatedBy'] = 102; hasError = false; - await baseAppClient.post(INSERT_REQUEST_FOR_MEDICAL_REPORT, - onSuccess: (dynamic response, int statusCode) {}, - onFailure: (String error, int statusCode) { + await baseAppClient.post(INSERT_REQUEST_FOR_MEDICAL_REPORT, onSuccess: (dynamic response, int statusCode) {}, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); } - Future sendEmailForMedicalReport( - String projectName, - String clinicName, - String doctorName, - String requestDate, - String invoiceNo, - int projectID, - String stamp, - String setupID) async { + Future sendEmailForMedicalReport(String projectName, String clinicName, String doctorName, String requestDate, String invoiceNo, int projectID, String stamp, String setupID) async { Map body = new Map(); body['SetupID'] = setupID; body['PrintDate'] = requestDate; @@ -135,11 +126,9 @@ class ReportsService extends BaseService { dynamic response; hasError = false; - await baseAppClient.post(SEND_MEDICAL_REPORT_EMAIL, - onSuccess: (dynamic res, int statusCode) { - response = res; - }, - onFailure: (String error, int statusCode) { + await baseAppClient.post(SEND_MEDICAL_REPORT_EMAIL, onSuccess: (dynamic res, int statusCode) { + response = res; + }, onFailure: (String error, int statusCode) { hasError = true; super.error = error; }, body: body); diff --git a/lib/core/viewModels/medical/reports_view_model.dart b/lib/core/viewModels/medical/reports_view_model.dart index 271b5463..544ead18 100644 --- a/lib/core/viewModels/medical/reports_view_model.dart +++ b/lib/core/viewModels/medical/reports_view_model.dart @@ -33,6 +33,7 @@ class ReportsViewModel extends BaseViewModel { setState(ViewState.Error); } else { _filterList(); + await _reportsService.getInpatientAdmissionsList(); setState(ViewState.Idle); } } diff --git a/lib/pages/conference/web_rtc/call_home_page_.dart b/lib/pages/conference/web_rtc/call_home_page_.dart index 1f36a8e9..13dbfb35 100644 --- a/lib/pages/conference/web_rtc/call_home_page_.dart +++ b/lib/pages/conference/web_rtc/call_home_page_.dart @@ -1,204 +1,204 @@ -import 'dart:async'; -import 'dart:convert'; - -import 'package:diplomaticquarterapp/pages/conference/web_rtc/widgets/cam_view_widget.dart'; -import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; -import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart'; - -import '../conference_button_bar.dart'; - -class CallHomePage extends StatefulWidget { - final String receiverId; - final String callerId; - - const CallHomePage({Key key, this.receiverId, this.callerId}) : super(key: key); - - @override - _CallHomePageState createState() => _CallHomePageState(); -} - -class _CallHomePageState extends State { - bool showNoise = true; - RTCVideoRenderer _localRenderer = RTCVideoRenderer(); - RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); - - final StreamController _audioButton = StreamController.broadcast(); - final StreamController _videoButton = StreamController.broadcast(); - final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); - final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); - - //Stream to enable video - MediaStream localMediaStream; - MediaStream remoteMediaStream; - Signaling signaling = Signaling(); - - @override - void initState() { - // TODO: implement initState - super.initState(); - startCall(); - } - - startCall() async{ - await _localRenderer.initialize(); - await _remoteRenderer.initialize(); - await signaling.init(); - final connected = await receivedCall(); - } - - - Future receivedCall() async { - //Stream local media - localMediaStream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true}); - _localRenderer.srcObject = localMediaStream; - - final connected = await signaling.acceptCall(widget.callerId, widget.receiverId, localMediaStream: localMediaStream, - onRemoteMediaStream: (remoteMediaStream){ - - // print(remoteMediaStream.toString()); - // print(json.encode(remoteMediaStream.getTracks().asMap())); - this.remoteMediaStream = remoteMediaStream; - _remoteRenderer.srcObject = remoteMediaStream; - _remoteRenderer.addListener(() { - print('_remoteRenderer'); - print(_remoteRenderer); - setState(() {}); - }); - }, - onRemoteTrack: (track){ - _remoteRenderer.srcObject.addTrack(track.track); - // setState(() { - // }); - - print(track.streams.first.getVideoTracks()); - print(track.streams.first.getAudioTracks()); - print(json.encode(track.streams.asMap())); - } - ); - - if(connected){ - signaling.signalR.listen( - onAcceptCall: (arg0){ - print(arg0.toString()); - }, - onCandidate: (candidateJson){ - signaling.addCandidate(candidateJson); - }, - onDeclineCall: (arg0,arg1){ - // _onHangup(); - }, - onHangupCall: (arg0){ - // _onHangup(); - }, - - onOffer: (offerSdp, callerUser) async{ - print('${offerSdp.toString()} | ${callerUser.toString()}'); - await signaling.answerOffer(offerSdp); - } - ); - } - return connected; - } - - @override - void dispose() { - // TODO: implement dispose - super.dispose(); - signaling.dispose(); - _localRenderer?.dispose(); - _remoteRenderer?.dispose(); - _audioButton?.close(); - _videoButton?.close(); - localMediaStream?.dispose(); - remoteMediaStream?.dispose(); - _disposeStreamsAndSubscriptions(); - } - - Future _disposeStreamsAndSubscriptions() async { - if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); - if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.white, - body: buildLayout(), - ); - } - - LayoutBuilder buildLayout() { - return LayoutBuilder( - builder: (BuildContext context, BoxConstraints constraints) { - return Stack( - children: [ - CamViewWidget( - localRenderer: _localRenderer, - remoteRenderer: _remoteRenderer, - constraints: constraints, - onButtonBarVisibleStreamController: _onButtonBarVisibleStreamController, - onButtonBarHeightStreamController: _onButtonBarHeightStreamController, - ), - ConferenceButtonBar( - audioEnabled: _audioButton.stream, - videoEnabled: _videoButton.stream, - onAudioEnabled: _onAudioEnable, - onVideoEnabled: _onVideoEnabled, - onSwitchCamera: _onSwitchCamera, - onHangup: _onHangup, - onPersonAdd: () {}, - onPersonRemove: () {}, - onHeight: _onHeightBar, - onShow: _onShowBar, - onHide: _onHideBar, - ), - ], - ); - }, - ); - } - - Function _onAudioEnable() { - final audioTrack = localMediaStream.getAudioTracks()[0]; - final mute = audioTrack.muted; - Helper.setMicrophoneMute(!mute, audioTrack); - _audioButton.add(mute); - } - - Function _onVideoEnabled() { - final videoTrack = localMediaStream.getVideoTracks()[0]; - bool videoEnabled = videoTrack.enabled; - localMediaStream.getVideoTracks()[0].enabled = !videoEnabled; - _videoButton.add(!videoEnabled); - } - - Function _onSwitchCamera() { - Helper.switchCamera(localMediaStream.getVideoTracks()[0]); - } - - void _onShowBar() { - setState(() { - }); - _onButtonBarVisibleStreamController.add(true); - } - - void _onHeightBar(double height) { - _onButtonBarHeightStreamController.add(height); - } - - void _onHideBar() { - setState(() { - SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); - }); - _onButtonBarVisibleStreamController.add(false); - } - - Future _onHangup() async { - signaling.hangupCall(widget.callerId, widget.receiverId); - print('onHangup'); - Navigator.of(context).pop(); - } -} +// import 'dart:async'; +// import 'dart:convert'; +// +// import 'package:diplomaticquarterapp/pages/conference/web_rtc/widgets/cam_view_widget.dart'; +// import 'package:diplomaticquarterapp/pages/conference/widgets/noise_box.dart'; +// import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter/services.dart'; +// import 'package:flutter_webrtc/flutter_webrtc.dart'; +// +// import '../conference_button_bar.dart'; +// +// class CallHomePage extends StatefulWidget { +// final String receiverId; +// final String callerId; +// +// const CallHomePage({Key key, this.receiverId, this.callerId}) : super(key: key); +// +// @override +// _CallHomePageState createState() => _CallHomePageState(); +// } +// +// class _CallHomePageState extends State { +// bool showNoise = true; +// RTCVideoRenderer _localRenderer = RTCVideoRenderer(); +// RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); +// +// final StreamController _audioButton = StreamController.broadcast(); +// final StreamController _videoButton = StreamController.broadcast(); +// final StreamController _onButtonBarVisibleStreamController = StreamController.broadcast(); +// final StreamController _onButtonBarHeightStreamController = StreamController.broadcast(); +// +// //Stream to enable video +// MediaStream localMediaStream; +// MediaStream remoteMediaStream; +// Signaling signaling = Signaling(); +// +// @override +// void initState() { +// // TODO: implement initState +// super.initState(); +// startCall(); +// } +// +// startCall() async{ +// await _localRenderer.initialize(); +// await _remoteRenderer.initialize(); +// await signaling.init(); +// final connected = await receivedCall(); +// } +// +// +// Future receivedCall() async { +// //Stream local media +// localMediaStream = await navigator.mediaDevices.getUserMedia({'video': true, 'audio': true}); +// _localRenderer.srcObject = localMediaStream; +// +// final connected = await signaling.acceptCall(widget.callerId, widget.receiverId, localMediaStream: localMediaStream, +// onRemoteMediaStream: (remoteMediaStream){ +// +// // print(remoteMediaStream.toString()); +// // print(json.encode(remoteMediaStream.getTracks().asMap())); +// this.remoteMediaStream = remoteMediaStream; +// _remoteRenderer.srcObject = remoteMediaStream; +// _remoteRenderer.addListener(() { +// print('_remoteRenderer'); +// print(_remoteRenderer); +// setState(() {}); +// }); +// }, +// onRemoteTrack: (track){ +// _remoteRenderer.srcObject.addTrack(track.track); +// // setState(() { +// // }); +// +// print(track.streams.first.getVideoTracks()); +// print(track.streams.first.getAudioTracks()); +// print(json.encode(track.streams.asMap())); +// } +// ); +// +// if(connected){ +// signaling.signalR.listen( +// onAcceptCall: (arg0){ +// print(arg0.toString()); +// }, +// onCandidate: (candidateJson){ +// signaling.addCandidate(candidateJson); +// }, +// onDeclineCall: (arg0,arg1){ +// // _onHangup(); +// }, +// onHangupCall: (arg0){ +// // _onHangup(); +// }, +// +// onOffer: (offerSdp, callerUser) async{ +// print('${offerSdp.toString()} | ${callerUser.toString()}'); +// await signaling.answerOffer(offerSdp); +// } +// ); +// } +// return connected; +// } +// +// @override +// void dispose() { +// // TODO: implement dispose +// super.dispose(); +// signaling.dispose(); +// _localRenderer?.dispose(); +// _remoteRenderer?.dispose(); +// _audioButton?.close(); +// _videoButton?.close(); +// localMediaStream?.dispose(); +// remoteMediaStream?.dispose(); +// _disposeStreamsAndSubscriptions(); +// } +// +// Future _disposeStreamsAndSubscriptions() async { +// if (_onButtonBarVisibleStreamController != null) await _onButtonBarVisibleStreamController.close(); +// if (_onButtonBarHeightStreamController != null) await _onButtonBarHeightStreamController.close(); +// } +// +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// backgroundColor: Colors.white, +// body: buildLayout(), +// ); +// } +// +// LayoutBuilder buildLayout() { +// return LayoutBuilder( +// builder: (BuildContext context, BoxConstraints constraints) { +// return Stack( +// children: [ +// CamViewWidget( +// localRenderer: _localRenderer, +// remoteRenderer: _remoteRenderer, +// constraints: constraints, +// onButtonBarVisibleStreamController: _onButtonBarVisibleStreamController, +// onButtonBarHeightStreamController: _onButtonBarHeightStreamController, +// ), +// ConferenceButtonBar( +// audioEnabled: _audioButton.stream, +// videoEnabled: _videoButton.stream, +// onAudioEnabled: _onAudioEnable, +// onVideoEnabled: _onVideoEnabled, +// onSwitchCamera: _onSwitchCamera, +// onHangup: _onHangup, +// onPersonAdd: () {}, +// onPersonRemove: () {}, +// onHeight: _onHeightBar, +// onShow: _onShowBar, +// onHide: _onHideBar, +// ), +// ], +// ); +// }, +// ); +// } +// +// Function _onAudioEnable() { +// final audioTrack = localMediaStream.getAudioTracks()[0]; +// final mute = audioTrack.muted; +// Helper.setMicrophoneMute(!mute, audioTrack); +// _audioButton.add(mute); +// } +// +// Function _onVideoEnabled() { +// final videoTrack = localMediaStream.getVideoTracks()[0]; +// bool videoEnabled = videoTrack.enabled; +// localMediaStream.getVideoTracks()[0].enabled = !videoEnabled; +// _videoButton.add(!videoEnabled); +// } +// +// Function _onSwitchCamera() { +// Helper.switchCamera(localMediaStream.getVideoTracks()[0]); +// } +// +// void _onShowBar() { +// setState(() { +// }); +// _onButtonBarVisibleStreamController.add(true); +// } +// +// void _onHeightBar(double height) { +// _onButtonBarHeightStreamController.add(height); +// } +// +// void _onHideBar() { +// setState(() { +// SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom]); +// }); +// _onButtonBarVisibleStreamController.add(false); +// } +// +// Future _onHangup() async { +// signaling.hangupCall(widget.callerId, widget.receiverId); +// print('onHangup'); +// Navigator.of(context).pop(); +// } +// } diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index e9fbd62c..0c044e6b 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -25,7 +25,6 @@ import 'package:diplomaticquarterapp/services/livecare_services/livecare_provide import 'package:diplomaticquarterapp/services/robo_search/event_provider.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; -import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -81,7 +80,7 @@ class _LandingPageState extends State with WidgetsBindingObserver { var themeNotifier; DateTime currentBackPressTime; - SignalRUtil signalRUtil; + // SignalRUtil signalRUtil; ToDoCountProviderModel toDoProvider; diff --git a/lib/pages/livecare/incoming_call.dart b/lib/pages/livecare/incoming_call.dart index da8c507e..7cea1153 100644 --- a/lib/pages/livecare/incoming_call.dart +++ b/lib/pages/livecare/incoming_call.dart @@ -34,7 +34,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt CameraController _controller; Future _initializeControllerFuture; bool isCameraReady = false; - Signaling signaling = Signaling()..init(); + // Signaling signaling = Signaling()..init(); @override void initState() { diff --git a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart index 893a59df..2e930330 100644 --- a/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart +++ b/lib/pages/medical/ask_doctor/ViewDoctorResponsesPage.dart @@ -112,16 +112,16 @@ class _ViewDoctorResponsesPageState extends State { ), ), ), - // Container( - // margin: EdgeInsets.only(top: 10.0), - // child: DefaultButton( - // TranslationBase.of(context).rateDoctorResponse, - // () { - // openResponseRateDialog(context); - // }, - // color: CustomColors.accentColor, - // ), - // ), + Container( + margin: EdgeInsets.only(top: 10.0), + child: DefaultButton( + TranslationBase.of(context).rateDoctorResponse, + () { + openResponseRateDialog(context); + }, + color: CustomColors.accentColor, + ), + ), ], ), ); diff --git a/lib/pages/medical/reports/report_home_page.dart b/lib/pages/medical/reports/report_home_page.dart index 08f1e43a..375bbb8c 100644 --- a/lib/pages/medical/reports/report_home_page.dart +++ b/lib/pages/medical/reports/report_home_page.dart @@ -21,19 +21,23 @@ class HomeReportPage extends StatefulWidget { } class _HomeReportPageState extends State with SingleTickerProviderStateMixin { - TabController _tabController; + TabController _tabController_new; List imagesInfo = List(); + int _currentPage = 0; @override void initState() { + _tabController_new = TabController(length: 2, vsync: this); + WidgetsBinding.instance.addPostFrameCallback((_) { + getInPatientAdmissionList(); + }); super.initState(); - _tabController = TabController(length: 3, vsync: this); } @override void dispose() { super.dispose(); - _tabController.dispose(); + _tabController_new.dispose(); } @override @@ -57,74 +61,138 @@ class _HomeReportPageState extends State with SingleTickerProvid showNewAppBarTitle: true, backgroundColor: Color(0xffF7F7F7), imagesInfo: imagesInfo, - body: Column( - children: [ - TabBar( - isScrollable: true, - controller: _tabController, - indicatorWeight: 3.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Color(0xff2B353E), - unselectedLabelColor: Color(0xff575757), - labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), - labelStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - unselectedLabelStyle: TextStyle( - fontSize: 16, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - tabs: [ - Text( - TranslationBase.of(context).requested, - style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - ), - Text( - TranslationBase.of(context).ready, - style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - ), - // Text( - // TranslationBase.of(context).completed, - // style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), - // ), - Text( - TranslationBase.of(context).cancelled, - style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + body: Container( + child: Column( + children: [ + TabBar( + controller: _tabController_new, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), - ], - ), - if (model.user != null) - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [ - ReportListWidget(reportList: model.reportsOrderRequestList, emailAddress: model.user.emailAddress), - ReportListWidget(reportList: model.reportsOrderReadyList, emailAddress: model.user.emailAddress), - // ReportListWidget(reportList: model.reportsOrderCompletedList, emailAddress: model.user.emailAddress), - ReportListWidget(reportList: model.reportsOrderCanceledList, emailAddress: model.user.emailAddress), - ], + unselectedLabelStyle: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, ), + onTap: (int value) { + print(value); + setState(() {}); + }, + tabs: [ + Text( + TranslationBase.of(context).inPatient, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + ), + Text( + TranslationBase.of(context).outpatient, + style: TextStyle(fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins'), + ), + ], ), - if (projectViewModel.havePrivilege(21)) - Padding( - padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), - child: DefaultButton( - TranslationBase.of(context).requestMedicalReport.toLowerCase().capitalizeFirstofEach, - () => Navigator.push( - context, - FadePage( - page: MedicalReports(), - ), + if (model.user != null) + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), + controller: _tabController_new, + children: [ + Container(), + Container( + child: Column( + children: [ + Padding( + padding: EdgeInsets.all(21), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + myRadioButton(TranslationBase.of(context).requested, 0), + myRadioButton(TranslationBase.of(context).ready, 1), + myRadioButton(TranslationBase.of(context).cancelled, 2), + ], + ), + ), + Expanded( + child: IndexedStack( + index: _currentPage, + children: [ + ReportListWidget(reportList: model.reportsOrderRequestList, emailAddress: model.user.emailAddress), + ReportListWidget(reportList: model.reportsOrderReadyList, emailAddress: model.user.emailAddress), + ReportListWidget(reportList: model.reportsOrderCanceledList, emailAddress: model.user.emailAddress), + ], + ), + ) + ], + ), + ) + ], ), ), - ) - ], + if (projectViewModel.havePrivilege(21) && _tabController_new.index == 1) + Padding( + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).requestMedicalReport.toLowerCase().capitalizeFirstofEach, + () => Navigator.push( + context, + FadePage( + page: MedicalReports(), + ), + ).then((value) { + model.getReports(); + }), + ), + ) + ], + ), ), ), ); } + + Widget myRadioButton(String _label, int _value) { + return InkWell( + onTap: () { + setState(() { + _currentPage = _value; + }); + }, + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + width: 22, + height: 22, + child: Radio( + value: _value, + activeColor: _value == _currentPage ? Color(0xffD02127) : Color(0xffE8E8E8), + groupValue: _currentPage, + onChanged: (index) { + setState(() { + _currentPage = index; + }); + }, + ), + ), + SizedBox(width: 10), + Text( + _label, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + ), + ], + ), + ); + } + + void getInPatientAdmissionList() {} } diff --git a/lib/pages/medical/reports/report_list_widget.dart b/lib/pages/medical/reports/report_list_widget.dart index cc76214b..e47b8244 100644 --- a/lib/pages/medical/reports/report_list_widget.dart +++ b/lib/pages/medical/reports/report_list_widget.dart @@ -3,6 +3,7 @@ import 'package:diplomaticquarterapp/core/model/reports/Reports.dart'; import 'package:diplomaticquarterapp/core/service/medical/reports_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -55,9 +56,24 @@ class ReportListWidget extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ if (report.doctorName != null) - Text( - report.doctorName, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + report.doctorName, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text(DateUtil.getDayMonthYearDateFormatted(report.requestDate), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)), + Text(DateUtil.formatDateToTimeLang(report.requestDate, projectViewModel.isArabic), + style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 18 / 12)), + ], + ), + ], ), if (report.doctorName != null) SizedBox(height: 6), Row( @@ -93,14 +109,23 @@ class ReportListWidget extends StatelessWidget { emptyIcon: Icons.star_border, ), if (reportList[index].status == 2) - IconButton( - icon: Icon(Icons.email), - color: Color(0xff28323A), - constraints: BoxConstraints(), - padding: EdgeInsets.zero, - onPressed: () { - showConfirmMessage(reportList[index]); - }) + Row( + children: [ + Padding( + padding: const EdgeInsets.only(right: 11.0, left: 11.0), + child: Text(TranslationBase.of(context).viewReport, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, fontStyle: FontStyle.italic, color: CustomColors.accentColor, letterSpacing: -0.48, height: 18 / 12, decoration: TextDecoration.underline)), + ), + IconButton( + icon: Icon(Icons.email), + color: Color(0xff28323A), + constraints: BoxConstraints(), + padding: EdgeInsets.zero, + onPressed: () { + showConfirmMessage(reportList[index]); + }) + ], + ), ], ), ], diff --git a/lib/pages/webRTC/call_page.dart b/lib/pages/webRTC/call_page.dart index 8a5625b2..b9f444d1 100644 --- a/lib/pages/webRTC/call_page.dart +++ b/lib/pages/webRTC/call_page.dart @@ -1,164 +1,164 @@ -import 'dart:io'; - -import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; -import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; -import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; -import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:firebase_messaging/firebase_messaging.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart'; - -class CallPage extends StatefulWidget { - @override - _CallPageState createState() => _CallPageState(); -} - -class _CallPageState extends State { - Signaling signaling = Signaling(); - RTCVideoRenderer _localRenderer = RTCVideoRenderer(); - RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); - String roomId; - TextEditingController textEditingController = TextEditingController(text: ''); - - @override - void initState() { - _localRenderer.initialize(); - _remoteRenderer.initialize(); - - // signaling.onRemoteStream = ((stream) { - // _remoteRenderer.srcObject = stream; - // setState(() {}); - // }); - - fcmConfigure(); - - super.initState(); - } - - @override - void dispose() { - _localRenderer.dispose(); - _remoteRenderer.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - FirebaseMessaging.instance.getToken().then((value) { - print('FCM_TOKEN: $value'); - }); - - return AppScaffold( - isShowAppBar: true, - showNewAppBar: true, - showNewAppBarTitle: true, - isShowDecPage: false, - appBarTitle: "WebRTC Calling", - body: Column( - children: [ - SizedBox(height: 8), - Wrap( - children: [ - SizedBox( - width: 8, - ), - ElevatedButton( - onPressed: () { - dummyCall(); - }, - child: Text("Call"), - ), - SizedBox( - width: 8, - ), - ElevatedButton( - onPressed: () { - signaling.hangUp(_localRenderer); - }, - child: Text("Hangup"), - ) - ], - ), - SizedBox(height: 8), - Expanded( - child: Padding( - padding: const EdgeInsets.all(0.0), - child: Stack( - children: [ - Positioned(top: 0.0, right: 0.0, left: 0.0, bottom: 0.0, child: RTCVideoView(_remoteRenderer)), - Positioned( - top: 20.0, - right: 100.0, - left: 20.0, - bottom: 300.0, - child: RTCVideoView(_localRenderer, mirror: true), - ), - ], - ), - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text("Join the following Room: "), - Flexible( - child: TextFormField( - controller: textEditingController, - ), - ) - ], - ), - ), - SizedBox(height: 8) - ], - ), - ); - } - - dummyCall() async { - final json = { - "callerID": "9920", - "receiverID": "2001273", - "msgID": "123", - "notfID": "123", - "notification_foreground": "true", - "count": "1", - "message": "Doctor is calling ", - "AppointmentNo": "123", - "title": "Rayyan Hospital", - "ProjectID": "123", - "NotificationType": "10", - "background": "1", - "doctorname": "Dr Sulaiman Al Habib", - "clinicname": "ENT Clinic", - "speciality": "Speciality", - "appointmentdate": "Sun, 15th Dec, 2019", - "appointmenttime": "09:00", - "type": "video", - "session_id": - "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk", - "identity": "Haroon1", - "name": "SmallDailyStandup", - "videoUrl": "video", - "picture": "video", - "is_call": "true" - }; - - IncomingCallData incomingCallData = IncomingCallData.fromJson(json); - final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData))); - } - - fcmConfigure() { - FirebaseMessaging.onMessage.listen((RemoteMessage message) async { - print(message.toString()); - - IncomingCallData incomingCallData; - if (Platform.isAndroid) - incomingCallData = IncomingCallData.fromJson(message.data['data']); - else if (Platform.isIOS) incomingCallData = IncomingCallData.fromJson(message.data); - if (incomingCallData != null) final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData))); - }); - } -} +// import 'dart:io'; +// +// import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; +// import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; +// import 'package:diplomaticquarterapp/pages/webRTC/signaling.dart'; +// import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; +// import 'package:firebase_messaging/firebase_messaging.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_webrtc/flutter_webrtc.dart'; +// +// class CallPage extends StatefulWidget { +// @override +// _CallPageState createState() => _CallPageState(); +// } +// +// class _CallPageState extends State { +// Signaling signaling = Signaling(); +// RTCVideoRenderer _localRenderer = RTCVideoRenderer(); +// RTCVideoRenderer _remoteRenderer = RTCVideoRenderer(); +// String roomId; +// TextEditingController textEditingController = TextEditingController(text: ''); +// +// @override +// void initState() { +// _localRenderer.initialize(); +// _remoteRenderer.initialize(); +// +// // signaling.onRemoteStream = ((stream) { +// // _remoteRenderer.srcObject = stream; +// // setState(() {}); +// // }); +// +// fcmConfigure(); +// +// super.initState(); +// } +// +// @override +// void dispose() { +// _localRenderer.dispose(); +// _remoteRenderer.dispose(); +// super.dispose(); +// } +// +// @override +// Widget build(BuildContext context) { +// FirebaseMessaging.instance.getToken().then((value) { +// print('FCM_TOKEN: $value'); +// }); +// +// return AppScaffold( +// isShowAppBar: true, +// showNewAppBar: true, +// showNewAppBarTitle: true, +// isShowDecPage: false, +// appBarTitle: "WebRTC Calling", +// body: Column( +// children: [ +// SizedBox(height: 8), +// Wrap( +// children: [ +// SizedBox( +// width: 8, +// ), +// ElevatedButton( +// onPressed: () { +// dummyCall(); +// }, +// child: Text("Call"), +// ), +// SizedBox( +// width: 8, +// ), +// ElevatedButton( +// onPressed: () { +// signaling.hangUp(_localRenderer); +// }, +// child: Text("Hangup"), +// ) +// ], +// ), +// SizedBox(height: 8), +// Expanded( +// child: Padding( +// padding: const EdgeInsets.all(0.0), +// child: Stack( +// children: [ +// Positioned(top: 0.0, right: 0.0, left: 0.0, bottom: 0.0, child: RTCVideoView(_remoteRenderer)), +// Positioned( +// top: 20.0, +// right: 100.0, +// left: 20.0, +// bottom: 300.0, +// child: RTCVideoView(_localRenderer, mirror: true), +// ), +// ], +// ), +// ), +// ), +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Row( +// mainAxisAlignment: MainAxisAlignment.center, +// children: [ +// Text("Join the following Room: "), +// Flexible( +// child: TextFormField( +// controller: textEditingController, +// ), +// ) +// ], +// ), +// ), +// SizedBox(height: 8) +// ], +// ), +// ); +// } +// +// dummyCall() async { +// final json = { +// "callerID": "9920", +// "receiverID": "2001273", +// "msgID": "123", +// "notfID": "123", +// "notification_foreground": "true", +// "count": "1", +// "message": "Doctor is calling ", +// "AppointmentNo": "123", +// "title": "Rayyan Hospital", +// "ProjectID": "123", +// "NotificationType": "10", +// "background": "1", +// "doctorname": "Dr Sulaiman Al Habib", +// "clinicname": "ENT Clinic", +// "speciality": "Speciality", +// "appointmentdate": "Sun, 15th Dec, 2019", +// "appointmenttime": "09:00", +// "type": "video", +// "session_id": +// "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImN0eSI6InR3aWxpby1mcGE7dj0xIn0.eyJqdGkiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0LTE1OTg3NzQ1MDYiLCJpc3MiOiJTS2I2NjYyOWMzN2ZhOTM3YjFjNDI2Zjg1MTgyNWFmN2M0Iiwic3ViIjoiQUNhYWQ1YTNmOGM2NGZhNjczNTY3NTYxNTc0N2YyNmMyYiIsImV4cCI6MTU5ODc3ODEwNiwiZ3JhbnRzIjp7ImlkZW50aXR5IjoiSGFyb29uMSIsInZpZGVvIjp7InJvb20iOiJTbWFsbERhaWx5U3RhbmR1cCJ9fX0.7XUS5uMQQJfkrBZu9EjQ6STL6R7iXkso6BtO1HmrQKk", +// "identity": "Haroon1", +// "name": "SmallDailyStandup", +// "videoUrl": "video", +// "picture": "video", +// "is_call": "true" +// }; +// +// IncomingCallData incomingCallData = IncomingCallData.fromJson(json); +// final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData))); +// } +// +// fcmConfigure() { +// FirebaseMessaging.onMessage.listen((RemoteMessage message) async { +// print(message.toString()); +// +// IncomingCallData incomingCallData; +// if (Platform.isAndroid) +// incomingCallData = IncomingCallData.fromJson(message.data['data']); +// else if (Platform.isIOS) incomingCallData = IncomingCallData.fromJson(message.data); +// if (incomingCallData != null) final result = await Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: incomingCallData))); +// }); +// } +// } diff --git a/lib/pages/webRTC/signaling.dart b/lib/pages/webRTC/signaling.dart index 9a4d1c48..028de903 100644 --- a/lib/pages/webRTC/signaling.dart +++ b/lib/pages/webRTC/signaling.dart @@ -1,277 +1,277 @@ -import 'dart:convert'; - -import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart'; - -typedef void StreamStateCallback(MediaStream stream); -typedef void RTCIceGatheringStateCallback(RTCIceGatheringState state); -typedef void RTCPeerConnectionStateCallback(RTCPeerConnectionState state); -typedef void RTCSignalingStateCallback(RTCSignalingState state); - -final Map constraints = { - 'mandatory': {}, - 'optional': [ - {'DtlsSrtpKeyAgreement': true}, - ] -}; - -Map snapsis_ice_config = { - 'iceServers': [ - { "urls": 'stun:15.185.116.59:3478' }, - { "urls": "turn:15.185.116.59:3479", "username": "admin", "credential": "admin" }, - ], - // 'sdpSemantics': 'unified-plan' -}; -Map twilio_ice_config = { - "ice_servers": [ - { - "url": "stun:global.stun.twilio.com:3478?transport=udp", - "urls": "stun:global.stun.twilio.com:3478?transport=udp" - }, - { - "url": "turn:global.turn.twilio.com:3478?transport=udp", - "username": "ce8042842b62c21bd20b176f80d6067fd3db81b1e9766312418ef5421d9ca2a2", - "urls": "turn:global.turn.twilio.com:3478?transport=udp", - "credential": "UzGOsiLwPZJ32cjafAebfDDpVrqeQjgpFHZEdau/8r4=" - }, - { - "url": "turn:global.turn.twilio.com:3478?transport=tcp", - "username": "ce8042842b62c21bd20b176f80d6067fd3db81b1e9766312418ef5421d9ca2a2", - "urls": "turn:global.turn.twilio.com:3478?transport=tcp", - "credential": "UzGOsiLwPZJ32cjafAebfDDpVrqeQjgpFHZEdau/8r4=" - }, - { - "url": "turn:global.turn.twilio.com:443?transport=tcp", - "username": "ce8042842b62c21bd20b176f80d6067fd3db81b1e9766312418ef5421d9ca2a2", - "urls": "turn:global.turn.twilio.com:443?transport=tcp", - "credential": "UzGOsiLwPZJ32cjafAebfDDpVrqeQjgpFHZEdau/8r4=" - } - ], - // 'sdpSemantics': 'unified-plan' -}; -Map google_ice_config = { - 'iceServers': [ - { - 'urls': [ - 'stun:stun.l.google.com:19302', - 'stun:stun1.l.google.com:19302', - 'stun:stun2.l.google.com:19302', - 'stun:stun3.l.google.com:19302' - ] - }, - ], - // 'sdpSemantics': 'unified-plan' -}; -Map aws_ice_config = { - 'iceServers': [ - {'url': "stun:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3478"}, - {'url': "turn:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3479", 'credential': "admin", 'username': "admin"} - ], - // 'sdpSemantics': 'unified-plan' -}; - -class Signaling { - dispose() { - if (peerConnection != null) { - peerConnection.dispose(); - peerConnection.getLocalStreams().forEach((e) => e.dispose()); - peerConnection.getRemoteStreams().forEach((e) => e.dispose()); - } - signalR.closeConnection(); - } - - init() async{ - // Create Peer Connection - peerConnection = await createPeerConnection(google_ice_config, constraints); - registerPeerConnectionListeners(); - } - - initializeSignalR(String userName) async { - if (signalR != null) await signalR.closeConnection(); - // https://vcallapi.hmg.com/webRTCHub?source=web&username=zohaib - // signalR = SignalRUtil(hubName: "https://vcallapi.hmg.com/webRTCHub?source=mobile&username=$userName"); - signalR = SignalRUtil(hubName: "http://35.193.237.29/webRTCHub?source=mobile&username=$userName"); - final connected = await signalR.openConnection(); - if (!connected) throw 'Failed to connect SignalR'; - } - - Map configuration = { - // 'iceServers': [ - // { - // 'urls': ['stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302'] - // } - // ] - - 'iceServers': [ - // {'url': "stun:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3478"}, - // {'url': "turn:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3479", 'credential': "admin", 'username': "admin"} - // {'url': "stun:15.185.116.59:3478"}, - // { - // "url":"turn:15.185.116.59:3479", - // "username": "admin", - // "credential":"admin" - // } - { - "url": "stun:global.stun.twilio.com:3478?transport=udp", - "urls": "stun:global.stun.twilio.com:3478?transport=udp" - }, - { - "url": "turn:global.turn.twilio.com:3478?transport=udp", - "username": "f18fc347ba4aeeaa1b00f5199b1e900834b464962d434a4a89b4cdba02510047", - "urls": "turn:global.turn.twilio.com:3478?transport=udp", - "credential": "WX16BB+9nKm0f+Whf5EwpM8S/Yv+T2tlvQWLfdV7oqo=" - } - ] - }; - - SignalRUtil signalR; - - RTCPeerConnection peerConnection; - MediaStream localStream; - MediaStream remoteStream; - RTCDataChannel dataChannel; - - // Future call(String patientId, String mobile, {@required RTCVideoRenderer localVideo, @required RTCVideoRenderer remoteVideo}) async { - // await initializeSignalR(patientId); - // - // // final isCallPlaced = await FCM.sendCallNotifcationTo(DOCTOR_TOKEN, patientId, mobile); - // if(!isCallPlaced) - // throw 'Failed to notify target for call'; - // - // return isCallPlaced; - // } - - Future acceptCall(String caller, String receiver, {@required MediaStream localMediaStream, @required Function(MediaStream) onRemoteMediaStream, @required Function(RTCTrackEvent) onRemoteTrack}) async { - await initializeSignalR(receiver); - signalR.setContributors(caller: caller, receiver: receiver); - await signalR.acceptCall(receiver, caller).catchError((e) => throw 'Failed to inform signalR that i accepted a call'); - - peerConnection.addStream(localMediaStream); - - // peerConnection?.onTrack = (track){ - // onRemoteTrack(track); - // }; - peerConnection?.onAddStream = (MediaStream stream) { - remoteStream = stream; - onRemoteMediaStream?.call(stream); - }; - return true; - } - - - Future declineCall(String caller, String receiver) async { - await initializeSignalR(receiver); - signalR.setContributors(caller: caller, receiver: receiver); - await signalR.declineCall(receiver, caller).catchError((e) => throw 'Failed to inform signalR that i accepted a call'); - - // peerConnection.addStream(localMediaStream); - // - // peerConnection?.onAddStream = (MediaStream stream) { - // remoteStream = stream; - // onRemoteMediaStream?.call(stream); - // }; - return true; - } - - Future hangupCall(String caller, String receiver) async { - await signalR.hangupCall(caller, receiver); - dispose(); - } - - answerOffer(String sdp) async { - final offer = jsonDecode(sdp); - final caller = offer['caller']; - final receiver = offer['target']; - final offerSdp = offer['sdp']; - peerConnection.setRemoteDescription(rtcSessionDescriptionFrom(offerSdp)).then((value) { - return peerConnection.createAnswer().catchError((e){ - print(e); - }); - }).then((anwser) { - return peerConnection.setLocalDescription(anwser).catchError((e){ - print(e); - }); - }).then((value) { - return peerConnection.getLocalDescription().catchError((e){ - print(e); - }); - }).then((answer) { - return signalR.answerOffer(answer, caller, receiver).catchError((e){ - print(e); - }); - }).catchError((e) { - print(e); - }); - } - - Future hangUp(RTCVideoRenderer localVideo) async {} - - Future createSdpAnswer(String toOfferSdp) async { - final offerSdp = rtcSessionDescriptionFrom(jsonDecode(toOfferSdp)); - peerConnection.setRemoteDescription(offerSdp).catchError((e){ - print(e); - }); - - final answer = await peerConnection.createAnswer().catchError((e){ - print(e); - }); - var answerSdp = json.encode(answer); // Send SDP via Push or any channel - return answerSdp; - } - - Future createSdpOffer() async { - final offer = await peerConnection.createOffer(); - await peerConnection.setLocalDescription(offer).catchError((e){ - print(e); - }); - final map = offer.toMap(); - var offerSdp = json.encode(map); // Send SDP via Push or any channel - return offerSdp; - } - - addCandidate(String candidateJson) { - peerConnection.addCandidate(rtcIceCandidateFrom(candidateJson)).catchError((e){ - print(e); - }); - } - - void registerPeerConnectionListeners() { - peerConnection.onRenegotiationNeeded = (){ - print('Renegotiation Needed...'); - }; - - peerConnection.onIceCandidate = (RTCIceCandidate candidate) { - // print(json.encode(candidate.toMap())); - signalR.addIceCandidate(json.encode(candidate.toMap())).catchError((e){ - print(e); - }); - }; - - peerConnection?.onIceGatheringState = (RTCIceGatheringState state) { - print('ICE gathering state changed: $state'); - }; - - peerConnection?.onConnectionState = (RTCPeerConnectionState state) { - print('Connection state change: $state'); - }; - - peerConnection?.onSignalingState = (RTCSignalingState state) { - print('Signaling state change: $state'); - }; - - - } -} - -rtcSessionDescriptionFrom(Map sdp) { - return RTCSessionDescription( - sdp['sdp'], - sdp['type'], - ); -} - -rtcIceCandidateFrom(String json) { - final map = jsonDecode(json)['candidate']; - return RTCIceCandidate(map['candidate'], map['sdpMid'], map['sdpMLineIndex']); -} +// import 'dart:convert'; +// +// import 'package:diplomaticquarterapp/uitl/SignalRUtil.dart'; +// import 'package:flutter/cupertino.dart'; +// import 'package:flutter_webrtc/flutter_webrtc.dart'; +// +// typedef void StreamStateCallback(MediaStream stream); +// typedef void RTCIceGatheringStateCallback(RTCIceGatheringState state); +// typedef void RTCPeerConnectionStateCallback(RTCPeerConnectionState state); +// typedef void RTCSignalingStateCallback(RTCSignalingState state); +// +// final Map constraints = { +// 'mandatory': {}, +// 'optional': [ +// {'DtlsSrtpKeyAgreement': true}, +// ] +// }; +// +// Map snapsis_ice_config = { +// 'iceServers': [ +// { "urls": 'stun:15.185.116.59:3478' }, +// { "urls": "turn:15.185.116.59:3479", "username": "admin", "credential": "admin" }, +// ], +// // 'sdpSemantics': 'unified-plan' +// }; +// Map twilio_ice_config = { +// "ice_servers": [ +// { +// "url": "stun:global.stun.twilio.com:3478?transport=udp", +// "urls": "stun:global.stun.twilio.com:3478?transport=udp" +// }, +// { +// "url": "turn:global.turn.twilio.com:3478?transport=udp", +// "username": "ce8042842b62c21bd20b176f80d6067fd3db81b1e9766312418ef5421d9ca2a2", +// "urls": "turn:global.turn.twilio.com:3478?transport=udp", +// "credential": "UzGOsiLwPZJ32cjafAebfDDpVrqeQjgpFHZEdau/8r4=" +// }, +// { +// "url": "turn:global.turn.twilio.com:3478?transport=tcp", +// "username": "ce8042842b62c21bd20b176f80d6067fd3db81b1e9766312418ef5421d9ca2a2", +// "urls": "turn:global.turn.twilio.com:3478?transport=tcp", +// "credential": "UzGOsiLwPZJ32cjafAebfDDpVrqeQjgpFHZEdau/8r4=" +// }, +// { +// "url": "turn:global.turn.twilio.com:443?transport=tcp", +// "username": "ce8042842b62c21bd20b176f80d6067fd3db81b1e9766312418ef5421d9ca2a2", +// "urls": "turn:global.turn.twilio.com:443?transport=tcp", +// "credential": "UzGOsiLwPZJ32cjafAebfDDpVrqeQjgpFHZEdau/8r4=" +// } +// ], +// // 'sdpSemantics': 'unified-plan' +// }; +// Map google_ice_config = { +// 'iceServers': [ +// { +// 'urls': [ +// 'stun:stun.l.google.com:19302', +// 'stun:stun1.l.google.com:19302', +// 'stun:stun2.l.google.com:19302', +// 'stun:stun3.l.google.com:19302' +// ] +// }, +// ], +// // 'sdpSemantics': 'unified-plan' +// }; +// Map aws_ice_config = { +// 'iceServers': [ +// {'url': "stun:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3478"}, +// {'url': "turn:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3479", 'credential': "admin", 'username': "admin"} +// ], +// // 'sdpSemantics': 'unified-plan' +// }; +// +// class Signaling { +// dispose() { +// if (peerConnection != null) { +// peerConnection.dispose(); +// peerConnection.getLocalStreams().forEach((e) => e.dispose()); +// peerConnection.getRemoteStreams().forEach((e) => e.dispose()); +// } +// signalR.closeConnection(); +// } +// +// init() async{ +// // Create Peer Connection +// peerConnection = await createPeerConnection(google_ice_config, constraints); +// registerPeerConnectionListeners(); +// } +// +// initializeSignalR(String userName) async { +// if (signalR != null) await signalR.closeConnection(); +// // https://vcallapi.hmg.com/webRTCHub?source=web&username=zohaib +// // signalR = SignalRUtil(hubName: "https://vcallapi.hmg.com/webRTCHub?source=mobile&username=$userName"); +// signalR = SignalRUtil(hubName: "http://35.193.237.29/webRTCHub?source=mobile&username=$userName"); +// final connected = await signalR.openConnection(); +// if (!connected) throw 'Failed to connect SignalR'; +// } +// +// Map configuration = { +// // 'iceServers': [ +// // { +// // 'urls': ['stun:stun1.l.google.com:19302', 'stun:stun2.l.google.com:19302'] +// // } +// // ] +// +// 'iceServers': [ +// // {'url': "stun:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3478"}, +// // {'url': "turn:ec2-15-185-116-59.me-south-1.compute.amazonaws.com:3479", 'credential': "admin", 'username': "admin"} +// // {'url': "stun:15.185.116.59:3478"}, +// // { +// // "url":"turn:15.185.116.59:3479", +// // "username": "admin", +// // "credential":"admin" +// // } +// { +// "url": "stun:global.stun.twilio.com:3478?transport=udp", +// "urls": "stun:global.stun.twilio.com:3478?transport=udp" +// }, +// { +// "url": "turn:global.turn.twilio.com:3478?transport=udp", +// "username": "f18fc347ba4aeeaa1b00f5199b1e900834b464962d434a4a89b4cdba02510047", +// "urls": "turn:global.turn.twilio.com:3478?transport=udp", +// "credential": "WX16BB+9nKm0f+Whf5EwpM8S/Yv+T2tlvQWLfdV7oqo=" +// } +// ] +// }; +// +// SignalRUtil signalR; +// +// RTCPeerConnection peerConnection; +// MediaStream localStream; +// MediaStream remoteStream; +// RTCDataChannel dataChannel; +// +// // Future call(String patientId, String mobile, {@required RTCVideoRenderer localVideo, @required RTCVideoRenderer remoteVideo}) async { +// // await initializeSignalR(patientId); +// // +// // // final isCallPlaced = await FCM.sendCallNotifcationTo(DOCTOR_TOKEN, patientId, mobile); +// // if(!isCallPlaced) +// // throw 'Failed to notify target for call'; +// // +// // return isCallPlaced; +// // } +// +// Future acceptCall(String caller, String receiver, {@required MediaStream localMediaStream, @required Function(MediaStream) onRemoteMediaStream, @required Function(RTCTrackEvent) onRemoteTrack}) async { +// await initializeSignalR(receiver); +// signalR.setContributors(caller: caller, receiver: receiver); +// await signalR.acceptCall(receiver, caller).catchError((e) => throw 'Failed to inform signalR that i accepted a call'); +// +// peerConnection.addStream(localMediaStream); +// +// // peerConnection?.onTrack = (track){ +// // onRemoteTrack(track); +// // }; +// peerConnection?.onAddStream = (MediaStream stream) { +// remoteStream = stream; +// onRemoteMediaStream?.call(stream); +// }; +// return true; +// } +// +// +// Future declineCall(String caller, String receiver) async { +// await initializeSignalR(receiver); +// signalR.setContributors(caller: caller, receiver: receiver); +// await signalR.declineCall(receiver, caller).catchError((e) => throw 'Failed to inform signalR that i accepted a call'); +// +// // peerConnection.addStream(localMediaStream); +// // +// // peerConnection?.onAddStream = (MediaStream stream) { +// // remoteStream = stream; +// // onRemoteMediaStream?.call(stream); +// // }; +// return true; +// } +// +// Future hangupCall(String caller, String receiver) async { +// await signalR.hangupCall(caller, receiver); +// dispose(); +// } +// +// answerOffer(String sdp) async { +// final offer = jsonDecode(sdp); +// final caller = offer['caller']; +// final receiver = offer['target']; +// final offerSdp = offer['sdp']; +// peerConnection.setRemoteDescription(rtcSessionDescriptionFrom(offerSdp)).then((value) { +// return peerConnection.createAnswer().catchError((e){ +// print(e); +// }); +// }).then((anwser) { +// return peerConnection.setLocalDescription(anwser).catchError((e){ +// print(e); +// }); +// }).then((value) { +// return peerConnection.getLocalDescription().catchError((e){ +// print(e); +// }); +// }).then((answer) { +// return signalR.answerOffer(answer, caller, receiver).catchError((e){ +// print(e); +// }); +// }).catchError((e) { +// print(e); +// }); +// } +// +// Future hangUp(RTCVideoRenderer localVideo) async {} +// +// Future createSdpAnswer(String toOfferSdp) async { +// final offerSdp = rtcSessionDescriptionFrom(jsonDecode(toOfferSdp)); +// peerConnection.setRemoteDescription(offerSdp).catchError((e){ +// print(e); +// }); +// +// final answer = await peerConnection.createAnswer().catchError((e){ +// print(e); +// }); +// var answerSdp = json.encode(answer); // Send SDP via Push or any channel +// return answerSdp; +// } +// +// Future createSdpOffer() async { +// final offer = await peerConnection.createOffer(); +// await peerConnection.setLocalDescription(offer).catchError((e){ +// print(e); +// }); +// final map = offer.toMap(); +// var offerSdp = json.encode(map); // Send SDP via Push or any channel +// return offerSdp; +// } +// +// addCandidate(String candidateJson) { +// peerConnection.addCandidate(rtcIceCandidateFrom(candidateJson)).catchError((e){ +// print(e); +// }); +// } +// +// void registerPeerConnectionListeners() { +// peerConnection.onRenegotiationNeeded = (){ +// print('Renegotiation Needed...'); +// }; +// +// peerConnection.onIceCandidate = (RTCIceCandidate candidate) { +// // print(json.encode(candidate.toMap())); +// signalR.addIceCandidate(json.encode(candidate.toMap())).catchError((e){ +// print(e); +// }); +// }; +// +// peerConnection?.onIceGatheringState = (RTCIceGatheringState state) { +// print('ICE gathering state changed: $state'); +// }; +// +// peerConnection?.onConnectionState = (RTCPeerConnectionState state) { +// print('Connection state change: $state'); +// }; +// +// peerConnection?.onSignalingState = (RTCSignalingState state) { +// print('Signaling state change: $state'); +// }; +// +// +// } +// } +// +// rtcSessionDescriptionFrom(Map sdp) { +// return RTCSessionDescription( +// sdp['sdp'], +// sdp['type'], +// ); +// } +// +// rtcIceCandidateFrom(String json) { +// final map = jsonDecode(json)['candidate']; +// return RTCIceCandidate(map['candidate'], map['sdpMid'], map['sdpMLineIndex']); +// } diff --git a/lib/routes.dart b/lib/routes.dart index fe620bbd..7df15030 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -82,7 +82,7 @@ var routes = { APP_UPDATE: (_) => AppUpdatePage(), SETTINGS: (_) => Settings(), CART_ORDER_PAGE: (_) => CartOrderPage(), - CALL_PAGE: (_) => CallPage(), + // CALL_PAGE: (_) => CallPage(), INCOMING_CALL_PAGE: (_) => IncomingCall(), OPENTOK_CALL_PAGE: (_) => OpenTokConnectCallPage( apiKey: OPENTOK_API_KEY, diff --git a/lib/uitl/SignalRUtil.dart b/lib/uitl/SignalRUtil.dart index d9a73a14..de90981f 100644 --- a/lib/uitl/SignalRUtil.dart +++ b/lib/uitl/SignalRUtil.dart @@ -1,173 +1,173 @@ -import 'dart:convert'; -import 'dart:io'; - -import 'package:flutter/cupertino.dart'; -import 'package:flutter_webrtc/flutter_webrtc.dart'; -import 'package:http/io_client.dart'; -import 'package:signalr_core/signalr_core.dart'; - -class SignalRUtil { - String hubName; - - String sourceUser; - String destinationUser; - setContributors({@required String caller, @required String receiver}){ - this.sourceUser = caller; - this.destinationUser = receiver; - } - - Function(bool) onConnected; - SignalRUtil({@required this.hubName}); - - - HubConnection connectionHub; - - closeConnection() async{ - if(connectionHub != null) { - connectionHub.off('OnIncomingCallAsync'); - connectionHub.off('OnCallDeclinedAsync'); - connectionHub.off('OnCallAcceptedAsync'); - connectionHub.off('nHangUpAsync'); - connectionHub.off('OnIceCandidateAsync'); - connectionHub.off('OnOfferAsync'); - await connectionHub.stop(); - } - } - - Future openConnection() async { - connectionHub = HubConnectionBuilder() - .withUrl( - hubName, - HttpConnectionOptions( - logMessageContent: true, - client: IOClient(HttpClient()..badCertificateCallback = (x, y, z) => true), - logging: (level, message) => print(message), - )).build(); - - await connectionHub.start(); - await Future.delayed(Duration(seconds: 1)); - - connectionHub.on('ReceiveMessage', (message) { - handleIncomingMessage(message); - }); - - return getConnectionState(); - } - - void handleIncomingMessage(List message) { - print(message.toString()); - } - - void sendMessage(List args) async { - await connectionHub.invoke('SendMessage', args: args); //['Bob', 'Says hi!'] - } - - listen({Function(CallUser) onAcceptCall, Function(CallUser) onHangupCall, Function(String, CallUser) onDeclineCall, Function(String, CallUser) onOffer, Function(String) onCandidate}){ - - connectionHub.on('OnIncomingCallAsync', (arguments) { - print('OnIncomingCallAsync: ${arguments.toString()}'); - }); - - connectionHub.on('OnCallDeclinedAsync', (arguments) { - print('OnCallDeclinedAsync: ${arguments.toString()}'); - onDeclineCall(arguments.first, CallUser.from(arguments.last)); - }); - - connectionHub.on('OnCallAcceptedAsync', (arguments) { - print('OnCallAcceptedAsync: ${arguments.toString()}'); - }); - - connectionHub.on('OnHangUpAsync', (arguments) { - print('nHangUpAsync: ${arguments.toString()}'); - onHangupCall(CallUser.from(arguments.first)); - }); - - connectionHub.on('OnIceCandidateAsync', (arguments) { - print('OnIceCandidateAsync: ${arguments.toString()}'); - onCandidate(arguments.first); - }); - - connectionHub.on('OnOfferAsync', (arguments) { - print('OnOfferAsync: ${arguments.toString()}'); - onOffer(arguments.first, CallUser.from(arguments.last)); - }); - - } - - // CallUserAsync(string currentUserId, string targerUserId) - Future callUser(String from, to) async{ - return await connectionHub.invoke('CallUserAsync', args: [from, to]); - } - - // CallDeclinedAsync(string currentUserId, string targerUserId) - Future declineCall(String from, to) async{ - return await connectionHub.invoke('CallDeclinedAsync', args: [from, to]); - } - - // AnswerCallAsync(string currentUserId, string targetUserId) - Future answerCall(String from, to) async{ - return await connectionHub.invoke('AnswerCallAsync', args: [from, to]); - } - - // IceCandidateAsync(string targetUserId, string candidate) - Future addIceCandidate(String candidate) async{ - final target = destinationUser; - return await connectionHub.invoke('IceCandidateAsync', args: [target, candidate]); - } - - // OfferAsync(string targetUserId,string currentUserId, string targetOffer) - Future offer(String from, to, offer) async{ - return await connectionHub.invoke('OfferAsync', args: [from, to, offer]); - } - - // AnswerOfferAsync(string targetUserId, string CallerOffer) - Future answerOffer(RTCSessionDescription answerSdp, caller, receiver) async{ - final payload = { - 'target': receiver, - 'caller': caller, - 'sdp': answerSdp.toMap(), - }; - return await connectionHub.invoke('AnswerOfferAsync', args: [caller, jsonEncode(payload)]); - } - - // HangUpAsync(string currentUserId, string targetUserId) - Future hangupCall(String from, to) async{ - return await connectionHub.invoke('HangUpAsync', args: [from, to]); - } - - // CallAccepted(string currentUserId,string targetUserId) - Future acceptCall(String from, to) async{ - // return await connectionHub.send(methodName: 'CallAccepted', args: [from, to]); - return await connectionHub.invoke("CallAccepted", args: [ from, to]); - } - - - bool getConnectionState() { - if (connectionHub.state == HubConnectionState.connected) return true; - if (connectionHub.state == HubConnectionState.disconnected) return false; - return false; - } -} - - -class CallUser{ - String Id; - String UserName; - String Email; - String Phone; - String Title; - dynamic UserStatus; - String Image; - int UnreadMessageCount = 0; - - CallUser.from(Map map){ - Id = map['Id']; - UserName = map['UserName']; - Email = map['Email']; - Phone = map['Phone']; - Title = map['Title']; - UserStatus = map['UserStatus']; - Image = map['Image']; - UnreadMessageCount = map['UnreadMessageCount']; - } -} \ No newline at end of file +// import 'dart:convert'; +// import 'dart:io'; +// +// import 'package:flutter/cupertino.dart'; +// import 'package:flutter_webrtc/flutter_webrtc.dart'; +// import 'package:http/io_client.dart'; +// import 'package:signalr_core/signalr_core.dart'; +// +// class SignalRUtil { +// String hubName; +// +// String sourceUser; +// String destinationUser; +// setContributors({@required String caller, @required String receiver}){ +// this.sourceUser = caller; +// this.destinationUser = receiver; +// } +// +// Function(bool) onConnected; +// SignalRUtil({@required this.hubName}); +// +// +// HubConnection connectionHub; +// +// closeConnection() async{ +// if(connectionHub != null) { +// connectionHub.off('OnIncomingCallAsync'); +// connectionHub.off('OnCallDeclinedAsync'); +// connectionHub.off('OnCallAcceptedAsync'); +// connectionHub.off('nHangUpAsync'); +// connectionHub.off('OnIceCandidateAsync'); +// connectionHub.off('OnOfferAsync'); +// await connectionHub.stop(); +// } +// } +// +// Future openConnection() async { +// connectionHub = HubConnectionBuilder() +// .withUrl( +// hubName, +// HttpConnectionOptions( +// logMessageContent: true, +// client: IOClient(HttpClient()..badCertificateCallback = (x, y, z) => true), +// logging: (level, message) => print(message), +// )).build(); +// +// await connectionHub.start(); +// await Future.delayed(Duration(seconds: 1)); +// +// connectionHub.on('ReceiveMessage', (message) { +// handleIncomingMessage(message); +// }); +// +// return getConnectionState(); +// } +// +// void handleIncomingMessage(List message) { +// print(message.toString()); +// } +// +// void sendMessage(List args) async { +// await connectionHub.invoke('SendMessage', args: args); //['Bob', 'Says hi!'] +// } +// +// listen({Function(CallUser) onAcceptCall, Function(CallUser) onHangupCall, Function(String, CallUser) onDeclineCall, Function(String, CallUser) onOffer, Function(String) onCandidate}){ +// +// connectionHub.on('OnIncomingCallAsync', (arguments) { +// print('OnIncomingCallAsync: ${arguments.toString()}'); +// }); +// +// connectionHub.on('OnCallDeclinedAsync', (arguments) { +// print('OnCallDeclinedAsync: ${arguments.toString()}'); +// onDeclineCall(arguments.first, CallUser.from(arguments.last)); +// }); +// +// connectionHub.on('OnCallAcceptedAsync', (arguments) { +// print('OnCallAcceptedAsync: ${arguments.toString()}'); +// }); +// +// connectionHub.on('OnHangUpAsync', (arguments) { +// print('nHangUpAsync: ${arguments.toString()}'); +// onHangupCall(CallUser.from(arguments.first)); +// }); +// +// connectionHub.on('OnIceCandidateAsync', (arguments) { +// print('OnIceCandidateAsync: ${arguments.toString()}'); +// onCandidate(arguments.first); +// }); +// +// connectionHub.on('OnOfferAsync', (arguments) { +// print('OnOfferAsync: ${arguments.toString()}'); +// onOffer(arguments.first, CallUser.from(arguments.last)); +// }); +// +// } +// +// // CallUserAsync(string currentUserId, string targerUserId) +// Future callUser(String from, to) async{ +// return await connectionHub.invoke('CallUserAsync', args: [from, to]); +// } +// +// // CallDeclinedAsync(string currentUserId, string targerUserId) +// Future declineCall(String from, to) async{ +// return await connectionHub.invoke('CallDeclinedAsync', args: [from, to]); +// } +// +// // AnswerCallAsync(string currentUserId, string targetUserId) +// Future answerCall(String from, to) async{ +// return await connectionHub.invoke('AnswerCallAsync', args: [from, to]); +// } +// +// // IceCandidateAsync(string targetUserId, string candidate) +// Future addIceCandidate(String candidate) async{ +// final target = destinationUser; +// return await connectionHub.invoke('IceCandidateAsync', args: [target, candidate]); +// } +// +// // OfferAsync(string targetUserId,string currentUserId, string targetOffer) +// Future offer(String from, to, offer) async{ +// return await connectionHub.invoke('OfferAsync', args: [from, to, offer]); +// } +// +// // AnswerOfferAsync(string targetUserId, string CallerOffer) +// Future answerOffer(RTCSessionDescription answerSdp, caller, receiver) async{ +// final payload = { +// 'target': receiver, +// 'caller': caller, +// 'sdp': answerSdp.toMap(), +// }; +// return await connectionHub.invoke('AnswerOfferAsync', args: [caller, jsonEncode(payload)]); +// } +// +// // HangUpAsync(string currentUserId, string targetUserId) +// Future hangupCall(String from, to) async{ +// return await connectionHub.invoke('HangUpAsync', args: [from, to]); +// } +// +// // CallAccepted(string currentUserId,string targetUserId) +// Future acceptCall(String from, to) async{ +// // return await connectionHub.send(methodName: 'CallAccepted', args: [from, to]); +// return await connectionHub.invoke("CallAccepted", args: [ from, to]); +// } +// +// +// bool getConnectionState() { +// if (connectionHub.state == HubConnectionState.connected) return true; +// if (connectionHub.state == HubConnectionState.disconnected) return false; +// return false; +// } +// } +// +// +// class CallUser{ +// String Id; +// String UserName; +// String Email; +// String Phone; +// String Title; +// dynamic UserStatus; +// String Image; +// int UnreadMessageCount = 0; +// +// CallUser.from(Map map){ +// Id = map['Id']; +// UserName = map['UserName']; +// Email = map['Email']; +// Phone = map['Phone']; +// Title = map['Title']; +// UserStatus = map['UserStatus']; +// Image = map['Image']; +// UnreadMessageCount = map['UnreadMessageCount']; +// } +// } \ No newline at end of file diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index a9a4b4bb..534b0540 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2896,6 +2896,7 @@ class TranslationBase { String get comments => localizedValues["comments"][locale.languageCode]; String get rateDoctorResponseHeading => localizedValues["rateDoctorResponseHeading"][locale.languageCode]; String get updateInsuranceManuallyDialog => localizedValues["updateInsuranceManuallyDialog"][locale.languageCode]; + String get viewReport => localizedValues["viewReport"][locale.languageCode]; } diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index debf1656..4ae60764 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -454,10 +454,10 @@ class _AppDrawerState extends State { mHeight(12), InkWell( onTap: () { - Navigator.push(context, FadePage(page: CallPage())); - GifLoaderDialogUtils.showMyDialog(context); - HMGNetworkConnectivity(context).start(); - locator().hamburgerMenu.logMenuItemClick('cloud solution logo tap'); + // Navigator.push(context, FadePage(page: CallPage())); + // GifLoaderDialogUtils.showMyDialog(context); + // HMGNetworkConnectivity(context).start(); + // locator().hamburgerMenu.logMenuItemClick('cloud solution logo tap'); }, child: Row( crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/widgets/in_app_browser/InAppBrowser.dart b/lib/widgets/in_app_browser/InAppBrowser.dart index e91990b4..f38ad57c 100644 --- a/lib/widgets/in_app_browser/InAppBrowser.dart +++ b/lib/widgets/in_app_browser/InAppBrowser.dart @@ -24,9 +24,7 @@ enum _PAYMENT_TYPE { PACKAGES, PHARMACY, PATIENT } var _InAppBrowserOptions = InAppBrowserClassOptions( inAppWebViewGroupOptions: InAppWebViewGroupOptions( crossPlatform: InAppWebViewOptions(useShouldOverrideUrlLoading: true, transparentBackground: false), - ios: IOSInAppWebViewOptions( - applePayAPIEnabled: true, - )), + ios: IOSInAppWebViewOptions(applePayAPIEnabled: true, isFraudulentWebsiteWarningEnabled: false)), crossPlatform: InAppBrowserOptions(hideUrlBar: true, toolbarTopBackgroundColor: Colors.black), android: AndroidInAppBrowserOptions(), ios: IOSInAppBrowserOptions(hideToolbarBottom: true, toolbarBottomBackgroundColor: Colors.white, closeButtonColor: Colors.white, presentationStyle: IOSUIModalPresentationStyle.OVER_FULL_SCREEN)); @@ -127,17 +125,6 @@ class MyInAppBrowser extends InAppBrowser { this.deviceToken = deviceToken; } - // getPatientData() async { - // if (await this.sharedPref.getObject(USER_PROFILE) != null) { - // var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); - // authUser = data; - // } - // if (await this.sharedPref.getDouble(USER_LAT) != null && await this.sharedPref.getDouble(USER_LONG) != null) { - // lat = await this.sharedPref.getDouble(USER_LAT); - // long = await this.sharedPref.getDouble(USER_LONG); - // } - // } - openPackagesPaymentBrowser({@required int customer_id, @required int order_id}) { paymentType = _PAYMENT_TYPE.PACKAGES; var full_url = '$PACKAGES_REQUEST_PAYMENT_URL?customer_id=$customer_id&order_id=$order_id'; @@ -190,7 +177,7 @@ class MyInAppBrowser extends InAppBrowser { service.applePayInsertRequest(applePayInsertRequest, context).then((res) { if (context != null) GifLoaderDialogUtils.hideDialog(context); String url = "https://hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; // Prod - // String url = "https://uat.hmgwebservices.com/HMGApplePayLiveNew/applepay/pay?apq=" + res['result']; // UAT + // String url = "https://uat.hmgwebservices.com/HMGApplePayLive/applepay/pay?apq=" + res['result']; // UAT // safariBrowser.open(url: Uri.parse(url)); this.browser.openUrlRequest(urlRequest: URLRequest(url: Uri.parse(url)), options: _InAppBrowserOptions); }).catchError((err) { diff --git a/pubspec.yaml b/pubspec.yaml index 1c7c9b15..c19788d3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -95,7 +95,7 @@ dependencies: # Qr code Scanner TODO fix it # barcode_scanner: ^1.0.1 - flutter_polyline_points: ^1.0.0 +# flutter_polyline_points: ^1.0.0 location: ^4.3.0 # Qr code Scanner # barcode_scan_fix: ^1.0.2 @@ -183,7 +183,7 @@ dependencies: badges: ^2.0.1 flutter_app_icon_badge: ^2.0.0 - syncfusion_flutter_sliders: ^19.3.55 +# syncfusion_flutter_sliders: ^19.3.55 searchable_dropdown: ^1.1.3 dropdown_search: 0.4.9 youtube_player_flutter: ^8.0.0 @@ -191,17 +191,17 @@ dependencies: # Dep by Zohaib shimmer: ^2.0.0 carousel_slider: ^4.0.0 - flutter_material_pickers: ^3.1.2 +# flutter_material_pickers: ^3.1.2 flutter_staggered_grid_view: ^0.4.1 # flutter_hms_gms_availability: ^2.0.0 huawei_hmsavailability: ^6.6.0+300 huawei_location: 6.0.0+302 # Marker Animation - flutter_animarker: ^3.2.0 +# flutter_animarker: ^3.2.0 auto_size_text: ^3.0.0 equatable: ^2.0.3 - signalr_core: ^1.1.1 +# signalr_core: ^1.1.1 wave: ^0.2.0 # sms_retriever: ^1.0.0 sms_otp_auto_verify: ^2.1.0 From b92e45aa93459cad96be1915286aa2f75580c9eb Mon Sep 17 00:00:00 2001 From: haroon amjad Date: Mon, 7 Aug 2023 09:52:49 +0300 Subject: [PATCH 17/17] Updates & fixes --- lib/config/config.dart | 14 +- lib/config/localized_values.dart | 1 + .../admission_status_for_sick_leave.dart | 64 +++++ lib/core/service/medical/labs_service.dart | 18 ++ lib/extensions/string_extensions.dart | 16 +- .../livecare/widgets/LiveCareHistoryCard.dart | 1 + .../medical/patient_sick_leave_page.dart | 64 ++++- .../sickleave_workplace_update_page.dart | 2 +- .../appointment_services/GetDoctorsList.dart | 68 +++--- lib/uitl/LocalNotification.dart | 229 +++++++++--------- lib/uitl/translations_delegate_base.dart | 1 + lib/uitl/utils.dart | 5 + lib/widgets/drawer/app_drawer_widget.dart | 66 ++++- pubspec.yaml | 47 ++-- 14 files changed, 400 insertions(+), 196 deletions(-) create mode 100644 lib/core/model/sick_leave/admission_status_for_sick_leave.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 0fad39b1..73b647bf 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -19,9 +19,9 @@ var PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; var PACKAGES_ORDERS = '/api/orders'; var PACKAGES_ORDER_HISTORY = '/api/orders/items'; var PACKAGES_TAMARA_OPT = '/api/orders/paymentoptions/tamara'; - // var BASE_URL = 'http://10.50.100.198:2018/'; - // var BASE_URL = 'https://uat.hmgwebservices.com/'; -var BASE_URL = 'https://hmgwebservices.com/'; +// var BASE_URL = 'http://10.50.100.198:2018/'; +var BASE_URL = 'https://uat.hmgwebservices.com/'; +// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; @@ -88,6 +88,7 @@ var COVID_PASSPORT_UPDATE = 'Services/Patients.svc/REST/Covid19_Certificate_Pass var GET_PATIENT_PASSPORT_NUMBER = 'Services/Patients.svc/REST/Covid19_Certificate_GetPassport'; var UPDATE_WORKPLACE_NAME = 'Services/Patients.svc/REST/ActivateSickLeave_FromVida'; +var GET_SICKLEAVE_STATUS_ADMISSION_NO = 'Services/ChatBot_Service.svc/REST/GetSickLeaveStatusByAdmissionNo'; /// var GET_PATIENT_ORDERS = 'Services/Patients.svc/REST/GetPatientRadOrders'; @@ -324,7 +325,7 @@ var UPDATE_COVID_QUESTIONNAIRE = 'Services/Doctors.svc/REST/COVID19_Questionnari var CHANNEL = 3; var GENERAL_ID = 'Cs2020@2016\$2958'; var IP_ADDRESS = '10.20.10.20'; -var VERSION_ID = 10.6; +var VERSION_ID = 10.7; var SETUP_ID = '91877'; var LANGUAGE = 2; // var PATIENT_OUT_SA = 0; @@ -597,7 +598,10 @@ var CANCEL_PHARMA_LIVECARE_REQUEST = 'https://vcallapi.hmg.com/api/PharmaLiveCar var INSERT_FREE_SLOTS_LOGS = 'Services/Doctors.svc/Rest/InsertDoctorFreeSlotsLogs'; -var GET_NATIONALITY ='Services/Lists.svc/REST/GetNationality'; +var GET_NATIONALITY = 'Services/Lists.svc/REST/GetNationality'; + +var PAYFORT_TEST_URL = 'https://sbpaymentservices.payfort.com/FortAPI/paymentApi'; +var PAYFORT_PROD_URL = 'https://paymentservices.payfort.com/FortAPI/paymentApi'; class AppGlobal { static var context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index a69002f6..2336430b 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1889,4 +1889,5 @@ const Map localizedValues = { "rateDoctorResponseHeading": {"en": "Please rate the doctor response:", "ar": "يرجى تقييم استجابة الطبيب:"}, "updateInsuranceManuallyDialog": {"en": "Would you like to update your insurance manually?", "ar": "هل ترغب في تحديث التأمين الخاص بك يدويًا؟"}, "viewReport": {"en": "View Report", "ar": "عرض التقرير"}, + "sickLeaveAdmittedPatient": {"en": "You cannot activate this sick leave since you're an admitted patient.", "ar": "لا يمكنك تفعيل هذه الإجازة المرضية لأنك مريض مقبل."}, }; \ No newline at end of file diff --git a/lib/core/model/sick_leave/admission_status_for_sick_leave.dart b/lib/core/model/sick_leave/admission_status_for_sick_leave.dart new file mode 100644 index 00000000..e4ee923c --- /dev/null +++ b/lib/core/model/sick_leave/admission_status_for_sick_leave.dart @@ -0,0 +1,64 @@ +class AdmissionStatusForSickLeave { + String setupID; + int projectID; + int patientID; + int patientType; + int requestNo; + String requestDate; + int sickLeaveDays; + int appointmentNo; + int admissionNo; + String reportDate; + String placeOfWork; + int status; + dynamic dischargeDate; + + AdmissionStatusForSickLeave( + {this.setupID, + this.projectID, + this.patientID, + this.patientType, + this.requestNo, + this.requestDate, + this.sickLeaveDays, + this.appointmentNo, + this.admissionNo, + this.reportDate, + this.placeOfWork, + this.status, + this.dischargeDate}); + + AdmissionStatusForSickLeave.fromJson(Map json) { + setupID = json['SetupID']; + projectID = json['ProjectID']; + patientID = json['PatientID']; + patientType = json['PatientType']; + requestNo = json['RequestNo']; + requestDate = json['RequestDate']; + sickLeaveDays = json['SickLeaveDays']; + appointmentNo = json['AppointmentNo']; + admissionNo = json['AdmissionNo']; + reportDate = json['ReportDate']; + placeOfWork = json['PlaceOfWork']; + status = json['Status']; + dischargeDate = json['DischargeDate']; + } + + Map toJson() { + final Map data = new Map(); + data['SetupID'] = this.setupID; + data['ProjectID'] = this.projectID; + data['PatientID'] = this.patientID; + data['PatientType'] = this.patientType; + data['RequestNo'] = this.requestNo; + data['RequestDate'] = this.requestDate; + data['SickLeaveDays'] = this.sickLeaveDays; + data['AppointmentNo'] = this.appointmentNo; + data['AdmissionNo'] = this.admissionNo; + data['ReportDate'] = this.reportDate; + data['PlaceOfWork'] = this.placeOfWork; + data['Status'] = this.status; + data['DischargeDate'] = this.dischargeDate; + return data; + } +} diff --git a/lib/core/service/medical/labs_service.dart b/lib/core/service/medical/labs_service.dart index 078703df..714ebcb1 100644 --- a/lib/core/service/medical/labs_service.dart +++ b/lib/core/service/medical/labs_service.dart @@ -153,6 +153,24 @@ class LabsService extends BaseService { return Future.value(localRes); } + Future getSickLeaveStatusByAdmissionNo(int projectID, int admissionNo) async { + hasError = false; + Map body = Map(); + + body['AdmissionNo'] = admissionNo; + body['ProjectID'] = projectID; + + dynamic localRes; + + await baseAppClient.post(GET_SICKLEAVE_STATUS_ADMISSION_NO, onSuccess: (dynamic response, int statusCode) { + localRes = response; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: body); + return Future.value(localRes); + } + Future getPatientLabOrdersResults({PatientLabOrders patientLabOrder, String procedure}) async { hasError = false; Map body = Map(); diff --git a/lib/extensions/string_extensions.dart b/lib/extensions/string_extensions.dart index 6ba96b08..df9cb4f6 100644 --- a/lib/extensions/string_extensions.dart +++ b/lib/extensions/string_extensions.dart @@ -1,7 +1,19 @@ -extension CapExtension on String { +import 'dart:convert'; +import 'package:crypto/crypto.dart'; +extension CapExtension on String { String get toCamelCase => "${this[0].toUpperCase()}${this.substring(1)}"; + String get inCaps => '${this[0].toUpperCase()}${this.substring(1)}'; + String get allInCaps => this.toUpperCase(); - String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.isNotEmpty ? str.inCaps: str).join(" ") : ""; + + String get capitalizeFirstofEach => this.trim().length > 0 ? this.trim().toLowerCase().split(" ").map((str) => str.isNotEmpty ? str.inCaps : str).join(" ") : ""; +} + +extension HashSha on String { + String get toSha256 { + var bytes = utf8.encode(this); + return sha256.convert(bytes).toString(); + } } diff --git a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart index 9e08af05..cf89b766 100644 --- a/lib/pages/livecare/widgets/LiveCareHistoryCard.dart +++ b/lib/pages/livecare/widgets/LiveCareHistoryCard.dart @@ -243,6 +243,7 @@ class _LiveCareHistoryCardState extends State { GifLoaderDialogUtils.hideDialog(context); AppToast.showSuccessToast(message: TranslationBase.of(context).emailSentSuccessfully); }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); AppToast.showErrorToast(message: err.toString()); print(err); }); diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index 3d977a96..a82ff6b3 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -1,9 +1,15 @@ import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; +import 'package:diplomaticquarterapp/core/model/sick_leave/admission_status_for_sick_leave.dart'; +import 'package:diplomaticquarterapp/core/model/sick_leave/sick_leave.dart'; +import 'package:diplomaticquarterapp/core/service/medical/labs_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/patient_sick_leave_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/medical/sickleave_workplace_update_page.dart'; +import 'package:diplomaticquarterapp/uitl/app_toast.dart'; +import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/widgets/data_display/medical/doctor_card.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart'; @@ -110,20 +116,56 @@ class _PatientSickLeavePageState extends State { ); } - void openWorkPlaceUpdatePage(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) { + Future openWorkPlaceUpdatePage(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) async { + if (model.sickLeaveList[index].admissionNo != 0 && model.sickLeaveList[index].admissionNo != null) { + getSickLeaveStatusByAdmissionNo(requestNumber, setupID, model, index, projectID); + } else { + openWorkPlaceUpdatePageFunc(requestNumber, setupID, model, index, projectID); + } + } + + void getSickLeaveStatusByAdmissionNo(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) { + AdmissionStatusForSickLeave admissionStatusForSickLeave; + + LabsService service = new LabsService(); + GifLoaderDialogUtils.showMyDialog(context); + + service.getSickLeaveStatusByAdmissionNo(model.sickLeaveList[index].projectID, model.sickLeaveList[index].admissionNo).then((res) { + GifLoaderDialogUtils.hideDialog(context); + if (res["List_GetSickLeaveStatusByAdmissionNo"].length != 0) { + admissionStatusForSickLeave = AdmissionStatusForSickLeave.fromJson(res["List_GetSickLeaveStatusByAdmissionNo"][0]); + if (admissionStatusForSickLeave.status != 6) { + AppToast.showErrorToast(message: TranslationBase.of(context).sickLeaveAdmittedPatient); + } else { + openWorkPlaceUpdatePageFunc(requestNumber, setupID, model, index, projectID); + } + } else { + openWorkPlaceUpdatePageFunc(requestNumber, setupID, model, index, projectID); + } + }).catchError((err) { + GifLoaderDialogUtils.hideDialog(context); + print(err); + }); + } + + void openWorkPlaceUpdatePageFunc(int requestNumber, String setupID, PatientSickLeaveViewMode model, int index, int projectID) { Navigator.push( - context, - FadePage( - page: WorkplaceUpdatePage( + context, + FadePage( + page: WorkplaceUpdatePage( requestNumber: requestNumber, setupID: setupID, projectID: projectID, - ))).then((value) { - print(value); - if (value != null && value == true) { - model.getSickLeave(); - showEmailDialog(model, index); - } - }); + ), + ), + ).then( + (value) { + print(value); + if (value != null && value == true) { + model.getSickLeave(); + showEmailDialog(model, index); + } + }, + ); } } diff --git a/lib/pages/medical/sickleave_workplace_update_page.dart b/lib/pages/medical/sickleave_workplace_update_page.dart index 517f251c..60d9ef54 100644 --- a/lib/pages/medical/sickleave_workplace_update_page.dart +++ b/lib/pages/medical/sickleave_workplace_update_page.dart @@ -145,7 +145,7 @@ class _WorkplaceUpdatePageState extends State { keyboardType: TextInputType.name, controller: _controller, inputFormatters: [ - FilteringTextInputFormatter.allow(RegExp("[a-zA-Zء-ي ]")), + projectViewModel.isArabic ? FilteringTextInputFormatter.allow(RegExp("[ء-ي ]")) : FilteringTextInputFormatter.allow(RegExp("[a-zA-Z ]")), ], onChanged: (value) => {_onPassportTextChanged(value)}, style: TextStyle( diff --git a/lib/services/appointment_services/GetDoctorsList.dart b/lib/services/appointment_services/GetDoctorsList.dart index effa4445..51471790 100644 --- a/lib/services/appointment_services/GetDoctorsList.dart +++ b/lib/services/appointment_services/GetDoctorsList.dart @@ -1757,41 +1757,45 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } + Future getPayfortSDKTokenForPayment(String deviceID, String signatureValue, {bool isTest = true}) async { + Map request; + request = {"service_command": "SDK_TOKEN", "access_code": "BsM6He4FMBaZ86W64kjZ", "merchant_identifier": "ipxnRXXq", "language": "en", "device_id": deviceID, "signature": signatureValue}; + dynamic localRes; + await baseAppClient.post(isTest ? PAYFORT_TEST_URL : PAYFORT_PROD_URL, onSuccess: (response, statusCode) async { + localRes = response; + }, onFailure: (String error, int statusCode) { + throw error; + }, body: request, isExternal: true, isAllowAny: true); + return Future.value(localRes); + } - Future logDoctorFreeSlots(int docID, int clinicID, int projectID, List selectedfreeSlots, dynamic appoNumber, BuildContext context, [ProjectViewModel projectViewModel]) async { - Map requestFreeSlots; - Map request; - - var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); - Request req = appGlobal.getPublicRequest(); - requestFreeSlots = { - "DoctorID": docID, - "IsBookingForLiveCare": 0, - "ClinicID": clinicID, - "ProjectID": projectID, - "OriginalClinicID": clinicID, - "days": 0, - "isReschadual": false, - "VersionID": req.VersionID, - "Channel": 3, - "LanguageID": languageID == 'ar' ? 1 : 2, - "IPAdress": "10.20.10.20", - "generalid": "Cs2020@2016\$2958", - "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, - "SessionID": null, - "isDentalAllowedBackend": false, - "DeviceTypeID": 1 - }; - - request = { + Future logDoctorFreeSlots(int docID, int clinicID, int projectID, List selectedfreeSlots, dynamic appoNumber, BuildContext context, [ProjectViewModel projectViewModel]) async { + Map requestFreeSlots; + Map request; + + var languageID = await sharedPref.getStringWithDefaultValue(APP_LANGUAGE, 'ar'); + Request req = appGlobal.getPublicRequest(); + requestFreeSlots = { + "DoctorID": docID, + "IsBookingForLiveCare": 0, "ClinicID": clinicID, "ProjectID": projectID, - "AppointmentNo":appoNumber, - "DoctorFreeSlotRequest":requestFreeSlots, - "DoctorFreeSlotResponse":selectedfreeSlots, - "Value1":docID - }; + "OriginalClinicID": clinicID, + "days": 0, + "isReschadual": false, + "VersionID": req.VersionID, + "Channel": 3, + "LanguageID": languageID == 'ar' ? 1 : 2, + "IPAdress": "10.20.10.20", + "generalid": "Cs2020@2016\$2958", + "PatientOutSA": authProvider.isLogin ? authUser.outSA : 0, + "SessionID": null, + "isDentalAllowedBackend": false, + "DeviceTypeID": 1 + }; + + request = {"ClinicID": clinicID, "ProjectID": projectID, "AppointmentNo": appoNumber, "DoctorFreeSlotRequest": requestFreeSlots, "DoctorFreeSlotResponse": selectedfreeSlots, "Value1": docID}; dynamic localRes; await baseAppClient.post(INSERT_FREE_SLOTS_LOGS, onSuccess: (response, statusCode) async { localRes = response; @@ -1801,6 +1805,4 @@ class DoctorsListService extends BaseService { return Future.value(localRes); } - - } diff --git a/lib/uitl/LocalNotification.dart b/lib/uitl/LocalNotification.dart index af0db957..d7afaa90 100644 --- a/lib/uitl/LocalNotification.dart +++ b/lib/uitl/LocalNotification.dart @@ -35,39 +35,38 @@ class LocalNotification { var initializationSettings = InitializationSettings(android: initializationSettingsAndroid, iOS: initializationSettingsIOS); await flutterLocalNotificationsPlugin.initialize( initializationSettings, - onDidReceiveNotificationResponse: - (NotificationResponse notificationResponse) { + onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) { switch (notificationResponse.notificationResponseType) { case NotificationResponseType.selectedNotification: - // selectNotificationStream.add(notificationResponse.payload); + // selectNotificationStream.add(notificationResponse.payload); break; case NotificationResponseType.selectedNotificationAction: - // if (notificationResponse.actionId == navigationActionId) { - // selectNotificationStream.add(notificationResponse.payload); - // } + // if (notificationResponse.actionId == navigationActionId) { + // selectNotificationStream.add(notificationResponse.payload); + // } break; } }, onDidReceiveBackgroundNotificationResponse: notificationTapBackground, ); - } catch(ex) {} - // flutterLocalNotificationsPlugin.initialize(initializationSettings, onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) - // { - // switch (notificationResponse.notificationResponseType) { - // case NotificationResponseType.selectedNotification: - // // selectNotificationStream.add(notificationResponse.payload); - // break; - // case NotificationResponseType.selectedNotificationAction: - // // if (notificationResponse.actionId == navigationActionId) { - // // selectNotificationStream.add(notificationResponse.payload); - // } - // // break; - // },} - // - // , - // - // ); -} + } catch (ex) {} + // flutterLocalNotificationsPlugin.initialize(initializationSettings, onDidReceiveNotificationResponse: (NotificationResponse notificationResponse) + // { + // switch (notificationResponse.notificationResponseType) { + // case NotificationResponseType.selectedNotification: + // // selectNotificationStream.add(notificationResponse.payload); + // break; + // case NotificationResponseType.selectedNotificationAction: + // // if (notificationResponse.actionId == navigationActionId) { + // // selectNotificationStream.add(notificationResponse.payload); + // } + // // break; + // },} + // + // , + // + // ); + } void notificationTapBackground(NotificationResponse notificationResponse) { // ignore: avoid_print @@ -76,110 +75,106 @@ class LocalNotification { ' payload: ${notificationResponse.payload}'); if (notificationResponse.input?.isNotEmpty ?? false) { // ignore: avoid_print - print( - 'notification action tapped with input: ${notificationResponse.input}'); + print('notification action tapped with input: ${notificationResponse.input}'); } } -var _random = new Random(); + var _random = new Random(); -_randomNumber({int from = 100000}) { - return _random.nextInt(from); -} + _randomNumber({int from = 100000}) { + return _random.nextInt(from); + } -_vibrationPattern() { - var vibrationPattern = Int64List(4); - vibrationPattern[0] = 0; - vibrationPattern[1] = 1000; - vibrationPattern[2] = 5000; - vibrationPattern[3] = 2000; + _vibrationPattern() { + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + vibrationPattern[2] = 5000; + vibrationPattern[3] = 2000; - return vibrationPattern; -} + return vibrationPattern; + } -Future showNow({@required String title, @required String subtitle, String payload}) { - Future.delayed(Duration(seconds: 1)).then((result) async { - var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', - channelDescription: 'HMG', - importance: Importance.max, - priority: Priority.high, - ticker: 'ticker', - vibrationPattern: _vibrationPattern()); - var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); - var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { - print(err); + Future showNow({@required String title, @required String subtitle, String payload}) { + Future.delayed(Duration(seconds: 1)).then((result) async { + var androidPlatformChannelSpecifics = AndroidNotificationDetails('com.hmg.local_notification', 'HMG', + channelDescription: 'HMG', importance: Importance.max, priority: Priority.high, ticker: 'ticker', vibrationPattern: _vibrationPattern()); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.show(_randomNumber(), title, subtitle, platformChannelSpecifics, payload: payload).catchError((err) { + print(err); + }); }); - }); -} + } -Future scheduleNotification({@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { - ///vibrationPattern - var vibrationPattern = Int64List(4); - vibrationPattern[0] = 0; - vibrationPattern[1] = 1000; - vibrationPattern[2] = 5000; - vibrationPattern[3] = 2000; - - var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', - channelDescription: 'ActivePrescriptionsDescription', - // icon: 'secondary_icon', - sound: RawResourceAndroidNotificationSound('slow_spring_board'), - - ///change it to be as ionic - // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic - vibrationPattern: vibrationPattern, - enableLights: true, - color: const Color.fromARGB(255, 255, 0, 0), - ledColor: const Color.fromARGB(255, 255, 0, 0), - ledOnMs: 1000, - ledOffMs: 500); - var iOSPlatformChannelSpecifics = DarwinNotificationDetails(sound: 'slow_spring_board.aiff'); - - // /change it to be as ionic - var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); - await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); -} + Future scheduleNotification({@required DateTime scheduledNotificationDateTime, @required String title, @required String description}) async { + ///vibrationPattern + var vibrationPattern = Int64List(4); + vibrationPattern[0] = 0; + vibrationPattern[1] = 1000; + vibrationPattern[2] = 5000; + vibrationPattern[3] = 2000; + + var androidPlatformChannelSpecifics = AndroidNotificationDetails('active-prescriptions', 'ActivePrescriptions', + channelDescription: 'ActivePrescriptionsDescription', + // icon: 'secondary_icon', + sound: RawResourceAndroidNotificationSound('slow_spring_board'), + + ///change it to be as ionic + // largeIcon: DrawableResourceAndroidBitmap('sample_large_icon'),///change it to be as ionic + vibrationPattern: vibrationPattern, + enableLights: true, + color: const Color.fromARGB(255, 255, 0, 0), + ledColor: const Color.fromARGB(255, 255, 0, 0), + ledOnMs: 1000, + ledOffMs: 500); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(sound: 'slow_spring_board.aiff'); + + // /change it to be as ionic + var platformChannelSpecifics = NotificationDetails(android: androidPlatformChannelSpecifics, iOS: iOSPlatformChannelSpecifics); + await flutterLocalNotificationsPlugin.schedule(0, title, description, scheduledNotificationDateTime, platformChannelSpecifics); + } -///Repeat notification every day at approximately 10:00:00 am -Future showDailyAtTime() async { - var time = Time(10, 0, 0); - var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', channelDescription: 'repeatDailyAtTime description'); - var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); - // var platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.showDailyAtTime( - // 0, - // 'show daily title', - // 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - // time, - // platformChannelSpecifics); -} + ///Repeat notification every day at approximately 10:00:00 am + Future showDailyAtTime() async { + var time = Time(10, 0, 0); + var androidPlatformChannelSpecifics = AndroidNotificationDetails('repeatDailyAtTime channel id', 'repeatDailyAtTime channel name', channelDescription: 'repeatDailyAtTime description'); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showDailyAtTime( + // 0, + // 'show daily title', + // 'Daily notification shown at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // time, + // platformChannelSpecifics); + } -///Repeat notification weekly on Monday at approximately 10:00:00 am -Future showWeeklyAtDayAndTime() async { - var time = Time(10, 0, 0); - var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', channelDescription: 'show weekly description'); - var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); - // var platformChannelSpecifics = NotificationDetails( - // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); - // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( - // 0, - // 'show weekly title', - // 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', - // Day.Monday, - // time, - // platformChannelSpecifics); -} + ///Repeat notification weekly on Monday at approximately 10:00:00 am + Future showWeeklyAtDayAndTime() async { + var time = Time(10, 0, 0); + var androidPlatformChannelSpecifics = AndroidNotificationDetails('show weekly channel id', 'show weekly channel name', channelDescription: 'show weekly description'); + var iOSPlatformChannelSpecifics = DarwinNotificationDetails(); + // var platformChannelSpecifics = NotificationDetails( + // androidPlatformChannelSpecifics, iOSPlatformChannelSpecifics); + // await flutterLocalNotificationsPlugin.showWeeklyAtDayAndTime( + // 0, + // 'show weekly title', + // 'Weekly notification shown on Monday at approximately ${_toTwoDigitString(time.hour)}:${_toTwoDigitString(time.minute)}:${_toTwoDigitString(time.second)}', + // Day.Monday, + // time, + // platformChannelSpecifics); + } -String _toTwoDigitString(int value) { - return value.toString().padLeft(2, '0'); -} + String _toTwoDigitString(int value) { + return value.toString().padLeft(2, '0'); + } -Future cancelNotification() async { - await flutterLocalNotificationsPlugin.cancel(0); -} + Future cancelNotification() async { + await flutterLocalNotificationsPlugin.cancel(0); + } -Future cancelAllNotifications() async { - await flutterLocalNotificationsPlugin.cancelAll(); -}} + Future cancelAllNotifications() async { + await flutterLocalNotificationsPlugin.cancelAll(); + } +} diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 534b0540..5f2d0f3f 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2897,6 +2897,7 @@ class TranslationBase { String get rateDoctorResponseHeading => localizedValues["rateDoctorResponseHeading"][locale.languageCode]; String get updateInsuranceManuallyDialog => localizedValues["updateInsuranceManuallyDialog"][locale.languageCode]; String get viewReport => localizedValues["viewReport"][locale.languageCode]; + String get sickLeaveAdmittedPatient => localizedValues["sickLeaveAdmittedPatient"][locale.languageCode]; } diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 001baf50..ece5613d 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -809,6 +809,11 @@ class Utils { static String generateMd5Hash(String input) { return crypto.md5.convert(utf8.encode(input)).toString(); } + + static String generateSignature() { + + } + } Widget applyShadow({Color color = Colors.grey, double shadowOpacity = 0.5, double spreadRadius = 2, double blurRadius = 7, Offset offset = const Offset(2, 2), @required Widget child}) { diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index 4ae60764..e71a4266 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -8,6 +8,7 @@ import 'package:diplomaticquarterapp/core/service/privilege_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; +import 'package:diplomaticquarterapp/extensions/string_extensions.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/check_activation_code_response.dart'; @@ -20,6 +21,7 @@ import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart'; import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_doctor.dart'; import 'package:diplomaticquarterapp/pages/webRTC/call_page.dart'; import 'package:diplomaticquarterapp/routes.dart'; +import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/services/family_files/family_files_provider.dart'; @@ -28,6 +30,7 @@ import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/HMGNetworkConnectivity.dart'; +import 'package:diplomaticquarterapp/uitl/LocalNotification.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; @@ -38,6 +41,14 @@ import 'package:diplomaticquarterapp/widgets/dialogs/confirm_dialog.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +// import 'package:flutter_amazonpaymentservices/environment_type.dart'; +// import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.dart'; + +// import 'package:flutter_amazonpaymentservices/environment_type.dart'; +// import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.dart'; + +// import 'package:flutter_amazonpaymentservices/flutter_amazonpaymentservices.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:in_app_review/in_app_review.dart'; import 'package:provider/provider.dart'; @@ -453,11 +464,22 @@ class _AppDrawerState extends State { ), mHeight(12), InkWell( - onTap: () { - // Navigator.push(context, FadePage(page: CallPage())); + onTap: () async { + // var deviceId = await FlutterAmazonpaymentservices.getUDID; + // var signatureValue = "asD123@saereaccess_code=BsM6He4FMBaZ86W64kjZdevice_id=$deviceId" + "language=enmerchant_identifier=ipxnRXXqservice_command=SDK_TOKENasD123@saere"; + // var signatureValueSHA = signatureValue.toSha256; + // // GifLoaderDialogUtils.showMyDialog(context); - // HMGNetworkConnectivity(context).start(); - // locator().hamburgerMenu.logMenuItemClick('cloud solution logo tap'); + // DoctorsListService service = new DoctorsListService(); + // service.getPayfortSDKTokenForPayment(deviceId, signatureValueSHA, isTest: true).then((res) { + // GifLoaderDialogUtils.hideDialog(context); + // print(res); + // startPaymentProcess(res['sdk_token']); + // }).catchError((err) { + // print(err); + // AppToast.showErrorToast(message: err); + // GifLoaderDialogUtils.hideDialog(context); + // }); }, child: Row( crossAxisAlignment: CrossAxisAlignment.center, @@ -495,6 +517,34 @@ class _AppDrawerState extends State { )); } + startPaymentProcess(String sdkToken) async { + // Map requestParam = {}; + // requestParam = { + // "amount": "100", + // "command": "PURCHASE", + // "currency": "SAR", + // "order_description": "Advance Payment", + // "customer_email": projectProvider.user.emailAddress, + // "customer_name": projectProvider.user.firstName + " " + projectProvider.user.lastName, + // "phone_number": projectProvider.user.mobileNumber, + // "language": projectProvider.isArabic ? "ar" : "en", + // "merchant_reference": DateTime.now().millisecondsSinceEpoch.toString(), + // "sdk_token": sdkToken, + // }; + // try { + // await FlutterAmazonpaymentservices.normalPay(requestParam, EnvironmentType.sandbox, isShowResponsePage: false).then((value) { + // if (value["status"] == 14) { + // AppToast.showSuccessToast(message: "Payment has been successful"); + // } else { + // AppToast.showErrorToast(message: value['response_message']); + // } + // }); + // } on PlatformException catch (e) { + // AppToast.showErrorToast(message: e.message); + // return; + // } + } + readQRCode() async { pharmacyLiveCareQRCode = (await BarcodeScanner.scan())?.rawContent; print(pharmacyLiveCareQRCode); @@ -512,7 +562,13 @@ class _AppDrawerState extends State { startPharmacyLiveCareProcess() { sharedPref.setString(LIVECARE_CLINIC_DATA, "Pharmacy LiveCare" + "-" + "501" + "-" + "7"); - Navigator.push(context, FadePage(page: LiveCareHome(isPharmacyLiveCare: true, pharmacyLiveCareQRCode: pharmacyLiveCareQRCode,))); + Navigator.push( + context, + FadePage( + page: LiveCareHome( + isPharmacyLiveCare: true, + pharmacyLiveCareQRCode: pharmacyLiveCareQRCode, + ))); } drawerNavigator(context, routeName) { diff --git a/pubspec.yaml b/pubspec.yaml index c19788d3..c4265c47 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: diplomaticquarterapp description: A new Flutter application. -version: 4.5.022+4050022 +version: 4.5.024+4050024 environment: sdk: ">=2.7.0 <3.0.0" @@ -15,7 +15,7 @@ dependencies: sdk: flutter intl: ^0.17.0 # web view -# webview_flutter: ^2.3.1 + # webview_flutter: ^2.3.1 # http client http: ^0.13.4 @@ -23,7 +23,7 @@ dependencies: async: ^2.8.1 audio_wave: ^0.1.4 -# audio_session: ^0.1.13 + # audio_session: ^0.1.13 # State Management provider: ^6.0.1 @@ -54,7 +54,7 @@ dependencies: maps_launcher: ^2.0.1 url_launcher: ^6.0.15 shared_preferences: ^2.0.0 -# flutter_flexible_toast: ^0.1.4 + # flutter_flexible_toast: ^0.1.4 fluttertoast: ^8.0.8 firebase_messaging: ^14.1.0 firebase_analytics: ^10.0.5 @@ -95,10 +95,10 @@ dependencies: # Qr code Scanner TODO fix it # barcode_scanner: ^1.0.1 -# flutter_polyline_points: ^1.0.0 + # flutter_polyline_points: ^1.0.0 location: ^4.3.0 # Qr code Scanner -# barcode_scan_fix: ^1.0.2 + # barcode_scan_fix: ^1.0.2 barcode_scan2: ^4.2.2 # Rating Stars @@ -108,7 +108,7 @@ dependencies: syncfusion_flutter_calendar: ^19.3.55 # SVG Images -# flutter_svg: ^0.23.0+1 + # flutter_svg: ^0.23.0+1 #Calendar Events manage_calendar_events: ^2.0.1 @@ -152,7 +152,7 @@ dependencies: #google maps places google_maps_place_picker_mb: ^3.0.0 -# google_maps_place_picker: ^2.1.0-nullsafety.3 + # google_maps_place_picker: ^2.1.0-nullsafety.3 map_launcher: ^1.1.3 #countdown timer for Upcoming List flutter_countdown_timer: ^4.1.0 @@ -161,10 +161,10 @@ dependencies: native_device_orientation: ^1.0.0 wakelock: ^0.5.6 after_layout: ^1.1.0 -# twilio_programmable_video: ^0.11.0+1 + # twilio_programmable_video: ^0.11.0+1 cached_network_image: ^3.1.0+1 -# flutter_tts: -# path: flutter_tts-voice_enhancement + # flutter_tts: + # path: flutter_tts-voice_enhancement flutter_tts: ^3.6.1 wifi: ^0.1.5 @@ -175,7 +175,7 @@ dependencies: geofencing: ^0.1.0 speech_to_text: ^6.1.1 -# path: speech_to_text + # path: speech_to_text in_app_update: ^3.0.0 @@ -183,7 +183,7 @@ dependencies: badges: ^2.0.1 flutter_app_icon_badge: ^2.0.0 -# syncfusion_flutter_sliders: ^19.3.55 + # syncfusion_flutter_sliders: ^19.3.55 searchable_dropdown: ^1.1.3 dropdown_search: 0.4.9 youtube_player_flutter: ^8.0.0 @@ -191,28 +191,31 @@ dependencies: # Dep by Zohaib shimmer: ^2.0.0 carousel_slider: ^4.0.0 -# flutter_material_pickers: ^3.1.2 + # flutter_material_pickers: ^3.1.2 flutter_staggered_grid_view: ^0.4.1 -# flutter_hms_gms_availability: ^2.0.0 + # flutter_hms_gms_availability: ^2.0.0 huawei_hmsavailability: ^6.6.0+300 huawei_location: 6.0.0+302 # Marker Animation -# flutter_animarker: ^3.2.0 + # flutter_animarker: ^3.2.0 auto_size_text: ^3.0.0 equatable: ^2.0.3 -# signalr_core: ^1.1.1 + # signalr_core: ^1.1.1 wave: ^0.2.0 -# sms_retriever: ^1.0.0 + # sms_retriever: ^1.0.0 sms_otp_auto_verify: ^2.1.0 flutter_ios_voip_kit: ^0.0.5 google_api_availability: ^3.0.1 -# flutter_callkit_incoming: ^1.0.3+3 -# firebase_core: 1.12.0 + # flutter_callkit_incoming: ^1.0.3+3 + # firebase_core: 1.12.0 + +# flutter_amazonpaymentservices: 0.0.6 +# crypto: dependency_overrides: - provider : ^5.0.0 -# permission_handler : ^10.2.0 + provider: ^5.0.0 + # permission_handler : ^10.2.0 flutter_svg: ^1.0.0 # firebase_messaging_platform_interface: any # flutter_inappwebview: 5.7.2+3