From 385820fdce9afb8a05eace1e5a3e33afd03ea6ee Mon Sep 17 00:00:00 2001 From: mosazaid Date: Wed, 23 Jun 2021 17:12:13 +0300 Subject: [PATCH 1/7] video stream add record icon and change button disable --- .../main/kotlin/com/hmg/hmgDr/MainActivity.kt | 3 +- .../hmgDr/Model/GetSessionStatusModel.java | 16 +- .../hmgDr/ui/fragment/VideoCallFragment.kt | 233 ++++++++++++------ .../app/src/main/res/drawable/ic_record.xml | 5 + .../main/res/layout/activity_video_call.xml | 17 ++ lib/core/service/VideoCallService.dart | 81 +++--- lib/models/livecare/start_call_res.dart | 7 +- lib/screens/live_care/end_call_screen.dart | 1 + lib/screens/live_care/video_call.dart | 1 + .../patient_profile_screen.dart | 7 +- lib/util/VideoChannel.dart | 3 +- 11 files changed, 263 insertions(+), 111 deletions(-) create mode 100644 android/app/src/main/res/drawable/ic_record.xml diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt b/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt index fcc3f2e3..52807251 100644 --- a/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt @@ -54,8 +54,9 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler, val generalId = call.argument("generalId") val doctorId = call.argument("DoctorId") val patientName = call.argument("patientName") + val isRecording = call.argument("isRecording") - val sessionStatusModel = GetSessionStatusModel(VC_ID, tokenID, generalId, doctorId, patientName) + val sessionStatusModel = GetSessionStatusModel(VC_ID, tokenID, generalId, doctorId, patientName, isRecording!!) openVideoCall(apiKey, sessionId, token, appLang, baseUrl, sessionStatusModel) diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java index 60350539..9e2e1cf4 100644 --- a/android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/Model/GetSessionStatusModel.java @@ -23,16 +23,20 @@ public class GetSessionStatusModel implements Parcelable { @SerializedName("PatientName") @Expose private String patientName; + @SerializedName("isRecording") + @Expose + private boolean isRecording; public GetSessionStatusModel() { } - public GetSessionStatusModel(Integer vCID, String tokenID, String generalid, Integer doctorId, String patientName) { + public GetSessionStatusModel(Integer vCID, String tokenID, String generalid, Integer doctorId, String patientName, boolean isRecording) { this.vCID = vCID; this.tokenID = tokenID; this.generalid = generalid; this.doctorId = doctorId; this.patientName = patientName; + this.isRecording = isRecording; } protected GetSessionStatusModel(Parcel in) { @@ -49,6 +53,7 @@ public class GetSessionStatusModel implements Parcelable { doctorId = in.readInt(); } patientName = in.readString(); + isRecording = in.readInt() == 1; } public static final Creator CREATOR = new Creator() { @@ -105,6 +110,14 @@ public class GetSessionStatusModel implements Parcelable { this.patientName = patientName; } + public boolean isRecording() { + return isRecording; + } + + public void setRecording(boolean recording) { + isRecording = recording; + } + @Override public int describeContents() { return 0; @@ -127,5 +140,6 @@ public class GetSessionStatusModel implements Parcelable { dest.writeInt(doctorId); } dest.writeString(patientName); + dest.writeInt(isRecording ? 1 : 0); } } diff --git a/android/app/src/main/kotlin/com/hmg/hmgDr/ui/fragment/VideoCallFragment.kt b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/fragment/VideoCallFragment.kt index 7a66f80b..1d1e420a 100644 --- a/android/app/src/main/kotlin/com/hmg/hmgDr/ui/fragment/VideoCallFragment.kt +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/ui/fragment/VideoCallFragment.kt @@ -38,8 +38,9 @@ import pub.devrel.easypermissions.EasyPermissions.PermissionCallbacks import kotlin.math.ceil -class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.SessionListener, PublisherListener, - SubscriberKit.VideoListener, VideoCallView { +class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.SessionListener, + PublisherListener, + SubscriberKit.VideoListener, VideoCallView { private var isFullScreen: Boolean = true private var isCircle: Boolean = false @@ -62,6 +63,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session private var mVolRunnable: Runnable? = null private var mConnectedRunnable: Runnable? = null + private lateinit var recordContainer: FrameLayout private lateinit var thumbnail_container: FrameLayout private lateinit var mPublisherViewContainer: FrameLayout private lateinit var mPublisherViewIcon: View @@ -74,6 +76,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session private var token: String? = null private var appLang: String? = null private var baseUrl: String? = null + private var isRecording: Boolean = true private var isSwitchCameraClicked = false private var isCameraClicked = false @@ -117,8 +120,8 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session super.onStart() dialog?.window?.setLayout( - LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.MATCH_PARENT + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.MATCH_PARENT ) } @@ -156,8 +159,8 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session // Make the dialog possible to be outside touch dialogWindow!!.setFlags( - WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, - WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL + WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL, + WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL ) dialogWindow.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND) requireView().invalidate() @@ -168,8 +171,10 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session this.videoCallResponseListener = videoCallResponseListener } - override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle?): View { + override fun onCreateView( + inflater: LayoutInflater, container: ViewGroup?, + savedInstanceState: Bundle? + ): View { parentView = inflater.inflate(R.layout.activity_video_call, container, false) @@ -181,12 +186,17 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session appLang = getString("appLang") baseUrl = getString("baseUrl") sessionStatusModel = getParcelable("sessionStatusModel") + if (sessionStatusModel != null) + isRecording = sessionStatusModel!!.isRecording } initUI(parentView) requestPermissions() handleDragDialog() - mDetector = GestureDetectorCompat(context, MyGestureListener({ showControlPanelTemporarily() }, { miniCircleDoubleTap() })) + mDetector = GestureDetectorCompat( + context, + MyGestureListener({ showControlPanelTemporarily() }, { miniCircleDoubleTap() }) + ) return parentView } @@ -223,6 +233,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session layoutName = view.findViewById(R.id.layout_name) layoutMini = view.findViewById(R.id.layout_mini) icMini = view.findViewById(R.id.ic_mini) + recordContainer = view.findViewById(R.id.record_container) thumbnail_container = view.findViewById(R.id.thumbnail_container) mPublisherViewContainer = view.findViewById(R.id.local_video_view_container) mPublisherViewIcon = view.findViewById(R.id.local_video_view_icon) @@ -232,23 +243,30 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session patientName = view.findViewById(R.id.patient_name) patientName.text = sessionStatusModel!!.patientName + if (isRecording) { + recordContainer.visibility = View.VISIBLE + } else { + recordContainer.visibility = View.GONE + } + cmTimer = view.findViewById(R.id.cmTimer) cmTimer.format = "mm:ss" - cmTimer.onChronometerTickListener = Chronometer.OnChronometerTickListener { arg0: Chronometer? -> - val minutes: Long - val seconds: Long - if (!resume) { - minutes = (SystemClock.elapsedRealtime() - cmTimer.base) / 1000 / 60 - seconds = (SystemClock.elapsedRealtime() - cmTimer.base) / 1000 % 60 - elapsedTime = SystemClock.elapsedRealtime() - } else { - minutes = (elapsedTime - cmTimer.base) / 1000 / 60 - seconds = (elapsedTime - cmTimer.base) / 1000 % 60 - elapsedTime += 1000 + cmTimer.onChronometerTickListener = + Chronometer.OnChronometerTickListener { arg0: Chronometer? -> + val minutes: Long + val seconds: Long + if (!resume) { + minutes = (SystemClock.elapsedRealtime() - cmTimer.base) / 1000 / 60 + seconds = (SystemClock.elapsedRealtime() - cmTimer.base) / 1000 % 60 + elapsedTime = SystemClock.elapsedRealtime() + } else { + minutes = (elapsedTime - cmTimer.base) / 1000 / 60 + seconds = (elapsedTime - cmTimer.base) / 1000 % 60 + elapsedTime += 1000 + } + arg0?.text = "$minutes:$seconds" + Log.d(VideoCallFragment.TAG, "onChronometerTick: $minutes : $seconds") } - arg0?.text = "$minutes:$seconds" - Log.d(VideoCallFragment.TAG, "onChronometerTick: $minutes : $seconds") - } icMini.setOnClickListener { onMiniCircleClicked() @@ -310,7 +328,11 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session mVolHandler!!.postDelayed(mVolRunnable!!, (5 * 1000).toLong()) } - override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) { + override fun onRequestPermissionsResult( + requestCode: Int, + permissions: Array, + grantResults: IntArray + ) { super.onRequestPermissionsResult(requestCode, permissions, grantResults) EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this) } @@ -323,19 +345,25 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session Log.d(TAG, "onPermissionsDenied:" + requestCode + ":" + perms.size) if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) { AppSettingsDialog.Builder(this) - .setTitle(getString(R.string.title_settings_dialog)) - .setRationale(getString(R.string.rationale_ask_again)) - .setPositiveButton(getString(R.string.setting)) - .setNegativeButton(getString(R.string.cancel)) - .setRequestCode(RC_SETTINGS_SCREEN_PERM) - .build() - .show() + .setTitle(getString(R.string.title_settings_dialog)) + .setRationale(getString(R.string.rationale_ask_again)) + .setPositiveButton(getString(R.string.setting)) + .setNegativeButton(getString(R.string.cancel)) + .setRequestCode(RC_SETTINGS_SCREEN_PERM) + .build() + .show() } } @AfterPermissionGranted(RC_VIDEO_APP_PERM) private fun requestPermissions() { - val perms = arrayOf(Manifest.permission.INTERNET, Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.MODIFY_AUDIO_SETTINGS, Manifest.permission.CALL_PHONE) + val perms = arrayOf( + Manifest.permission.INTERNET, + Manifest.permission.CAMERA, + Manifest.permission.RECORD_AUDIO, + Manifest.permission.MODIFY_AUDIO_SETTINGS, + Manifest.permission.CALL_PHONE + ) if (EasyPermissions.hasPermissions(requireContext(), *perms)) { try { mSession = Session.Builder(context, apiKey, sessionId).build() @@ -345,7 +373,12 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session e.printStackTrace() } } else { - EasyPermissions.requestPermissions(this, getString(R.string.remaining_ar), RC_VIDEO_APP_PERM, *perms) + EasyPermissions.requestPermissions( + this, + getString(R.string.remaining_ar), + RC_VIDEO_APP_PERM, + *perms + ) } } @@ -354,7 +387,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session mPublisher = Publisher.Builder(requireContext()) // .name("publisher") // .renderer(ThumbnailCircleVideoRenderer(requireContext())) - .build() + .build() mPublisher!!.setPublisherListener(this) if (mPublisher!!.view is GLSurfaceView) { (mPublisher!!.view as GLSurfaceView).setZOrderOnTop(true) @@ -387,7 +420,10 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session } override fun onStreamReceived(session: Session, stream: Stream) { - Log.d(TAG, "onStreamReceived: New stream " + stream.streamId + " in session " + session.sessionId) + Log.d( + TAG, + "onStreamReceived: New stream " + stream.streamId + " in session " + session.sessionId + ) if (mSubscriber != null) { isConnected = true return @@ -396,11 +432,22 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session subscribeToStream(stream) if (mConnectedHandler != null && mConnectedRunnable != null) mConnectedHandler!!.removeCallbacks(mConnectedRunnable!!) - videoCallPresenter.callChangeCallStatus(ChangeCallStatusRequestModel(3, sessionStatusModel!!.doctorId, sessionStatusModel!!.generalid, token, sessionStatusModel!!.vcid)) + videoCallPresenter.callChangeCallStatus( + ChangeCallStatusRequestModel( + 3, + sessionStatusModel!!.doctorId, + sessionStatusModel!!.generalid, + token, + sessionStatusModel!!.vcid + ) + ) } override fun onStreamDropped(session: Session, stream: Stream) { - Log.d(TAG, "onStreamDropped: Stream " + stream.streamId + " dropped from session " + session.sessionId) + Log.d( + TAG, + "onStreamDropped: Stream " + stream.streamId + " dropped from session " + session.sessionId + ) if (mSubscriber == null) { return } @@ -427,7 +474,10 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session } override fun onVideoDataReceived(subscriberKit: SubscriberKit?) { - mSubscriber!!.setStyle(BaseVideoRenderer.STYLE_VIDEO_SCALE, BaseVideoRenderer.STYLE_VIDEO_FILL) + mSubscriber!!.setStyle( + BaseVideoRenderer.STYLE_VIDEO_SCALE, + BaseVideoRenderer.STYLE_VIDEO_FILL + ) (mSubscriber!!.renderer as DynamicVideoRenderer).enableThumbnailCircle(false) mSubscriberViewContainer.addView(mSubscriber!!.view) // switchToThumbnailCircle() @@ -477,8 +527,8 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session private fun subscribeToStream(stream: Stream) { mSubscriber = Subscriber.Builder(requireContext(), stream) - .renderer(DynamicVideoRenderer(requireContext())) - .build() + .renderer(DynamicVideoRenderer(requireContext())) + .build() mSubscriber!!.setVideoListener(this) mSession!!.subscribe(mSubscriber) } @@ -506,7 +556,15 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session mSession!!.disconnect() countDownTimer?.cancel() - videoCallPresenter.callChangeCallStatus(ChangeCallStatusRequestModel(16, sessionStatusModel!!.doctorId, sessionStatusModel!!.generalid, token, sessionStatusModel!!.vcid)) + videoCallPresenter.callChangeCallStatus( + ChangeCallStatusRequestModel( + 16, + sessionStatusModel!!.doctorId, + sessionStatusModel!!.generalid, + token, + sessionStatusModel!!.vcid + ) + ) dialog?.dismiss() } @@ -546,13 +604,13 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session private fun onMiniCircleClicked() { if (isCircle) { dialog?.window?.setLayout( - 400, - 600 + 400, + 600 ) } else { dialog?.window?.setLayout( - 300, - 300 + 300, + 300 ) } isCircle = !isCircle @@ -561,11 +619,23 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session (mSubscriber!!.renderer as DynamicVideoRenderer).enableThumbnailCircle(isCircle) } else { if (isCircle) { - videoCallContainer.background = ContextCompat.getDrawable(requireContext(), R.drawable.circle_shape) - mSubscriberViewContainer.background = ContextCompat.getDrawable(requireContext(), R.drawable.circle_shape) + videoCallContainer.background = + ContextCompat.getDrawable(requireContext(), R.drawable.circle_shape) + mSubscriberViewContainer.background = + ContextCompat.getDrawable(requireContext(), R.drawable.circle_shape) } else { - videoCallContainer.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.text_color)) - mSubscriberViewContainer.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.remoteBackground)) + videoCallContainer.setBackgroundColor( + ContextCompat.getColor( + requireContext(), + R.color.text_color + ) + ) + mSubscriberViewContainer.setBackgroundColor( + ContextCompat.getColor( + requireContext(), + R.color.remoteBackground + ) + ) } } @@ -582,13 +652,13 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session private fun onMinimizedClicked(view: View?) { if (isFullScreen) { dialog?.window?.setLayout( - 400, - 600 + 400, + 600 ) } else { dialog?.window?.setLayout( - LinearLayout.LayoutParams.MATCH_PARENT, - LinearLayout.LayoutParams.MATCH_PARENT + LinearLayout.LayoutParams.MATCH_PARENT, + LinearLayout.LayoutParams.MATCH_PARENT ) } isFullScreen = !isFullScreen @@ -602,24 +672,34 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session private fun setViewsVisibility() { val iconSize: Int = context!!.resources.getDimension(R.dimen.video_icon_size).toInt() - val iconSizeSmall: Int = context!!.resources.getDimension(R.dimen.video_icon_size_small).toInt() - val btnMinimizeLayoutParam: ConstraintLayout.LayoutParams = btnMinimize.layoutParams as ConstraintLayout.LayoutParams - val mCallBtnLayoutParam: ConstraintLayout.LayoutParams = mCallBtn.layoutParams as ConstraintLayout.LayoutParams - - val localPreviewMargin: Int = context!!.resources.getDimension(R.dimen.local_preview_margin_top).toInt() - val localPreviewWidth: Int = context!!.resources.getDimension(R.dimen.local_preview_width).toInt() - val localPreviewHeight: Int = context!!.resources.getDimension(R.dimen.local_preview_height).toInt() + val iconSizeSmall: Int = + context!!.resources.getDimension(R.dimen.video_icon_size_small).toInt() + val btnMinimizeLayoutParam: ConstraintLayout.LayoutParams = + btnMinimize.layoutParams as ConstraintLayout.LayoutParams + val mCallBtnLayoutParam: ConstraintLayout.LayoutParams = + mCallBtn.layoutParams as ConstraintLayout.LayoutParams + + val localPreviewMargin: Int = + context!!.resources.getDimension(R.dimen.local_preview_margin_top).toInt() + val localPreviewWidth: Int = + context!!.resources.getDimension(R.dimen.local_preview_width).toInt() + val localPreviewHeight: Int = + context!!.resources.getDimension(R.dimen.local_preview_height).toInt() // val localPreviewIconSize: Int = context!!.resources.getDimension(R.dimen.local_back_icon_size).toInt() // val localPreviewMarginSmall : Int = context!!.resources.getDimension(R.dimen.local_preview_margin_small).toInt() // val localPreviewWidthSmall : Int = context!!.resources.getDimension(R.dimen.local_preview_width_small).toInt() // val localPreviewHeightSmall : Int = context!!.resources.getDimension(R.dimen.local_preview_height_small).toInt() // val localPreviewIconSmall: Int = context!!.resources.getDimension(R.dimen.local_back_icon_size_small).toInt() // val localPreviewLayoutIconParam : FrameLayout.LayoutParams - val localPreviewLayoutParam: RelativeLayout.LayoutParams = mPublisherViewContainer.layoutParams as RelativeLayout.LayoutParams + val localPreviewLayoutParam: RelativeLayout.LayoutParams = + mPublisherViewContainer.layoutParams as RelativeLayout.LayoutParams - val remotePreviewIconSize: Int = context!!.resources.getDimension(R.dimen.remote_back_icon_size).toInt() - val remotePreviewIconSizeSmall: Int = context!!.resources.getDimension(R.dimen.remote_back_icon_size_small).toInt() - val remotePreviewLayoutParam: FrameLayout.LayoutParams = mSubscriberViewIcon.layoutParams as FrameLayout.LayoutParams + val remotePreviewIconSize: Int = + context!!.resources.getDimension(R.dimen.remote_back_icon_size).toInt() + val remotePreviewIconSizeSmall: Int = + context!!.resources.getDimension(R.dimen.remote_back_icon_size_small).toInt() + val remotePreviewLayoutParam: FrameLayout.LayoutParams = + mSubscriberViewIcon.layoutParams as FrameLayout.LayoutParams if (isFullScreen) { layoutName.visibility = View.VISIBLE @@ -638,7 +718,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session localPreviewLayoutParam.width = localPreviewWidth localPreviewLayoutParam.height = localPreviewHeight localPreviewLayoutParam.setMargins(0, localPreviewMargin, localPreviewMargin, 0) - if (mPublisher != null && mPublisher!!.view.parent == null){ + if (mPublisher != null && mPublisher!!.view.parent == null) { mPublisherViewContainer.addView(mPublisher!!.view) } mPublisherViewContainer.visibility = View.VISIBLE @@ -666,7 +746,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session localPreviewLayoutParam.height = 0 localPreviewLayoutParam.setMargins(0, localPreviewMargin / 2, localPreviewMargin / 2, 0) - if (mPublisher != null){ + if (mPublisher != null) { mPublisherViewContainer.removeView(mPublisher!!.view) } mPublisherViewContainer.visibility = View.GONE @@ -814,7 +894,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session var mParams: WindowManager.LayoutParams = dialog!!.window!!.attributes mParams.x = - (szWindow.x - current_x_cord * current_x_cord - videoCallContainer.width).toInt() + (szWindow.x - current_x_cord * current_x_cord - videoCallContainer.width).toInt() dialog!!.window!!.attributes = mParams val x = szWindow.x - current_x_cord @@ -825,7 +905,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session val step = (500 - t) / 5 // mParams.x = 0 - (current_x_cord * current_x_cord * step).toInt() mParams.x = - (szWindow.x - current_x_cord * current_x_cord * step - videoCallContainer.width).toInt() + (szWindow.x - current_x_cord * current_x_cord * step - videoCallContainer.width).toInt() dialog!!.window!!.attributes = mParams } @@ -851,7 +931,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session override fun onTick(t: Long) { val step = (500 - t) / 5 mParams.x = - (szWindow.x + current_x_cord * current_x_cord * step - videoCallContainer.width).toInt() + (szWindow.x + current_x_cord * current_x_cord * step - videoCallContainer.width).toInt() dialog!!.window!!.attributes = mParams } @@ -866,17 +946,20 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session private fun getWindowManagerDefaultDisplay() { mWindowManager.getDefaultDisplay() - .getSize(szWindow) + .getSize(szWindow) } /* return status bar height on basis of device display metrics */ private fun getStatusBarHeight(): Int { return ceil( - (25 * requireActivity().applicationContext.resources.displayMetrics.density).toDouble() + (25 * requireActivity().applicationContext.resources.displayMetrics.density).toDouble() ).toInt() } - private class MyGestureListener(val onTabCall: () -> Unit, val miniCircleDoubleTap: () -> Unit) : GestureDetector.SimpleOnGestureListener() { + private class MyGestureListener( + val onTabCall: () -> Unit, + val miniCircleDoubleTap: () -> Unit + ) : GestureDetector.SimpleOnGestureListener() { override fun onSingleTapConfirmed(event: MotionEvent): Boolean { // onTabCall() @@ -893,9 +976,9 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session companion object { @JvmStatic fun newInstance(args: Bundle) = - VideoCallFragment().apply { - arguments = args - } + VideoCallFragment().apply { + arguments = args + } private val TAG = VideoCallFragment::class.java.simpleName diff --git a/android/app/src/main/res/drawable/ic_record.xml b/android/app/src/main/res/drawable/ic_record.xml new file mode 100644 index 00000000..ffc49a08 --- /dev/null +++ b/android/app/src/main/res/drawable/ic_record.xml @@ -0,0 +1,5 @@ + + + diff --git a/android/app/src/main/res/layout/activity_video_call.xml b/android/app/src/main/res/layout/activity_video_call.xml index a54e57b3..c492acb5 100644 --- a/android/app/src/main/res/layout/activity_video_call.xml +++ b/android/app/src/main/res/layout/activity_video_call.xml @@ -108,6 +108,23 @@ android:src="@drawable/video_off_fill" /> + + + + + (); + LiveCarePatientServices _liveCarePatientServices = + locator(); - openVideo(StartCallRes startModel,PatiantInformtion patientModel,VoidCallback onCallConnected, VoidCallback onCallDisconnected)async{ + openVideo( + StartCallRes startModel, + PatiantInformtion patientModel, + bool isRecording, + VoidCallback onCallConnected, + VoidCallback onCallDisconnected) async { this.startCallRes = startModel; this.patient = patientModel; - DoctorProfileModel doctorProfile = await getDoctorProfile(isGetProfile: true); + DoctorProfileModel doctorProfile = + await getDoctorProfile(isGetProfile: true); await VideoChannel.openVideoCallScreen( - kToken: startCallRes.openTokenID, - kSessionId:startCallRes.openSessionID, - kApiKey: '46209962' ,//'46209962' + kToken: startCallRes.openTokenID, + kSessionId: startCallRes.openSessionID, + kApiKey: '46209962', vcId: patient.vcId, - patientName: patient.fullName ?? (patient.firstName != null ? "${patient.firstName} ${patient.lastName}" : "-"), + isRecording: isRecording, + patientName: patient.fullName ?? + (patient.firstName != null + ? "${patient.firstName} ${patient.lastName}" + : "-"), tokenID: await sharedPref.getString(TOKEN), generalId: GENERAL_ID, doctorId: doctorProfile.doctorID, onFailure: (String error) { DrAppToastMsg.showErrorToast(error); - },onCallConnected: onCallConnected, + }, + onCallConnected: onCallConnected, onCallEnd: () { WidgetsBinding.instance.addPostFrameCallback((_) async { - GifLoaderDialogUtils.showMyDialog(locator().navigatorKey.currentContext); - endCall(patient.vcId, false,).then((value) { - GifLoaderDialogUtils.hideDialog(locator().navigatorKey.currentContext); - if (hasError) { - DrAppToastMsg.showErrorToast(error); - }else - locator().navigateTo(PATIENTS_END_Call,arguments: { - "patient": patient, - }); - - }); + GifLoaderDialogUtils.showMyDialog( + locator().navigatorKey.currentContext); + endCall( + patient.vcId, + false, + ).then((value) { + GifLoaderDialogUtils.hideDialog( + locator().navigatorKey.currentContext); + if (hasError) { + DrAppToastMsg.showErrorToast(error); + } else + locator() + .navigateTo(PATIENTS_END_Call, arguments: { + "patient": patient, + }); + }); }); }, onCallNotRespond: (SessionStatusModel sessionStatusModel) { WidgetsBinding.instance.addPostFrameCallback((_) { - GifLoaderDialogUtils.showMyDialog(locator().navigatorKey.currentContext); - endCall(patient.vcId, sessionStatusModel.sessionStatus == 3,).then((value) { - GifLoaderDialogUtils.hideDialog(locator().navigatorKey.currentContext); + GifLoaderDialogUtils.showMyDialog( + locator().navigatorKey.currentContext); + endCall( + patient.vcId, + sessionStatusModel.sessionStatus == 3, + ).then((value) { + GifLoaderDialogUtils.hideDialog( + locator().navigatorKey.currentContext); if (hasError) { DrAppToastMsg.showErrorToast(error); } else { - locator().navigateTo(PATIENTS_END_Call,arguments: { + locator() + .navigateTo(PATIENTS_END_Call, arguments: { "patient": patient, }); } - }); - - }); + }); }); - } + Future endCall(int vCID, bool isPatient) async { hasError = false; await getDoctorProfile(isGetProfile: true); @@ -85,5 +105,4 @@ class VideoCallService extends BaseService{ error = _liveCarePatientServices.error; } } - -} \ No newline at end of file +} diff --git a/lib/models/livecare/start_call_res.dart b/lib/models/livecare/start_call_res.dart index 67259996..e3c1a54f 100644 --- a/lib/models/livecare/start_call_res.dart +++ b/lib/models/livecare/start_call_res.dart @@ -5,6 +5,7 @@ class StartCallRes { bool isAuthenticated; int messageStatus; String appointmentNo; + bool isRecording; StartCallRes( {this.result, @@ -12,7 +13,9 @@ class StartCallRes { this.openTokenID, this.isAuthenticated, this.appointmentNo, - this.messageStatus}); + this.messageStatus, + this.isRecording = true, + }); StartCallRes.fromJson(Map json) { result = json['Result']; @@ -21,6 +24,7 @@ class StartCallRes { isAuthenticated = json['IsAuthenticated']; messageStatus = json['MessageStatus']; appointmentNo = json['AppointmentNo']; + isRecording = json['isRecording']; } Map toJson() { @@ -31,6 +35,7 @@ class StartCallRes { data['IsAuthenticated'] = this.isAuthenticated; data['MessageStatus'] = this.messageStatus; data['AppointmentNo'] = this.appointmentNo; + data['isRecording'] = this.isRecording; return data; } } diff --git a/lib/screens/live_care/end_call_screen.dart b/lib/screens/live_care/end_call_screen.dart index d3db12b6..0e65182b 100644 --- a/lib/screens/live_care/end_call_screen.dart +++ b/lib/screens/live_care/end_call_screen.dart @@ -79,6 +79,7 @@ class _EndCallScreenState extends State { kSessionId: liveCareModel.startCallRes.openSessionID, kApiKey: '46209962', vcId: patient.vcId, + isRecording: liveCareModel.startCallRes != null ? liveCareModel.startCallRes.isRecording: false, patientName: patient.fullName ?? (patient.firstName != null ? "${patient.firstName} ${patient.lastName}" : "-"), tokenID: await liveCareModel.getToken(), generalId: GENERAL_ID, diff --git a/lib/screens/live_care/video_call.dart b/lib/screens/live_care/video_call.dart index 07de1943..e024624a 100644 --- a/lib/screens/live_care/video_call.dart +++ b/lib/screens/live_care/video_call.dart @@ -66,6 +66,7 @@ class _VideoCallPageState extends State { //'1_MX40NjgwMzIyNH5-MTU5MzY4MzYzODYwM35ucExWYVRVSm5Hcy9uWGZmM1lOa3czZHV-fg', kApiKey: '46209962', vcId: widget.patientData.vcId, + isRecording: tokenData != null ? tokenData.isRecording: false, patientName: widget.patientData.fullName ?? widget.patientData.firstName != null ? "${widget.patientData.firstName} ${widget.patientData.lastName}" : "-", tokenID: token, //"hfkjshdf347r8743", generalId: "Cs2020@2016\$2958", diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index e11c1abf..4ad8e71d 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -57,6 +57,7 @@ class _PatientProfileScreenState extends State StreamController videoCallDurationStreamController; Stream videoCallDurationStream = (() async*{})(); + @override void initState() { _tabController = TabController(length: 2, vsync: this); @@ -119,6 +120,10 @@ class _PatientProfileScreenState extends State callDisconnected(){ callTimer.cancel(); videoCallDurationStreamController.sink.add(null); + + setState(() { + isCallStarted = false; + }); } @override @@ -350,7 +355,7 @@ class _PatientProfileScreenState extends State }); GifLoaderDialogUtils.hideDialog(context); AppPermissionsUtils.requestVideoCallPermission(context: context,onTapGrant: (){ - locator().openVideo(model.startCallRes, patient, callConnected, callDisconnected); + locator().openVideo(model.startCallRes, patient, model.startCallRes.isRecording, callConnected, callDisconnected); }); } } diff --git a/lib/util/VideoChannel.dart b/lib/util/VideoChannel.dart index 832749cf..94035d7d 100644 --- a/lib/util/VideoChannel.dart +++ b/lib/util/VideoChannel.dart @@ -11,7 +11,7 @@ class VideoChannel{ /// channel name static const _channel = const MethodChannel("Dr.cloudSolution/videoCall"); static openVideoCallScreen({kApiKey, kSessionId, kToken, callDuration, warningDuration,int vcId,String tokenID, - String generalId,int doctorId, String patientName, Function() onCallEnd , + String generalId,int doctorId, String patientName, bool isRecording = false, Function() onCallEnd , Function(SessionStatusModel sessionStatusModel) onCallNotRespond ,Function(String error) onFailure, VoidCallback onCallConnected, VoidCallback onCallDisconnected}) async { onCallConnected = onCallConnected ?? (){}; @@ -41,6 +41,7 @@ class VideoChannel{ "generalId": generalId, "DoctorId": doctorId , "patientName": patientName, + "isRecording": isRecording, }, ); if(result['callResponse'] == 'CallEnd') { From 0bc3b84cf8bf41225c566dd92dc9b0b55ad7e8b1 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 24 Jun 2021 09:20:45 +0300 Subject: [PATCH 2/7] fix sorting inside inpatient --- lib/screens/patients/InPatientPage.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/screens/patients/InPatientPage.dart b/lib/screens/patients/InPatientPage.dart index cf4b6120..a88d3007 100644 --- a/lib/screens/patients/InPatientPage.dart +++ b/lib/screens/patients/InPatientPage.dart @@ -26,7 +26,7 @@ class InPatientPage extends StatefulWidget { class _InPatientPageState extends State { TextEditingController _searchController = TextEditingController(); - bool isSortDes = true; + bool isSortDes = false; @override void dispose() { From ac526e89134a3c7ecc746cef5ae752e074bb99b5 Mon Sep 17 00:00:00 2001 From: mosazaid Date: Thu, 24 Jun 2021 13:12:24 +0300 Subject: [PATCH 3/7] change record icon --- android/app/src/main/res/drawable/ic_record.png | Bin 0 -> 16218 bytes android/app/src/main/res/drawable/ic_record.xml | 5 ----- 2 files changed, 5 deletions(-) create mode 100644 android/app/src/main/res/drawable/ic_record.png delete mode 100644 android/app/src/main/res/drawable/ic_record.xml diff --git a/android/app/src/main/res/drawable/ic_record.png b/android/app/src/main/res/drawable/ic_record.png new file mode 100644 index 0000000000000000000000000000000000000000..39eada428c9fec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_=am+o6df=zr6>b*53#X3&2CN`@Tl$J9w zB(OzA7OmZ4hcY)ztBJ2}j2WBWh!rsC6jegW`UP9dZu>dY(t9bLy={%t3|XaRg7L<| za_TH2MrX^&6?rni-lehS#`h7RTN46n+&)S>JhmGyn}4_ciCLI8iXpt1{H-1#2(dus z-z?ThqynMIuyk!`oQLWIGEv^XNQ^`z3hIfh%?beP(&rzZMmG4Z-Kr2Uu(tLkpCLx# z%Z$#TisEyx7XdfyEjxn634l6GR95f+CWj>yABFhg;0Jy(&utYY_+yBP^#Eo>ZUDJQ z7@lw(;#WK0Jj|%4Agj#7s3H(E0KQC~%J44Qcx?_C4Mm(Cd#s7m5f(?d`PXIw&q=#m zUyvz+@j<}+oNBhOD$m0vSLh}!`k(wTL?S>N?`jl~0>|=sG#8q4-9&OVu%dzP%xkKM z7@*yS>oU7teOZ*A(x|uQ%!+=}r9pF_QFkV4y>>7~a@xkn5 zqVyZTD*bX9QK{uV-e0&8r3Xi~Vk39Us%BtMyg9%*QGdL7Dat6}xe;y!wvA-7)eIgR zIEl)^oc8hh+fmW_yo$LB_a|UrwtdZ2B zWmQJju)cxWG$j+LpCprtq<}a>ub%qkx9ILX1PYkWvy|}z3|b7*61XPfE}Nbhpoy`i zRgZgnuF{@LM8O+>{~EV?AFw?irG74Pc{dk&jv6OU18+z9`MIrrqJR{h``J=o*H10> zP625<-=pHj$iwhlYOg+AYi@OPDAvYFa;As4 zCX&7Zbv$n>T9Qe9gsXI;`_6tXvg=4`7cE_$Ee7r;UWSYlz0p8${WmW0itP=cd-(4k zK&$9&^zPV&2aUba0OH#lyZYH1K8NyQPn64)J*pZ{N-Qherr z-QfPNf&b5QcHNG+JB~5`b8fXL0-= hp#x_1|D@XgeT1G^zr)(sUvODfB*(n<|Ngq`{{=fLpvC|I literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable/ic_record.xml b/android/app/src/main/res/drawable/ic_record.xml deleted file mode 100644 index ffc49a08..00000000 --- a/android/app/src/main/res/drawable/ic_record.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - From f5b7829e7d9924d14594b6983e8a2ffad60d7ff1 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Thu, 24 Jun 2021 14:11:57 +0300 Subject: [PATCH 4/7] fix create create episode on live care --- lib/models/patient/patiant_info_model.dart | 450 ++++++++++-------- .../live_care/live_care_patient_screen.dart | 5 +- 2 files changed, 266 insertions(+), 189 deletions(-) diff --git a/lib/models/patient/patiant_info_model.dart b/lib/models/patient/patiant_info_model.dart index 4facbc3c..a9c55811 100644 --- a/lib/models/patient/patiant_info_model.dart +++ b/lib/models/patient/patiant_info_model.dart @@ -1,9 +1,9 @@ -// TODO : it have to be changed. +// TODO = it have to be changed. import 'package:doctor_app_flutter/util/date-utils.dart'; class PatiantInformtion { - final PatiantInformtion patientDetails; + PatiantInformtion patientDetails; int genderInt; dynamic age; String appointmentDate; @@ -79,191 +79,267 @@ class PatiantInformtion { int vcId; String voipToken; - PatiantInformtion( - {this.patientDetails, - this.projectId, - this.clinicId, - this.doctorId, - this.patientId, - this.doctorName, - this.doctorNameN, - this.firstName, - this.middleName, - this.lastName, - this.firstNameN, - this.middleNameN, - this.lastNameN, - this.gender, - this.dateofBirth, - this.nationalityId, - this.mobileNumber, - this.emailAddress, - this.patientIdentificationNo, - this.patientType, - this.admissionNo, - this.admissionDate, - this.createdOn, - this.roomId, - this.bedId, - this.nursingStationId, - this.description, - this.clinicDescription, - this.clinicDescriptionN, - this.nationalityName, - this.nationalityNameN, - this.age, - this.genderDescription, - this.nursingStationName, - this.appointmentDate, - this.startTime, - this.appointmentNo, - this.arrivalTime, - this.arrivalTimeD, - this.callStatus, - this.callStatusDisc, - this.callTypeID, - this.clientRequestID, - this.clinicName, - this.consoltationEnd, - this.consultationNotes, - this.appointmentType, - this.appointmentTypeId, - this.arrivedOn, - this.clinicGroupId, - this.companyName, - this.dischargeStatus, - this.doctorDetails, - this.endTime, - this.episodeNo, - this.fallRiskScore, - this.genderInt, - this.isSigned, - this.medicationOrders, - this.nationality, - this.patientMRN, - this.visitType, - this.fullName, - this.fullNameN, - this.nationalityFlagURL, - this.patientStatusType, - this.patientStatus, - this.visitTypeId, - this.startTimes, - this.dischargeDate, - this.status, - this.vcId, - this.voipToken, - this.admissionDateWithDateTimeForm, this.appointmentDateWithDateTimeForm}); + PatiantInformtion({this.patientDetails, + this.projectId, + this.clinicId, + this.doctorId, + this.patientId, + this.doctorName, + this.doctorNameN, + this.firstName, + this.middleName, + this.lastName, + this.firstNameN, + this.middleNameN, + this.lastNameN, + this.gender, + this.dateofBirth, + this.nationalityId, + this.mobileNumber, + this.emailAddress, + this.patientIdentificationNo, + this.patientType, + this.admissionNo, + this.admissionDate, + this.createdOn, + this.roomId, + this.bedId, + this.nursingStationId, + this.description, + this.clinicDescription, + this.clinicDescriptionN, + this.nationalityName, + this.nationalityNameN, + this.age, + this.genderDescription, + this.nursingStationName, + this.appointmentDate, + this.startTime, + this.appointmentNo, + this.arrivalTime, + this.arrivalTimeD, + this.callStatus, + this.callStatusDisc, + this.callTypeID, + this.clientRequestID, + this.clinicName, + this.consoltationEnd, + this.consultationNotes, + this.appointmentType, + this.appointmentTypeId, + this.arrivedOn, + this.clinicGroupId, + this.companyName, + this.dischargeStatus, + this.doctorDetails, + this.endTime, + this.episodeNo, + this.fallRiskScore, + this.genderInt, + this.isSigned, + this.medicationOrders, + this.nationality, + this.patientMRN, + this.visitType, + this.fullName, + this.fullNameN, + this.nationalityFlagURL, + this.patientStatusType, + this.patientStatus, + this.visitTypeId, + this.startTimes, + this.dischargeDate, + this.status, + this.vcId, + this.voipToken, + this.admissionDateWithDateTimeForm, this.appointmentDateWithDateTimeForm}); - factory PatiantInformtion.fromJson(Map json) => - PatiantInformtion( - patientDetails: json['patientDetails'] != null - ? new PatiantInformtion.fromJson(json['patientDetails']) - : null, - projectId: json["ProjectID"] ?? json["projectID"], - clinicId: json["ClinicID"] ?? json["clinicID"], - doctorId: json["DoctorID"] ?? json["doctorID"], - patientId: json["PatientID"] != null - ? json["PatientID"] is String - ? int.parse(json["PatientID"]) - : json["PatientID"] - : json["patientID"] ?? json['patientMRN'] ?? json['PatientMRN'], - doctorName: json["DoctorName"] ?? json["doctorName"], - doctorNameN: json["DoctorNameN"] ?? json["doctorNameN"], - firstName: json["FirstName"] ?? json["firstName"], - middleName: json["MiddleName"] ?? json["middleName"], - lastName: json["LastName"] ?? json["lastName"], - firstNameN: json["FirstNameN"] ?? json["firstNameN"], - middleNameN: json["MiddleNameN"] ?? json["middleNameN"], - lastNameN: json["LastNameN"] ?? json["lastNameN"], - gender: json["Gender"] != null - ? json["Gender"] is String - ? int.parse(json["Gender"]) - : json["Gender"] - : json["gender"], - fullName: json["fullName"] ?? json["fullName"] ?? json["PatientName"], - fullNameN: - json["fullNameN"] ?? json["fullNameN"] ?? json["PatientName"], - dateofBirth: json["DateofBirth"] ?? json["dob"] ?? json['DateOfBirth'], - nationalityId: json["NationalityID"] ?? json["nationalityID"], - mobileNumber: json["MobileNumber"] ?? json["mobileNumber"], - emailAddress: json["EmailAddress"] ?? json["emailAddress"], - patientIdentificationNo: - json["PatientIdentificationNo"] ?? json["patientIdentificationNo"], - //TODO make 7 dynamic when the backend retrun it in patient arrival - patientType: json["PatientType"] ?? json["patientType"] ?? 1, - admissionNo: json["AdmissionNo"] ?? json["admissionNo"], - admissionDate: json["AdmissionDate"] ?? json["admissionDate"], - createdOn: json["CreatedOn"] ?? json["CreatedOn"], - roomId: json["RoomID"] ?? json["roomID"], - bedId: json["BedID"] ?? json["bedID"], - nursingStationId: json["NursingStationID"] ?? json["nursingStationID"], - description: json["Description"] ?? json["description"], - clinicDescription: - json["ClinicDescription"] ?? json["clinicDescription"], - clinicDescriptionN: - json["ClinicDescriptionN"] ?? json["clinicDescriptionN"], - nationalityName: json["NationalityName"] ?? - json["nationalityName"] ?? - json['NationalityName'], - nationalityNameN: json["NationalityNameN"] ?? - json["nationalityNameN"] ?? - json['NationalityNameN'], - age: json["Age"] ?? json["age"], - genderDescription: json["GenderDescription"], - nursingStationName: json["NursingStationName"], - appointmentDate: json["AppointmentDate"] ?? '', - startTime: json["startTime"] ?? json['StartTime'], - appointmentNo: json['appointmentNo'] ?? json['AppointmentNo'], - appointmentType: json['appointmentType'], - appointmentTypeId: - json['appointmentTypeId'] ?? json['appointmentTypeid'], - arrivedOn: json['ArrivedOn'] ?? json['arrivedOn'] ?? json['ArrivedOn'], - clinicGroupId: json['clinicGroupId'], - companyName: json['companyName'], - dischargeStatus: json['dischargeStatus'], - doctorDetails: json['doctorDetails'], - endTime: json['endTime'], - episodeNo: json['episodeNo'] ?? json['EpisodeID'] ?? json['EpisodeNo'], - fallRiskScore: json['fallRiskScore'], - isSigned: json['isSigned'], - medicationOrders: json['medicationOrders'], - nationality: json['nationality'] ?? json['NationalityNameN'], - patientMRN: json['patientMRN'] ?? - json['PatientMRN'] ?? - (json["PatientID"] != null - ? int?.parse(json["PatientID"].toString()) - : json["patientID"] != null ? int?.parse( - json["patientID"].toString()) : json["patientId"] != null ? int - ?.parse(json["patientId"].toString()) : ''), - visitType: json['visitType'] ?? json['visitType'] ?? json['visitType'], - nationalityFlagURL: - json['NationalityFlagURL'] ?? json['NationalityFlagURL'], - patientStatusType: - json['patientStatusType'] ?? json['PatientStatusType'], - visitTypeId: - json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid'], - startTimes: json['StartTime'] ?? json['StartTime'], - dischargeDate: json['DischargeDate'], - status: json['Status'], - vcId: json['VC_ID'], - arrivalTime: json['ArrivalTime'], - arrivalTimeD: json['ArrivalTimeD'], - callStatus: json['CallStatus'], - callStatusDisc: json['CallStatusDisc'], - callTypeID: json['CallTypeID'], - clientRequestID: json['ClientRequestID'], - clinicName: json['ClinicName'], - consoltationEnd: json['ConsoltationEnd'], - consultationNotes: json['ConsultationNotes'], - patientStatus: json['PatientStatus'], - voipToken: json['VoipToken'], - admissionDateWithDateTimeForm: json["AdmissionDate"] != null - ? AppDateUtils.convertStringToDate(json["AdmissionDate"]) - : json["admissionDate"] != null ? AppDateUtils.convertStringToDate( - json["admissionDate"]) : null, + PatiantInformtion.fromJson(Map json) { + { + patientDetails = json['patientDetails'] != null + ? new PatiantInformtion.fromJson(json['patientDetails']) + : null; + projectId = json["ProjectID"] ?? json["projectID"]; + clinicId = json["ClinicID"] ?? json["clinicID"]; + doctorId = json["DoctorID"] ?? json["doctorID"]; + patientId = json["PatientID"] != null + ? json["PatientID"] is String + ? int.parse(json["PatientID"]) + : json["PatientID"] + : json["patientID"] ?? json['patientMRN'] ?? json['PatientMRN']; + doctorName = json["DoctorName"] ?? json["doctorName"]; + doctorNameN = json["DoctorNameN"] ?? json["doctorNameN"]; + firstName = json["FirstName"] ?? json["firstName"]; + middleName = json["MiddleName"] ?? json["middleName"]; + lastName = json["LastName"] ?? json["lastName"]; + firstNameN = json["FirstNameN"] ?? json["firstNameN"]; + middleNameN = json["MiddleNameN"] ?? json["middleNameN"]; + lastNameN = json["LastNameN"] ?? json["lastNameN"]; + gender = json["Gender"] != null + ? json["Gender"] is String + ? int.parse(json["Gender"]) + : json["Gender"] + : json["gender"]; + fullName = json["fullName"] ?? json["fullName"] ?? json["PatientName"]; + fullNameN = + json["fullNameN"] ?? json["fullNameN"] ?? json["PatientName"]; + dateofBirth = json["DateofBirth"] ?? json["dob"] ?? json['DateOfBirth']; + nationalityId = json["NationalityID"] ?? json["nationalityID"]; + mobileNumber = json["MobileNumber"] ?? json["mobileNumber"]; + emailAddress = json["EmailAddress"] ?? json["emailAddress"]; + patientIdentificationNo = + json["PatientIdentificationNo"] ?? json["patientIdentificationNo"]; + //TODO make 7 dynamic when the backend retrun it in patient arrival + patientType = json["PatientType"] ?? json["patientType"] ?? 1; + admissionNo = json["AdmissionNo"] ?? json["admissionNo"]; + admissionDate = json["AdmissionDate"] ?? json["admissionDate"]; + createdOn = json["CreatedOn"] ?? json["CreatedOn"]; + roomId = json["RoomID"] ?? json["roomID"]; + bedId = json["BedID"] ?? json["bedID"]; + nursingStationId = json["NursingStationID"] ?? json["nursingStationID"]; + description = json["Description"] ?? json["description"]; + clinicDescription = + json["ClinicDescription"] ?? json["clinicDescription"]; + clinicDescriptionN = + json["ClinicDescriptionN"] ?? json["clinicDescriptionN"]; + nationalityName = json["NationalityName"] ?? + json["nationalityName"] ?? + json['NationalityName']; + nationalityNameN = json["NationalityNameN"] ?? + json["nationalityNameN"] ?? + json['NationalityNameN']; + age = json["Age"] ?? json["age"]; + genderDescription = json["GenderDescription"]; + nursingStationName = json["NursingStationName"]; + appointmentDate = json["AppointmentDate"] ?? ''; + startTime = json["startTime"] ?? json['StartTime']; + appointmentNo = json['appointmentNo'] ?? json['AppointmentNo']; + appointmentType = json['appointmentType']; + appointmentTypeId = + json['appointmentTypeId'] ?? json['appointmentTypeid']; + arrivedOn = json['ArrivedOn'] ?? json['arrivedOn'] ?? json['ArrivedOn']; + clinicGroupId = json['clinicGroupId']; + companyName = json['companyName']; + dischargeStatus = json['dischargeStatus']; + doctorDetails = json['doctorDetails']; + endTime = json['endTime']; + episodeNo = json['episodeNo'] ?? json['EpisodeID'] ?? json['EpisodeNo']; + fallRiskScore = json['fallRiskScore']; + isSigned = json['isSigned']; + medicationOrders = json['medicationOrders']; + nationality = json['nationality'] ?? json['NationalityNameN']; + patientMRN = json['patientMRN'] ?? + json['PatientMRN'] ?? + (json["PatientID"] != null + ? int?.parse(json["PatientID"].toString()) + : json["patientID"] != null ? int?.parse( + json["patientID"].toString()) : json["patientId"] != null ? int + ?.parse(json["patientId"].toString()) : ''); + visitType = json['visitType'] ?? json['visitType'] ?? json['visitType']; + nationalityFlagURL = + json['NationalityFlagURL'] ?? json['NationalityFlagURL']; + patientStatusType = + json['patientStatusType'] ?? json['PatientStatusType']; + visitTypeId = + json['visitTypeId'] ?? json['visitTypeId'] ?? json['visitTypeid']; + startTimes = json['StartTime'] ?? json['StartTime']; + dischargeDate = json['DischargeDate']; + status = json['Status']; + vcId = json['VC_ID']; - appointmentDateWithDateTimeForm: json["AppointmentDate"]!= null?AppDateUtils.convertStringToDate(json["AppointmentDate"]):null - ); -} + arrivalTime = json['ArrivalTime']; + arrivalTimeD = json['ArrivalTimeD']; + callStatus = json['CallStatus']; + callStatusDisc = json['CallStatusDisc']; + callTypeID = json['CallTypeID']; + clientRequestID = json['ClientRequestID']; + clinicName = json['ClinicName']; + consoltationEnd = json['ConsoltationEnd']; + consultationNotes = json['ConsultationNotes']; + patientStatus = json['PatientStatus']; + voipToken = json['VoipToken']; + admissionDateWithDateTimeForm = json["AdmissionDate"] != null + ? AppDateUtils.convertStringToDate(json["AdmissionDate"]) + : json["admissionDate"] != null ? AppDateUtils.convertStringToDate( + json["admissionDate"]) : null; + + appointmentDateWithDateTimeForm = + json["AppointmentDate"] != null ? AppDateUtils.convertStringToDate( + json["AppointmentDate"]) : null; + } + } + + + Map toJson() { + final Map data = new Map(); + + data['patientDetails'] = this.patientDetails; + data["ProjectID"] = this.projectId; + data["projectID"] = this.projectId; + data["ClinicID"] = this.clinicId; + data["clinicID"] = this.clinicId; + data["DoctorID"] = this.doctorId; + data["doctorID"] = this.doctorId; + data["PatientID"] = this.patientId; + data["patientID"] = this.patientId; + data['patientMRN'] = this.patientMRN; + data['PatientMRN'] = this.patientMRN; + + data['episodeNo'] = this.episodeNo; + data['EpisodeID'] = this.episodeNo; + data['EpisodeNo'] = this.episodeNo; + + data["DoctorName"] = this.doctorName; + data["doctorName"] = this.doctorName; + data["DoctorNameN"] = this.doctorNameN; + data["doctorNameN"] = this.doctorNameN; + data["FirstName"] = this.firstName; + data["firstName"] = this.firstName; + data["MiddleName"] = this.middleName; + data["middleName"] = this.middleName; + data["LastName"] = this.lastName; + data["lastName"] = this.lastName; + data["FirstNameN"] = this.firstNameN; + data["firstNameN"] = this.firstNameN; + data["MiddleNameN"] = this.middleNameN; + data["middleNameN"] = this.middleNameN; + data["LastNameN"] = this.lastNameN; + data["lastNameN"] = this.lastNameN; + + data["fullName"] = this.fullName; + data["fullName"] = this.fullName; + data["PatientName"] = this.fullName; + + data["Gender"] = this.gender; + data["gender"] = this.gender; + + + data['Age'] = this.age; + data['AppointmentDate'] = this.appointmentDate.isNotEmpty?this.appointmentDate:null; + data['AppointmentNo'] = this.appointmentNo; + data['ArrivalTime'] = this.arrivalTime; + data['ArrivalTimeD'] = this.arrivalTimeD; + data['CallStatus'] = this.callStatus; + data['CallStatusDisc'] = this.callStatusDisc; + data['CallTypeID'] = this.callTypeID; + data['ClientRequestID'] = this.clientRequestID; + data['ClinicName'] = this.clinicName; + data['ConsoltationEnd'] = this.consoltationEnd; + data['ConsultationNotes'] = this.consultationNotes; + data['CreatedOn'] = this.createdOn; + data['DoctorName'] = this.doctorName; + data['Gender'] = this.gender; + data['MobileNumber'] = this.mobileNumber; + data['PatientID'] = this.patientId; + data['PatientStatus'] = this.patientStatus; + data['ProjectID'] = this.projectId; + data['VC_ID'] = this.vcId; + data['VoipToken'] = this.voipToken; + + data["DateofBirth"] = this.dateofBirth; + data["dob"] = this.dateofBirth; + data['DateOfBirth'] = this.dateofBirth; + return data; + } +} \ No newline at end of file diff --git a/lib/screens/live_care/live_care_patient_screen.dart b/lib/screens/live_care/live_care_patient_screen.dart index 0b741989..d98e1701 100644 --- a/lib/screens/live_care/live_care_patient_screen.dart +++ b/lib/screens/live_care/live_care_patient_screen.dart @@ -4,6 +4,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart'; @@ -141,7 +142,7 @@ class _LiveCarePatientScreenState extends State { return Padding( padding: EdgeInsets.all(8.0), child: PatientCard( - patientInfo: model.filterData[index], + patientInfo: PatiantInformtion.fromJson(model.filterData[index].toJson()), patientType: "0", arrivalType: "0", isFromSearch: false, @@ -150,7 +151,7 @@ class _LiveCarePatientScreenState extends State { onTap: () { // TODO change the parameter to daynamic Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: { - "patient": model.filterData[index], + "patient": PatiantInformtion.fromJson(model.filterData[index].toJson()), "patientType": "0", "isSearch": false, "isInpatient": false, From 80ef1a241dfa6e684efc7487d8ee97f0c9258ddc Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 27 Jun 2021 13:00:02 +0300 Subject: [PATCH 5/7] first step from fix episode in patient live care list --- .../patient/LiveCarePatientServices.dart | 140 +++++++++++++++++- .../viewModel/LiveCarePatientViewModel.dart | 17 ++- .../live_care/live_care_patient_screen.dart | 2 +- .../patient_profile_screen.dart | 77 +++++----- 4 files changed, 187 insertions(+), 49 deletions(-) diff --git a/lib/core/service/patient/LiveCarePatientServices.dart b/lib/core/service/patient/LiveCarePatientServices.dart index 29b120ec..0e531501 100644 --- a/lib/core/service/patient/LiveCarePatientServices.dart +++ b/lib/core/service/patient/LiveCarePatientServices.dart @@ -10,9 +10,9 @@ import 'package:doctor_app_flutter/models/livecare/start_call_res.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; class LiveCarePatientServices extends BaseService { - List _patientList = []; + // List _patientList = []; - List get patientList => _patientList; + List patientList = []; List alternativeServicesList = []; @@ -36,15 +36,145 @@ class LiveCarePatientServices extends BaseService { Future getPendingPatientERForDoctorApp( PendingPatientERForDoctorAppRequestModel - pendingPatientERForDoctorAppRequestModel) async { + pendingPatientERForDoctorAppRequestModel, {bool isSecondTime = false }) async { hasError = false; await baseAppClient.post( GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP, onSuccess: (dynamic response, int statusCode) { - _patientList.clear(); + + List localPatientList= []; + + localPatientList.clear(); response['List_PendingPatientList'].forEach((v) { - _patientList.add(PatiantInformtion.fromJson(v)); + localPatientList.add(PatiantInformtion.fromJson(v)); }); + + localPatientList.add(PatiantInformtion.fromJson({ + "AcceptedBy": null, + "AcceptedOn": null, + "Age": 34, + "AppointmentDate": null, + "AppointmentNo": null, + "ArrivalTime": "2021-06-09 16:24", + "ArrivalTimeD": "/Date(1623245082567+0300)/", + "CallStatus": 1, + "CallStatusDisc": null, + "CallTypeID": 1, + "ClientRequestID": "2344670985-1231755-1621862656", + "ClinicName": "ENT", + "ConsoltationEnd": null, + "ConsultationNotes": null, + "CreatedOn": null, + "DateOfBirth": "1987-01-04", + "DeviceToken": "fYjscrPmRQk:APA91bHP3zv4YhxMc4v5cTgbY1TZQFj5hIzrS0VUsTqhsaeNOpWwGgrOTpl2S7xD1-98nOaTmEwNqZwgbZeJVBNPATHOBBXQmMht3yh91jobpYCht4vfmIcvFMl87MhrnWbaVz9nJy_5", + "DeviceType": "Android", + "DoctorName": null, + "EditOn": "/Date(1623230039447+0300)/", + "Gender": "1", + "IsFlutter": null, + "IsFollowUP": false, + "IsFromVida": false, + "IsLoginB": 0, + "IsOutKSA": false, + "IsRejected": 0, + "Language": "AR ", + "Latitude": 24.708887, + "Longitude": 46.665832, + "MobileNumber": "0537503378", + "OpenSession": null, + "OpenTokenID": "T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9NjYzMzhlOGNjMTdmNTU3ZjcxOTU1ZTg5ZGUxNzQyZDRiMDkwMjU2YjpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWXlNVGcyTWpjNU9ESXhPWDUxV0hsSGVUTjZObFJoTldaV1ZFWlRkekpJV0hWM0sydC1mZyZjcmVhdGVfdGltZT0xNjIxODYyNzk5Jm5vbmNlPTE4MzE1Mi", + "PatientID": "1231755", + "PatientName": "TAMER FANASHEH", + "PatientStatus": 1, + "PreferredLanguage": "En", + "ProjectID": 0, + "Scoring": 0.00, + "ServiceID": 7, + "TokenID": null, + "VC_ID": 4475, + "VoipToken": null + })); + + if(isSecondTime) { + localPatientList.add(PatiantInformtion.fromJson({ + "AcceptedBy": null, + "AcceptedOn": null, + "Age": 34, + "AppointmentDate": null, + "AppointmentNo": null, + "ArrivalTime": "2021-06-09 16:24", + "ArrivalTimeD": "/Date(1623245082567+0300)/", + "CallStatus": 1, + "CallStatusDisc": null, + "CallTypeID": 1, + "ClientRequestID": "2344670985-1231755-1621862656", + "ClinicName": "ENT", + "ConsoltationEnd": null, + "ConsultationNotes": null, + "CreatedOn": null, + "DateOfBirth": "1987-01-04", + "DeviceToken": "fYjscrPmRQk:APA91bHP3zv4YhxMc4v5cTgbY1TZQFj5hIzrS0VUsTqhsaeNOpWwGgrOTpl2S7xD1-98nOaTmEwNqZwgbZeJVBNPATHOBBXQmMht3yh91jobpYCht4vfmIcvFMl87MhrnWbaVz9nJy_5", + "DeviceType": "Android", + "DoctorName": null, + "EditOn": "/Date(1623230039447+0300)/", + "Gender": "1", + "IsFlutter": null, + "IsFollowUP": false, + "IsFromVida": false, + "IsLoginB": 0, + "IsOutKSA": false, + "IsRejected": 0, + "Language": "AR ", + "Latitude": 24.708887, + "Longitude": 46.665832, + "MobileNumber": "0537503378", + "OpenSession": null, + "OpenTokenID": "T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9NjYzMzhlOGNjMTdmNTU3ZjcxOTU1ZTg5ZGUxNzQyZDRiMDkwMjU2YjpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWXlNVGcyTWpjNU9ESXhPWDUxV0hsSGVUTjZObFJoTldaV1ZFWlRkekpJV0hWM0sydC1mZyZjcmVhdGVfdGltZT0xNjIxODYyNzk5Jm5vbmNlPTE4MzE1Mi", + "PatientID": "12317552222", + "PatientName": "TAMER FANASHEH", + "PatientStatus": 1, + "PreferredLanguage": "En", + "ProjectID": 0, + "Scoring": 0.00, + "ServiceID": 7, + "TokenID": null, + "VC_ID": 4475, + "VoipToken": null + })); + } + + + /// add new items. + localPatientList.forEach((element) { + // if (!_patientList.contains(element)) { + // _patientList.add(element); + // } + + if ((patientList.singleWhere((it) => it.patientId == element.patientId, + orElse: () => null)) == null) { + patientList.add(element); + } + }); + + + + + print(patientList); + /// remove items. + patientList.forEach((element) { + // if (!localPatientList.contains(element)) { + // _patientList.remove(element); + // } + + if ((localPatientList.singleWhere((it) => it.patientId == element.patientId, + orElse: () => null)) == null) { + patientList.remove(element); + } + }); + + print(patientList); + + }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModel/LiveCarePatientViewModel.dart b/lib/core/viewModel/LiveCarePatientViewModel.dart index 378013bd..42028c52 100644 --- a/lib/core/viewModel/LiveCarePatientViewModel.dart +++ b/lib/core/viewModel/LiveCarePatientViewModel.dart @@ -25,7 +25,7 @@ class LiveCarePatientViewModel extends BaseViewModel { DashboardService _dashboardService = locator(); - getPendingPatientERForDoctorApp({bool isFromTimer = false}) async { + getPendingPatientERForDoctorApp({bool isFromTimer = false, bool isSecondTime = false}) async { if (isFromTimer) { setState(ViewState.Idle); } else { @@ -34,7 +34,7 @@ class LiveCarePatientViewModel extends BaseViewModel { PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel = PendingPatientERForDoctorAppRequestModel(sErServiceID: _dashboardService.sServiceID, outSA: false); - await _liveCarePatientServices.getPendingPatientERForDoctorApp(pendingPatientERForDoctorAppRequestModel); + await _liveCarePatientServices.getPendingPatientERForDoctorApp(pendingPatientERForDoctorAppRequestModel, isSecondTime: isSecondTime); if (_liveCarePatientServices.hasError) { error = _liveCarePatientServices.error; @@ -238,4 +238,17 @@ class LiveCarePatientViewModel extends BaseViewModel { AlternativeService(serviceID: 11, serviceName: "GASTRIC TUBE CHANGE"), ); } + + updateInCallPatient({PatiantInformtion patient, appointmentNo}){ + + _liveCarePatientServices.patientList.forEach((e) { + if(e.patientId == patient.patientId) { + e.episodeNo = 0 ; + e.appointmentNo = appointmentNo; + } + }); + + setState(ViewState.Idle); + + } } diff --git a/lib/screens/live_care/live_care_patient_screen.dart b/lib/screens/live_care/live_care_patient_screen.dart index d98e1701..edd0e243 100644 --- a/lib/screens/live_care/live_care_patient_screen.dart +++ b/lib/screens/live_care/live_care_patient_screen.dart @@ -32,7 +32,7 @@ class _LiveCarePatientScreenState extends State { super.initState(); timer = Timer.periodic(Duration(seconds: 10), (Timer t) { if (_liveCareViewModel != null) { - _liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true); + _liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true, isSecondTime: true); } }); } diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index 7a70e379..87b5489a 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -1,24 +1,16 @@ import 'dart:async'; -import 'package:doctor_app_flutter/config/config.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; -import 'package:doctor_app_flutter/core/service/VideoCallService.dart'; import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; -import 'package:doctor_app_flutter/models/livecare/session_status_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; -import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_other.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_search.dart'; -import 'package:doctor_app_flutter/util/NotificationPermissionUtils.dart'; -import 'package:doctor_app_flutter/util/VideoChannel.dart'; -import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; -import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart'; @@ -27,7 +19,6 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:quiver/async.dart'; -import '../../../../locator.dart'; import '../../../../routes.dart'; class PatientProfileScreen extends StatefulWidget { @@ -302,42 +293,46 @@ class _PatientProfileScreenState extends State with Single : TranslationBase.of(context).initiateCall, disabled: isCallStarted || model.state == ViewState.BusyLocal, onPressed: () async { + + model.updateInCallPatient( + patient: patient, + appointmentNo: 0 ); + setState(() { + patient.episodeNo = 0 ; + patient.appointmentNo = 0; + }); // Navigator.push(context, MaterialPageRoute( // builder: (BuildContext context) => // EndCallScreen(patient:patient))); - if (isCallFinished) { - Navigator.push( - context, - MaterialPageRoute( - builder: (BuildContext context) => EndCallScreen(patient: patient))); - } else { - GifLoaderDialogUtils.showMyDialog(context); - await model.startCall(isReCall: false, vCID: patient.vcId); - - if (model.state == ViewState.ErrorLocal) { - GifLoaderDialogUtils.hideDialog(context); - Helpers.showErrorToast(model.error); - } else { - await model.getDoctorProfile(); - patient.appointmentNo = int.parse(model.startCallRes.appointmentNo.toString()); - patient.episodeNo = 0; - setState(() { - isCallStarted = true; - }); - GifLoaderDialogUtils.hideDialog(context); - AppPermissionsUtils.requestVideoCallPermission( - context: context, - onTapGrant: () { - locator() - .openVideo(model.startCallRes, patient, callConnected, callDisconnected); - }); - } - } - - // AppPermissionsUtils.requestVideoCallPermission(context: context,onTapGrant: (){ - // locator().openVideo(model.startCallRes, patient, callConnected, callDisconnected); - // }); + // if (isCallFinished) { + // Navigator.push( + // context, + // MaterialPageRoute( + // builder: (BuildContext context) => EndCallScreen(patient: patient))); + // } else { + // GifLoaderDialogUtils.showMyDialog(context); + // await model.startCall(isReCall: false, vCID: patient.vcId); + // + // if (model.state == ViewState.ErrorLocal) { + // GifLoaderDialogUtils.hideDialog(context); + // Helpers.showErrorToast(model.error); + // } else { + // await model.getDoctorProfile(); + // patient.appointmentNo = int.parse(model.startCallRes.appointmentNo.toString()); + // patient.episodeNo = 0; + // setState(() { + // isCallStarted = true; + // }); + // GifLoaderDialogUtils.hideDialog(context); + // AppPermissionsUtils.requestVideoCallPermission( + // context: context, + // onTapGrant: () { + // locator() + // .openVideo(model.startCallRes, patient, callConnected, callDisconnected); + // }); + // } + // } }, ), ), From 29eeb21e76ccc08f8c30f6f2a6ed45c9c5a25cb6 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 27 Jun 2021 14:50:29 +0300 Subject: [PATCH 6/7] finalize create episode on Live care. --- .../patient/LiveCarePatientServices.dart | 130 ++---------------- .../viewModel/LiveCarePatientViewModel.dart | 4 +- .../live_care/live_care_patient_screen.dart | 2 +- .../patient_profile_screen.dart | 84 +++++------ 4 files changed, 61 insertions(+), 159 deletions(-) diff --git a/lib/core/service/patient/LiveCarePatientServices.dart b/lib/core/service/patient/LiveCarePatientServices.dart index 0e531501..b6ed526a 100644 --- a/lib/core/service/patient/LiveCarePatientServices.dart +++ b/lib/core/service/patient/LiveCarePatientServices.dart @@ -10,9 +10,9 @@ import 'package:doctor_app_flutter/models/livecare/start_call_res.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; class LiveCarePatientServices extends BaseService { - // List _patientList = []; + List _patientList = []; - List patientList = []; + List get patientList => _patientList; List alternativeServicesList = []; @@ -36,145 +36,41 @@ class LiveCarePatientServices extends BaseService { Future getPendingPatientERForDoctorApp( PendingPatientERForDoctorAppRequestModel - pendingPatientERForDoctorAppRequestModel, {bool isSecondTime = false }) async { + pendingPatientERForDoctorAppRequestModel) async { hasError = false; await baseAppClient.post( GET_PENDING_PATIENT_ER_FOR_DOCTOR_APP, onSuccess: (dynamic response, int statusCode) { List localPatientList= []; - localPatientList.clear(); + response['List_PendingPatientList'].forEach((v) { localPatientList.add(PatiantInformtion.fromJson(v)); }); - localPatientList.add(PatiantInformtion.fromJson({ - "AcceptedBy": null, - "AcceptedOn": null, - "Age": 34, - "AppointmentDate": null, - "AppointmentNo": null, - "ArrivalTime": "2021-06-09 16:24", - "ArrivalTimeD": "/Date(1623245082567+0300)/", - "CallStatus": 1, - "CallStatusDisc": null, - "CallTypeID": 1, - "ClientRequestID": "2344670985-1231755-1621862656", - "ClinicName": "ENT", - "ConsoltationEnd": null, - "ConsultationNotes": null, - "CreatedOn": null, - "DateOfBirth": "1987-01-04", - "DeviceToken": "fYjscrPmRQk:APA91bHP3zv4YhxMc4v5cTgbY1TZQFj5hIzrS0VUsTqhsaeNOpWwGgrOTpl2S7xD1-98nOaTmEwNqZwgbZeJVBNPATHOBBXQmMht3yh91jobpYCht4vfmIcvFMl87MhrnWbaVz9nJy_5", - "DeviceType": "Android", - "DoctorName": null, - "EditOn": "/Date(1623230039447+0300)/", - "Gender": "1", - "IsFlutter": null, - "IsFollowUP": false, - "IsFromVida": false, - "IsLoginB": 0, - "IsOutKSA": false, - "IsRejected": 0, - "Language": "AR ", - "Latitude": 24.708887, - "Longitude": 46.665832, - "MobileNumber": "0537503378", - "OpenSession": null, - "OpenTokenID": "T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9NjYzMzhlOGNjMTdmNTU3ZjcxOTU1ZTg5ZGUxNzQyZDRiMDkwMjU2YjpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWXlNVGcyTWpjNU9ESXhPWDUxV0hsSGVUTjZObFJoTldaV1ZFWlRkekpJV0hWM0sydC1mZyZjcmVhdGVfdGltZT0xNjIxODYyNzk5Jm5vbmNlPTE4MzE1Mi", - "PatientID": "1231755", - "PatientName": "TAMER FANASHEH", - "PatientStatus": 1, - "PreferredLanguage": "En", - "ProjectID": 0, - "Scoring": 0.00, - "ServiceID": 7, - "TokenID": null, - "VC_ID": 4475, - "VoipToken": null - })); - - if(isSecondTime) { - localPatientList.add(PatiantInformtion.fromJson({ - "AcceptedBy": null, - "AcceptedOn": null, - "Age": 34, - "AppointmentDate": null, - "AppointmentNo": null, - "ArrivalTime": "2021-06-09 16:24", - "ArrivalTimeD": "/Date(1623245082567+0300)/", - "CallStatus": 1, - "CallStatusDisc": null, - "CallTypeID": 1, - "ClientRequestID": "2344670985-1231755-1621862656", - "ClinicName": "ENT", - "ConsoltationEnd": null, - "ConsultationNotes": null, - "CreatedOn": null, - "DateOfBirth": "1987-01-04", - "DeviceToken": "fYjscrPmRQk:APA91bHP3zv4YhxMc4v5cTgbY1TZQFj5hIzrS0VUsTqhsaeNOpWwGgrOTpl2S7xD1-98nOaTmEwNqZwgbZeJVBNPATHOBBXQmMht3yh91jobpYCht4vfmIcvFMl87MhrnWbaVz9nJy_5", - "DeviceType": "Android", - "DoctorName": null, - "EditOn": "/Date(1623230039447+0300)/", - "Gender": "1", - "IsFlutter": null, - "IsFollowUP": false, - "IsFromVida": false, - "IsLoginB": 0, - "IsOutKSA": false, - "IsRejected": 0, - "Language": "AR ", - "Latitude": 24.708887, - "Longitude": 46.665832, - "MobileNumber": "0537503378", - "OpenSession": null, - "OpenTokenID": "T1==cGFydG5lcl9pZD00NjIwOTk2MiZzaWc9NjYzMzhlOGNjMTdmNTU3ZjcxOTU1ZTg5ZGUxNzQyZDRiMDkwMjU2YjpzZXNzaW9uX2lkPTFfTVg0ME5qSXdPVGsyTW41LU1UWXlNVGcyTWpjNU9ESXhPWDUxV0hsSGVUTjZObFJoTldaV1ZFWlRkekpJV0hWM0sydC1mZyZjcmVhdGVfdGltZT0xNjIxODYyNzk5Jm5vbmNlPTE4MzE1Mi", - "PatientID": "12317552222", - "PatientName": "TAMER FANASHEH", - "PatientStatus": 1, - "PreferredLanguage": "En", - "ProjectID": 0, - "Scoring": 0.00, - "ServiceID": 7, - "TokenID": null, - "VC_ID": 4475, - "VoipToken": null - })); - } - - /// add new items. localPatientList.forEach((element) { - // if (!_patientList.contains(element)) { - // _patientList.add(element); - // } - - if ((patientList.singleWhere((it) => it.patientId == element.patientId, + if ((_patientList.singleWhere((it) => it.patientId == element.patientId, orElse: () => null)) == null) { - patientList.add(element); + _patientList.add(element); } }); - - - - print(patientList); /// remove items. - patientList.forEach((element) { - // if (!localPatientList.contains(element)) { - // _patientList.remove(element); - // } - + List removedPatientList= []; + removedPatientList.clear(); + _patientList.forEach((element) { if ((localPatientList.singleWhere((it) => it.patientId == element.patientId, orElse: () => null)) == null) { - patientList.remove(element); + removedPatientList.add(element); } }); - print(patientList); - + removedPatientList.forEach((element) { + _patientList.remove(element); + }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModel/LiveCarePatientViewModel.dart b/lib/core/viewModel/LiveCarePatientViewModel.dart index 42028c52..638306f7 100644 --- a/lib/core/viewModel/LiveCarePatientViewModel.dart +++ b/lib/core/viewModel/LiveCarePatientViewModel.dart @@ -25,7 +25,7 @@ class LiveCarePatientViewModel extends BaseViewModel { DashboardService _dashboardService = locator(); - getPendingPatientERForDoctorApp({bool isFromTimer = false, bool isSecondTime = false}) async { + getPendingPatientERForDoctorApp({bool isFromTimer = false}) async { if (isFromTimer) { setState(ViewState.Idle); } else { @@ -34,7 +34,7 @@ class LiveCarePatientViewModel extends BaseViewModel { PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel = PendingPatientERForDoctorAppRequestModel(sErServiceID: _dashboardService.sServiceID, outSA: false); - await _liveCarePatientServices.getPendingPatientERForDoctorApp(pendingPatientERForDoctorAppRequestModel, isSecondTime: isSecondTime); + await _liveCarePatientServices.getPendingPatientERForDoctorApp(pendingPatientERForDoctorAppRequestModel); if (_liveCarePatientServices.hasError) { error = _liveCarePatientServices.error; diff --git a/lib/screens/live_care/live_care_patient_screen.dart b/lib/screens/live_care/live_care_patient_screen.dart index edd0e243..d98e1701 100644 --- a/lib/screens/live_care/live_care_patient_screen.dart +++ b/lib/screens/live_care/live_care_patient_screen.dart @@ -32,7 +32,7 @@ class _LiveCarePatientScreenState extends State { super.initState(); timer = Timer.periodic(Duration(seconds: 10), (Timer t) { if (_liveCareViewModel != null) { - _liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true, isSecondTime: true); + _liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true); } }); } diff --git a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart index 87b5489a..f4b68456 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -1,14 +1,17 @@ import 'dart:async'; import 'package:doctor_app_flutter/core/enum/viewstate.dart'; +import 'package:doctor_app_flutter/core/service/VideoCallService.dart'; import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/models/SOAP/PostEpisodeReqModel.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart'; +import 'package:doctor_app_flutter/screens/live_care/end_call_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_InPatient.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_other.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_search.dart'; +import 'package:doctor_app_flutter/util/NotificationPermissionUtils.dart'; import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/patient-profile-header-new-design-app-bar.dart'; @@ -19,6 +22,7 @@ import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:quiver/async.dart'; +import '../../../../locator.dart'; import '../../../../routes.dart'; class PatientProfileScreen extends StatefulWidget { @@ -293,46 +297,48 @@ class _PatientProfileScreenState extends State with Single : TranslationBase.of(context).initiateCall, disabled: isCallStarted || model.state == ViewState.BusyLocal, onPressed: () async { + if (isCallFinished) { + Navigator.push( + context, + MaterialPageRoute( + builder: (BuildContext context) => + EndCallScreen(patient: patient))); + } else { + GifLoaderDialogUtils.showMyDialog(context); + await model.startCall( + isReCall: false, vCID: patient.vcId); - model.updateInCallPatient( - patient: patient, - appointmentNo: 0 ); - setState(() { - patient.episodeNo = 0 ; - patient.appointmentNo = 0; - }); - // Navigator.push(context, MaterialPageRoute( - // builder: (BuildContext context) => - // EndCallScreen(patient:patient))); - - // if (isCallFinished) { - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (BuildContext context) => EndCallScreen(patient: patient))); - // } else { - // GifLoaderDialogUtils.showMyDialog(context); - // await model.startCall(isReCall: false, vCID: patient.vcId); - // - // if (model.state == ViewState.ErrorLocal) { - // GifLoaderDialogUtils.hideDialog(context); - // Helpers.showErrorToast(model.error); - // } else { - // await model.getDoctorProfile(); - // patient.appointmentNo = int.parse(model.startCallRes.appointmentNo.toString()); - // patient.episodeNo = 0; - // setState(() { - // isCallStarted = true; - // }); - // GifLoaderDialogUtils.hideDialog(context); - // AppPermissionsUtils.requestVideoCallPermission( - // context: context, - // onTapGrant: () { - // locator() - // .openVideo(model.startCallRes, patient, callConnected, callDisconnected); - // }); - // } - // } + if (model.state == ViewState.ErrorLocal) { + GifLoaderDialogUtils.hideDialog(context); + Helpers.showErrorToast(model.error); + } else { + await model.getDoctorProfile(); + patient.appointmentNo = int.parse(model + .startCallRes.appointmentNo + .toString()); + patient.episodeNo = 0; + model.updateInCallPatient( + patient: patient, + appointmentNo: int.parse(model + .startCallRes.appointmentNo + .toString())); + setState(() { + isCallStarted = true; + }); + GifLoaderDialogUtils.hideDialog(context); + AppPermissionsUtils + .requestVideoCallPermission( + context: context, + onTapGrant: () { + locator() + .openVideo( + model.startCallRes, + patient, + callConnected, + callDisconnected); + }); + } + } }, ), ), From 1918c2219e5cf5d82c1efc8e9f81f7d146c8315f Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 27 Jun 2021 15:33:08 +0300 Subject: [PATCH 7/7] improve the code. --- lib/core/service/patient/LiveCarePatientServices.dart | 2 -- lib/core/viewModel/LiveCarePatientViewModel.dart | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/core/service/patient/LiveCarePatientServices.dart b/lib/core/service/patient/LiveCarePatientServices.dart index b6ed526a..fff803d8 100644 --- a/lib/core/service/patient/LiveCarePatientServices.dart +++ b/lib/core/service/patient/LiveCarePatientServices.dart @@ -43,7 +43,6 @@ class LiveCarePatientServices extends BaseService { onSuccess: (dynamic response, int statusCode) { List localPatientList= []; - localPatientList.clear(); response['List_PendingPatientList'].forEach((v) { localPatientList.add(PatiantInformtion.fromJson(v)); @@ -59,7 +58,6 @@ class LiveCarePatientServices extends BaseService { /// remove items. List removedPatientList= []; - removedPatientList.clear(); _patientList.forEach((element) { if ((localPatientList.singleWhere((it) => it.patientId == element.patientId, orElse: () => null)) == null) { diff --git a/lib/core/viewModel/LiveCarePatientViewModel.dart b/lib/core/viewModel/LiveCarePatientViewModel.dart index 638306f7..03cb0a7b 100644 --- a/lib/core/viewModel/LiveCarePatientViewModel.dart +++ b/lib/core/viewModel/LiveCarePatientViewModel.dart @@ -245,6 +245,7 @@ class LiveCarePatientViewModel extends BaseViewModel { if(e.patientId == patient.patientId) { e.episodeNo = 0 ; e.appointmentNo = appointmentNo; + return; } });