diff --git a/lib/config/config.dart b/lib/config/config.dart index a51c5739..f71fa9be 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -20,13 +20,11 @@ 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 = 'http://10.50.100.198:4422/'; -// 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 = 'http://10.20.200.111:1010/'; -// var BASE_URL = 'https://hmgwebservices.com/'; // var BASE_URL = 'https://orash.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidauat.cloudsolutions.com.sa/'; // var BASE_URL = 'https://vidamergeuat.cloudsolutions.com.sa/'; diff --git a/lib/main.dart b/lib/main.dart index b18a424a..3137f043 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'dart:io'; +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/PharmacyPagesViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/toDoCountProviderModel.dart'; @@ -90,6 +91,7 @@ class _MyApp extends State { @override Widget build(BuildContext context) { PlatformBridge.init(context); + AppGlobal.context = context; // SystemChrome.setPreferredOrientations([ // DeviceOrientation.portraitUp, diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index c27928d4..4d92dda0 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -462,7 +462,7 @@ class _MyFamily extends State with TickerProviderStateMixin { // Utils.showProgressDialog(context); this.familyFileProvider.silentLoggin(user is AuthenticatedUser ? null : user, languageID, mainUser: user is AuthenticatedUser).then((value) => loginAfter(value, context)).catchError((err) { print("err:$err"); - AppToast.showErrorToast(message: err.toString()); + AppToast.showErrorToast(message: err.toString(), localContext: context); Navigator.of(context).pop(); }); } diff --git a/lib/pages/MyAppointments/SchedulePage.dart b/lib/pages/MyAppointments/SchedulePage.dart index 0731ab0a..a307c868 100644 --- a/lib/pages/MyAppointments/SchedulePage.dart +++ b/lib/pages/MyAppointments/SchedulePage.dart @@ -66,7 +66,7 @@ class _SchedulePageState extends State { this.generateWeeksSchedules(); } else if (model2.freeSlots.length == 0 && model2.state == ViewState.Idle) { - AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule); + AppToast.showErrorToast(message: TranslationBase.of(context).emptySchedule, localContext: context); Navigator.pop(context); } return AppScaffold( diff --git a/lib/pages/MyAppointments/widgets/AppointmentActions.dart b/lib/pages/MyAppointments/widgets/AppointmentActions.dart index f9d60eae..6347d3f4 100644 --- a/lib/pages/MyAppointments/widgets/AppointmentActions.dart +++ b/lib/pages/MyAppointments/widgets/AppointmentActions.dart @@ -425,7 +425,7 @@ class _AppointmentActionsState extends State { }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); print(err); - AppToast.showErrorToast(message: TranslationBase.of(context).noResultFound); + AppToast.showErrorToast(message: TranslationBase.of(context).noResultFound, localContext: context); }); } @@ -500,7 +500,7 @@ class _AppointmentActionsState extends State { if (res['PatientDoctorAppointmentResultList'].length != 0) { getCallRequestType(); } else { - AppToast.showErrorToast(message: TranslationBase.of(context).askDocNotAllowed); + AppToast.showErrorToast(message: TranslationBase.of(context).askDocNotAllowed, localContext: context); } }).catchError((err) { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/conference/zoom/call_screen.dart b/lib/pages/conference/zoom/call_screen.dart index de316c6d..70f90415 100644 --- a/lib/pages/conference/zoom/call_screen.dart +++ b/lib/pages/conference/zoom/call_screen.dart @@ -154,7 +154,7 @@ class _CallScreenState extends State { var videoOn = await mySelf.videoStatus?.isOn(); var speakerOn = await zoom.audioHelper.getSpeakerStatus(); // fullScreenUser.value = mySelf; - fullScreenUser.value = remoteUsers![0]; + fullScreenUser.value = remoteUsers!.isNotEmpty ? remoteUsers![0] : mySelf; remoteUsers?.insert(0, mySelf); users.value = remoteUsers!; isMuted.value = muted!; @@ -168,6 +168,8 @@ class _CallScreenState extends State { isInSession.value = false; users.value = []; fullScreenUser.value = null; + await zoom.leaveSession(false); + Navigator.pop(context); }); final sessionNeedPasswordListener = emitter.on(EventType.onSessionNeedPassword, (data) async { @@ -265,6 +267,7 @@ class _CallScreenState extends State { List remoteUserList = userListJson.map((userJson) => ZoomVideoSdkUser.fromJson(userJson)).toList(); remoteUserList.insert(0, mySelf!); users.value = remoteUserList; + fullScreenUser.value = remoteUserList[1]; }); final userLeaveListener = emitter.on(EventType.onUserLeave, (data) async { @@ -1544,7 +1547,11 @@ class _CallScreenState extends State { IconButton( onPressed: onPressCameraChange, iconSize: circleButtonSize, - icon: const Icon(Icons.cameraswitch_sharp, size: 45.0, color: Colors.white,), + icon: const Icon( + Icons.cameraswitch_sharp, + size: 45.0, + color: Colors.white, + ), ), // IconButton( // onPressed: onPressMore, diff --git a/lib/pages/conference/zoom/jwt.dart b/lib/pages/conference/zoom/jwt.dart index 3047fe5f..c9d373bd 100644 --- a/lib/pages/conference/zoom/jwt.dart +++ b/lib/pages/conference/zoom/jwt.dart @@ -28,6 +28,7 @@ String generateJwt(String sessionName, String roleType) { 'tpc': sessionName, 'role_type': int.parse(roleType), 'cloud_recording_option': 1, + 'cloud_recording_election': 1, }, ); var token = jwt.sign(SecretKey(configs["ZOOM_SDK_SECRET"])); diff --git a/lib/pages/landing/home_page_2.dart b/lib/pages/landing/home_page_2.dart index 9d9086f6..9b52958b 100644 --- a/lib/pages/landing/home_page_2.dart +++ b/lib/pages/landing/home_page_2.dart @@ -49,12 +49,13 @@ class _HomePageState2 extends State { HomePageFragment2( model, onLoginClick: () { - // widget.onLoginClick!(); - Navigator.pushNamed( - context, - "zoom_call_page", - arguments: CallArguments("hoover-dam-4", "", "Patient", "40", "0", true), - ); + widget.onLoginClick!(); + + // Navigator.pushNamed( + // context, + // "zoom_call_page", + // arguments: CallArguments("h9qkpf02", "123", "Patient", "40", "1", false), + // ); }, onPharmacyClick: () { // getPharmacyToken(model); diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 13280570..8666b9c7 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -394,10 +394,11 @@ class _LandingPageState extends State with WidgetsBindingObserver { } else { // AppGlobal.context = context; GifLoaderDialogUtils.showMyDialog(context); - authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES? value) { + authService.selectDeviceImei(DEVICE_TOKEN).then((SelectDeviceIMEIRES? value) async { GifLoaderDialogUtils.hideDialog(context); - if (value != null) { - setUserValues(value); + var data = await sharedPref.getObject(IMEI_USER_DATA); + if (data != null) { + setUserValues(data); Navigator.of(context).pushNamed(CONFIRM_LOGIN); } else { GifLoaderDialogUtils.hideDialog(context); diff --git a/lib/pages/livecare/incoming_call.dart b/lib/pages/livecare/incoming_call.dart index 49bc7e97..e8bea049 100644 --- a/lib/pages/livecare/incoming_call.dart +++ b/lib/pages/livecare/incoming_call.dart @@ -3,6 +3,7 @@ import 'dart:ui'; import 'package:camera/camera.dart'; import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; import 'package:diplomaticquarterapp/pages/conference/widgets/platform_exception_alert_dialog.dart'; +import 'package:diplomaticquarterapp/pages/conference/zoom/call_screen.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/videocall-webrtc-rnd/webrtc/start_video_call.dart'; import 'package:diplomaticquarterapp/pages/webRTC/OpenTok/OpenTok.dart'; @@ -16,11 +17,10 @@ import 'package:just_audio/just_audio.dart'; import '../../config/config.dart'; - class IncomingCall extends StatefulWidget { IncomingCallData? incomingCallData; - IncomingCall({ this.incomingCallData}); + IncomingCall({this.incomingCallData}); @override _IncomingCallState createState() => _IncomingCallState(); @@ -34,6 +34,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt late CameraController _controller; late Future _initializeControllerFuture; bool isCameraReady = false; + // Signaling signaling = Signaling()..init(); @override @@ -59,140 +60,138 @@ class _IncomingCallState extends State with SingleTickerProviderSt return AppScaffold( isShowAppBar: false, isShowDecPage: false, - body: Stack( - alignment: FractionalOffset.center, - children: [ - // new Positioned.fill( - // child: new AspectRatio(aspectRatio: _controller.value.aspectRatio, child: new CameraPreview(_controller)), - // ), - new Positioned.fill( - child: new ClipRect( - // child: new BackdropFilter( - // filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), - child: new Container( - decoration: new BoxDecoration(color: Colors.grey[800]!.withOpacity(0.8)), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - margin: const EdgeInsets.all(21.0), - child: Row( - children: [ - Image.asset( - "assets/images/new/logo.png", - height: 70, - width: 70, - ), - Container( - margin: const EdgeInsets.only(left: 10.0, right: 10.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - Text( - widget.incomingCallData!.doctorname!, - style: TextStyle(fontSize: 21, fontWeight: FontWeight.bold, color: Colors.white, letterSpacing: -1.26, height: 23 / 12), - ), - Text( - TranslationBase.of(context).videoAppo, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xffC6C6C6), letterSpacing: -0.48, height: 23 / 24), - ), - SizedBox(height: 2), - ], - ), - ), - ], + body: Stack(alignment: FractionalOffset.center, children: [ + // new Positioned.fill( + // child: new AspectRatio(aspectRatio: _controller.value.aspectRatio, child: new CameraPreview(_controller)), + // ), + new Positioned.fill( + child: new ClipRect( + // child: new BackdropFilter( + // filter: new ImageFilter.blur(sigmaX: 10.0, sigmaY: 10.0), + child: new Container( + decoration: new BoxDecoration(color: Colors.grey[800]!.withOpacity(0.8)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + margin: const EdgeInsets.all(21.0), + child: Row( + children: [ + Image.asset( + "assets/images/new/logo.png", + height: 70, + width: 70, + ), + Container( + margin: const EdgeInsets.only(left: 10.0, right: 10.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + widget.incomingCallData!.doctorname!, + style: TextStyle(fontSize: 21, fontWeight: FontWeight.bold, color: Colors.white, letterSpacing: -1.26, height: 23 / 12), ), - ), - Container( - margin: const EdgeInsets.all(21.0), - width: MediaQuery.of(context).size.width, - decoration: cardRadius(15.0, color: Colors.black), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisSize: MainAxisSize.min, - children: [ - Container( - padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 6.0), - child: Text( - TranslationBase.of(context).appoInfo, - style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 23 / 12), - ), - ), - Container( - padding: const EdgeInsets.only(left: 16.0, right: 16.0), - child: Text( - widget.incomingCallData!.appointmentdate! + ", " + widget.incomingCallData!.appointmenttime!, - style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600), - ), - ), - Container( - padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 21.0), - child: Text( - widget.incomingCallData!.clinicname!, - style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600), - ), - ), - ], + Text( + TranslationBase.of(context).videoAppo, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xffC6C6C6), letterSpacing: -0.48, height: 23 / 24), ), - ), - Spacer(), - Container( - margin: EdgeInsets.only(bottom: 70.0, left: 49, right: 49), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - RotationTransition( - turns: Tween(begin: 0.0, end: -.1).chain(CurveTween(curve: Curves.elasticIn)).animate(_animationController), - child: Container( - child: RawMaterialButton( - onPressed: () { - _submit(); - }, - elevation: 2.0, - fillColor: Colors.green, - child: Icon( - Icons.call, - color: Colors.white, - size: 35.0, - ), - padding: EdgeInsets.all(15.0), - shape: CircleBorder(), - ), - )), - Container( - child: RawMaterialButton( - onPressed: () { - backToHome(); - }, - elevation: 2.0, - fillColor: Colors.red, - child: Icon( - Icons.call_end, - color: Colors.white, - size: 35.0, - ), - padding: EdgeInsets.all(15.0), - shape: CircleBorder(), - ), - ), - ], + SizedBox(height: 2), + ], + ), + ), + ], + ), + ), + Container( + margin: const EdgeInsets.all(21.0), + width: MediaQuery.of(context).size.width, + decoration: cardRadius(15.0, color: Colors.black), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Container( + padding: const EdgeInsets.fromLTRB(16.0, 16.0, 16.0, 6.0), + child: Text( + TranslationBase.of(context).appoInfo, + style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.64, height: 23 / 12), + ), + ), + Container( + padding: const EdgeInsets.only(left: 16.0, right: 16.0), + child: Text( + widget.incomingCallData!.appointmentdate! + ", " + widget.incomingCallData!.appointmenttime!, + style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600), + ), + ), + Container( + padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 21.0), + child: Text( + widget.incomingCallData!.clinicname!, + style: TextStyle(fontSize: 12.0, letterSpacing: -0.48, color: Color(0xff8E8E8E), fontWeight: FontWeight.w600), + ), + ), + ], + ), + ), + Spacer(), + Container( + margin: EdgeInsets.only(bottom: 70.0, left: 49, right: 49), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + RotationTransition( + turns: Tween(begin: 0.0, end: -.1).chain(CurveTween(curve: Curves.elasticIn)).animate(_animationController), + child: Container( + child: RawMaterialButton( + onPressed: () { + _submit(); + }, + elevation: 2.0, + fillColor: Colors.green, + child: Icon( + Icons.call, + color: Colors.white, + size: 35.0, + ), + padding: EdgeInsets.all(15.0), + shape: CircleBorder(), ), + )), + Container( + child: RawMaterialButton( + onPressed: () { + backToHome(); + }, + elevation: 2.0, + fillColor: Colors.red, + child: Icon( + Icons.call_end, + color: Colors.white, + size: 35.0, ), - ], + padding: EdgeInsets.all(15.0), + shape: CircleBorder(), + ), ), - ), + ], ), ), - // ), - ] + ], + ), + ), + ), + ), + // ), + ] // } else { // return const Center(child: CircularProgressIndicator()); // } - ), + ), ); } @@ -213,31 +212,43 @@ class _IncomingCallState extends State with SingleTickerProviderSt // backToHome(); // final roomModel = RoomModel(name: widget.incomingCallData.name, token: widget.incomingCallData.sessionId, identity: widget.incomingCallData.identity); // await _controller.dispose(); - changeCallStatusAPI(4); - await Navigator.of(context).pushReplacement( - MaterialPageRoute( - // fullscreenDialog: true, - builder: (BuildContext context) { - // final caller = widget.incomingCallData.callerID; - // final receiver = widget.incomingCallData.receiverID; - // final host = widget.incomingCallData.server; - // if(widget.incomingCallData.isWebRTC == "true"){ - // return StartVideoCall(caller: caller, receiver: receiver, iAmCaller: false, host: host); - // }else{ - return OpenTokConnectCallPage( - apiKey: OPENTOK_API_KEY, - sessionId: widget.incomingCallData!.sessionId!, - token: widget.incomingCallData!.token! - ); - // } - // return VideoCallWebPage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID); // Web WebRTC VideoCall + LandingPage.isOpenCallPage = false; + player.stop(); + changeCallStatusAPI(4); + Navigator.of(context).pop(); - // return CallHomePage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID); // App WebRTC VideoCall - }, - ), + Navigator.pushNamed( + context, + "zoom_call_page", + arguments: CallArguments(widget.incomingCallData!.sessionId!, "123", "Patient", "40", "1", false), ); + + // await Navigator.of(context).pushReplacement( + // MaterialPageRoute( + // // fullscreenDialog: true, + // builder: (BuildContext context) { + // // final caller = widget.incomingCallData.callerID; + // // final receiver = widget.incomingCallData.receiverID; + // // final host = widget.incomingCallData.server; + // // if(widget.incomingCallData.isWebRTC == "true"){ + // // return StartVideoCall(caller: caller, receiver: receiver, iAmCaller: false, host: host); + // // }else{ + // return OpenTokConnectCallPage( + // apiKey: OPENTOK_API_KEY, + // sessionId: widget.incomingCallData!.sessionId!, + // token: widget.incomingCallData!.token! + // ); + // // } + // + // // return VideoCallWebPage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID); // Web WebRTC VideoCall + // + // // return CallHomePage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID); // App WebRTC VideoCall + // + // }, + // ), + // ); } catch (err) { print(err); await PlatformExceptionAlertDialog( @@ -248,8 +259,7 @@ class _IncomingCallState extends State with SingleTickerProviderSt void changeCallStatusAPI(int sessionStatus) { LiveCareService service = new LiveCareService(); - service.endCallAPI(widget.incomingCallData!.sessionId!, sessionStatus, context).then((res) { - }).catchError((err) { + service.endCallAPI(widget.incomingCallData!.sessionId!, sessionStatus, context).then((res) {}).catchError((err) { print(err); }); } diff --git a/lib/pages/livecare/widgets/clinic_list.dart b/lib/pages/livecare/widgets/clinic_list.dart index ebfa4e85..ee0fd356 100644 --- a/lib/pages/livecare/widgets/clinic_list.dart +++ b/lib/pages/livecare/widgets/clinic_list.dart @@ -40,6 +40,7 @@ import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:fluttertoast/fluttertoast.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:provider/provider.dart'; @@ -145,7 +146,7 @@ class _clinic_listState extends State { GifLoaderDialogUtils.hideDialog(context); print(err); isError = true; - AppToast.showErrorToast(message: err); + AppToast.showErrorToast(message: err, localContext: context); }); projectViewModel.analytics.liveCare.livecare_immediate_consultation_clinic(clinic: selectedClinicName); } diff --git a/lib/pages/medical/eye/ContactLensPage.dart b/lib/pages/medical/eye/ContactLensPage.dart index 77ec5041..b459df15 100644 --- a/lib/pages/medical/eye/ContactLensPage.dart +++ b/lib/pages/medical/eye/ContactLensPage.dart @@ -78,7 +78,7 @@ class ContactLensPage extends StatelessWidget { ), ), getRow(TranslationBase.of(context).brand, '${listHISGetContactLensPerscription!.brand}'), - getRow('B.C', '${listHISGetContactLensPerscription!.baseCurve!}'), + getRow('B.C', '${listHISGetContactLensPerscription!.baseCurve ?? "-"}'), getRow(TranslationBase.of(context).power, '${listHISGetContactLensPerscription!.power}'), getRow(TranslationBase.of(context).diameter, '${listHISGetContactLensPerscription!.diameter}'), getRow('OZ', '${listHISGetContactLensPerscription!.oZ}'), diff --git a/lib/pages/medical/patient_sick_leave_page.dart b/lib/pages/medical/patient_sick_leave_page.dart index 58d1adfc..e6a39f94 100644 --- a/lib/pages/medical/patient_sick_leave_page.dart +++ b/lib/pages/medical/patient_sick_leave_page.dart @@ -65,7 +65,7 @@ class _PatientSickLeavePageState extends State { isSortByClinic: false, isInOutPatient: model.sickLeaveList[index].isInOutPatient, isSickLeave: true, - sickLeaveStatus: model.sickLeaveList[index].status!, + sickLeaveStatus: model.sickLeaveList[index].status ?? 0, onEmailTap: () { showConfirmMessage(model, index); }, diff --git a/lib/pages/medical/prescriptions/prescription_details_inp.dart b/lib/pages/medical/prescriptions/prescription_details_inp.dart index 5237c873..b446fed2 100644 --- a/lib/pages/medical/prescriptions/prescription_details_inp.dart +++ b/lib/pages/medical/prescriptions/prescription_details_inp.dart @@ -45,12 +45,12 @@ class PrescriptionDetailsPageINP extends StatelessWidget { prescriptions.doctorName!, prescriptions.doctorID!, prescriptions.doctorImageURL!, - prescriptions.speciality!, + prescriptions.speciality ?? [""], "", prescriptions.name!, DateUtil.convertStringToDate(prescriptions.appointmentDate!), DateUtil.formatDateToTime(DateUtil.convertStringToDate(prescriptions.appointmentDate!)), - prescriptions.nationalityFlagURL!, + prescriptions.nationalityFlagURL ?? "", prescriptions.doctorRate, prescriptions.actualDoctorRate, prescriptions.noOfPatientsRate, diff --git a/lib/pages/medical/prescriptions/prescription_items_page.dart b/lib/pages/medical/prescriptions/prescription_items_page.dart index be050ac4..58f1e7d6 100644 --- a/lib/pages/medical/prescriptions/prescription_items_page.dart +++ b/lib/pages/medical/prescriptions/prescription_items_page.dart @@ -65,7 +65,7 @@ class PrescriptionItemsPage extends StatelessWidget { model.prescriptionReportEnhList.length > 0 ? model.prescriptionReportEnhList[0].orderDate! : model.prescriptionReportListINP[0].orderDate!, ) : DateTime.now(), ), - prescriptions.nationalityFlagURL!, + prescriptions.nationalityFlagURL ?? "", prescriptions.doctorRate, prescriptions.actualDoctorRate, prescriptions.noOfPatientsRate, diff --git a/lib/pages/medical/radiology/radiology_details_page.dart b/lib/pages/medical/radiology/radiology_details_page.dart index 409890f2..2c6974c9 100644 --- a/lib/pages/medical/radiology/radiology_details_page.dart +++ b/lib/pages/medical/radiology/radiology_details_page.dart @@ -67,6 +67,7 @@ class RadiologyDetailsPage extends StatelessWidget { }, buttonTitle: TranslationBase.of(context).sendCopyRad, isNeedToShowButton: projectViewModel.havePrivilege(8), + showConfirmMessageDialog: false, ), Container( margin: EdgeInsets.all(24), diff --git a/lib/services/livecare_services/livecare_provider.dart b/lib/services/livecare_services/livecare_provider.dart index 8b89047e..de74cac1 100644 --- a/lib/services/livecare_services/livecare_provider.dart +++ b/lib/services/livecare_services/livecare_provider.dart @@ -337,7 +337,8 @@ class LiveCareService extends BaseService { Future getOneSignalVOIPToken(String voipToken, BuildContext context) async { Map request; - request = {"app_id": "b87a754b-9a2a-437c-960b-39a079c57586", "identifier": voipToken, "device_type": 0}; + // request = {"app_id": "b87a754b-9a2a-437c-960b-39a079c57586", "identifier": voipToken, "device_type": 0}; + request = {"app_id": "b87a754b-9a2a-437c-960b-39a079c57586", "identifier": voipToken, "device_type": 0, "test_type": 1}; dynamic localRes; diff --git a/lib/splashPage.dart b/lib/splashPage.dart index da2351d6..515c7f54 100644 --- a/lib/splashPage.dart +++ b/lib/splashPage.dart @@ -36,14 +36,14 @@ class _SplashScreenState extends State { void initState() { AppGlobal.context = context; super.initState(); - print("Splash init called............."); + print("Splash init called............."); Timer( Duration(seconds: 1, milliseconds: 500), () async { await loadPrivilege().then((value) { LocalNotification.init(onNotificationClick: (payload) {}); // LocalNotification.getInstance().showNow(title: "Payload", subtitle: "Subtitle", payload: "Payload"); - if(!_privilegeService.hasError) { + if (!_privilegeService.hasError) { Navigator.of(context).pushReplacement( MaterialPageRoute( builder: (BuildContext context) => LandingPage(), @@ -54,7 +54,12 @@ class _SplashScreenState extends State { }, ); - // startZoom(); + var zoom = ZoomVideoSdk(); + InitConfig initConfig = InitConfig( + domain: "zoom.us", + enableLog: true, + ); + zoom.initSdk(initConfig); // AppSharedPreferences().getAll().then((value) { // debugPrint("ALL SHARED PREFERENCES!!!!!"); @@ -62,15 +67,6 @@ class _SplashScreenState extends State { // }); } - // void startZoom(){ - // var zoom = ZoomVideoSdk(); - // InitConfig initConfig = InitConfig( - // domain: "zoom.us", - // enableLog: true, - // ); - // zoom.initSdk(initConfig); - // } - /// load the Privilege from service Future loadPrivilege() async { await _privilegeService.getPrivilege(); diff --git a/lib/uitl/app_toast.dart b/lib/uitl/app_toast.dart index 51f3b973..bbeebe5d 100644 --- a/lib/uitl/app_toast.dart +++ b/lib/uitl/app_toast.dart @@ -17,13 +17,7 @@ class AppToast { int? imageSize, }) { Fluttertoast.showToast( - msg: message, - toastLength: toastLength, - gravity: toastGravity, - timeInSecForIosWeb: timeInSeconds!, - backgroundColor: backgroundColor, - textColor: textColor, - fontSize: fontSize); + msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds!, backgroundColor: backgroundColor, textColor: textColor, fontSize: fontSize); } static void showSuccessToast({ @@ -38,28 +32,22 @@ class AppToast { int imageSize = 32, }) { Fluttertoast.showToast( - msg: message, - toastLength: toastLength, - gravity: toastGravity, - timeInSecForIosWeb: timeInSeconds ?? 0, - backgroundColor: Colors.green, - textColor: textColor, - fontSize: fontSize); + msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds ?? 0, backgroundColor: Colors.green, textColor: textColor, fontSize: fontSize); } - static void showErrorToast({ - required String message, - Toast toastLength = Toast.LENGTH_LONG, - int timeInSeconds = 2, - double fontSize = 16, - ToastGravity toastGravity = ToastGravity.TOP, - Color textColor = Colors.white, - int radius = 15, - int? elevation, - int imageSize = 32, - }) { + static void showErrorToast( + {required String message, + Toast toastLength = Toast.LENGTH_LONG, + int timeInSeconds = 2, + double fontSize = 16, + ToastGravity toastGravity = ToastGravity.TOP, + Color textColor = Colors.white, + int radius = 15, + int? elevation, + int imageSize = 32, + BuildContext? localContext}) { FToast fToast = FToast(); - fToast.init(AppGlobal.context); + fToast.init(localContext != null ? localContext : AppGlobal.context); Widget toast = Container( padding: EdgeInsets.all(8), alignment: Alignment.topCenter, @@ -93,8 +81,7 @@ class AppToast { } void backWithEmpty() { - AppToast.showErrorToast( - message: TranslationBase.of(AppGlobal.context).empty); + AppToast.showErrorToast(message: TranslationBase.of(AppGlobal.context).empty); Navigator.of(AppGlobal.context).pop(); } diff --git a/lib/uitl/push-notification-handler.dart b/lib/uitl/push-notification-handler.dart index 10538367..eb5f3754 100644 --- a/lib/uitl/push-notification-handler.dart +++ b/lib/uitl/push-notification-handler.dart @@ -5,8 +5,10 @@ import 'dart:io'; import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/core/model/notifications/get_notifications_response_model.dart'; +import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/models/LiveCare/IncomingCallData.dart'; import 'package:diplomaticquarterapp/pages/DrawerPages/notifications/notification_details_page.dart'; +import 'package:diplomaticquarterapp/pages/conference/zoom/call_screen.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/pages/livecare/incoming_call.dart'; import 'package:diplomaticquarterapp/pages/webRTC/OpenTok/OpenTok.dart'; @@ -209,6 +211,20 @@ class PushNotificationHandler { static PushNotificationHandler getInstance() => _instance; + void _timeOut({ + int seconds = 30, + }) async { + timeOutTimer = Timer(Duration(seconds: seconds), () async { + print('🎈 example: timeOut'); + final incomingCallerName = await voIPKit.getIncomingCallerName(); + voIPKit.unansweredIncomingCall( + skipLocalNotification: false, + missedCallTitle: '📞 Missed call', + missedCallBody: 'There was a call from $incomingCallerName', + ); + }); + } + init(BuildContext context) async { this.context = context; @@ -217,6 +233,51 @@ class PushNotificationHandler { print("APNS VOIP KIT TOKEN: $value"); AppSharedPreferences().setString(APNS_TOKEN, value!); }); + + voIPKit.onDidUpdatePushToken = (String token) { + print('🎈 example: onDidUpdatePushToken: $token'); + }; + + voIPKit.onDidReceiveIncomingPush = ( + Map payload, + ) async { + print('🎈 example: onDidReceiveIncomingPush $payload'); + _timeOut(); + }; + + voIPKit.onDidRejectIncomingCall = ( + String uuid, + String callerId, + ) async { + try { + print('🎈 example: onDidRejectIncomingCall $uuid - $callerId'); + timeOutTimer.cancel(); + } catch (err) {} + }; + + voIPKit.onDidAcceptIncomingCall = ( + String uuid, + String callerId, + ) async { + print('🎈 example: onDidAcceptIncomingCall $uuid - $callerId'); + await voIPKit.acceptIncomingCall(callerState: CallStateType.calling); + await voIPKit.callConnected(); + await Future.delayed(Duration(seconds: 1)); + + Navigator.pushNamed( + locator().navigatorKey.currentContext!, + "zoom_call_page", + arguments: CallArguments("hoover-dam", "123", "Patient", "40", "1", false), + ); + + await voIPKit.endCall(); + + // Navigator.pushNamed(navigatorKey.currentContext!, VIDEO_CALL_SCREEN, + // arguments: VideoArgus( + // reservationId: int.parse(callerId), token: null, isVideo: true)); + + timeOutTimer.cancel(); + }; } if (Platform.isAndroid) { @@ -311,8 +372,7 @@ class PushNotificationHandler { onToken(token!); }); - - if(Platform.isIOS) { + if (Platform.isIOS) { FirebaseMessaging.instance.getAPNSToken().then((value) { print("Push APNS getToken: " + value!); }); @@ -372,7 +432,6 @@ class PushNotificationHandler { ].request(); print("=-=-=-=-=-=-=-=-=-=-"); print(statuses[Permission.location]); - } } catch (_) { debugPrint(_.toString());