From 321bf7825efbb5684ea55273752bf2c6627b8fcb Mon Sep 17 00:00:00 2001 From: mosazaid Date: Mon, 21 Jun 2021 14:49:23 +0300 Subject: [PATCH] solve video stream publisher popup window bug --- android/app/build.gradle | 24 +++++++++++++++++++ .../hmgDr/ui/fragment/VideoCallFragment.kt | 23 ++++++++++++++---- lib/core/service/VideoCallService.dart | 6 ++--- .../viewModel/authentication_view_model.dart | 2 +- .../patient_profile_screen.dart | 10 ++++---- 5 files changed, 52 insertions(+), 13 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 96428f49..2e124398 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -28,6 +28,15 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion 30 +// signingConfigs { +// release { +// storeFile file('C:\\Users\\admin\\Downloads\\DQKey.jks') +// storePassword 'HmGsa123' +// keyAlias 'key' +// keyPassword 'HmGsa123' +// } +// } + sourceSets { main.java.srcDirs += 'src/main/kotlin' } @@ -50,10 +59,25 @@ android { buildTypes { release { // TODO: Add your own signing config for the release build. + signingConfig signingConfigs.debug + } + debug { // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug } } + +// flavorDimensions 'environment' +// productFlavors { +// production { +// dimension 'environment' +// } +// } +// +// configurations { +// productionDebugImplementation +// productionReleaseImplementation +// } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 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 35e28b23..7a66f80b 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 @@ -284,7 +284,9 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session // progressBar=findViewById(R.id.progress_bar); // progressBarTextView=findViewById(R.id.progress_bar_text); // progressBar.setVisibility(View.GONE); - hiddenButtons() + + +// hiddenButtons() checkClientConnected() if (appLang == "ar") { @@ -359,6 +361,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session } mPublisherViewContainer.addView(mPublisher!!.view) + mSession!!.publish(mPublisher) if (!resume) { @@ -562,7 +565,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session 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.text_color)) + mSubscriberViewContainer.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.remoteBackground)) } } @@ -635,6 +638,11 @@ 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){ + mPublisherViewContainer.addView(mPublisher!!.view) + } + mPublisherViewContainer.visibility = View.VISIBLE + // remotePreviewLayoutParam = FrameLayout.LayoutParams(remotePreviewIconSize, remotePreviewIconSize) remotePreviewLayoutParam.width = remotePreviewIconSize remotePreviewLayoutParam.height = remotePreviewIconSize @@ -657,6 +665,11 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session localPreviewLayoutParam.width = 0 localPreviewLayoutParam.height = 0 localPreviewLayoutParam.setMargins(0, localPreviewMargin / 2, localPreviewMargin / 2, 0) + + if (mPublisher != null){ + mPublisherViewContainer.removeView(mPublisher!!.view) + } + mPublisherViewContainer.visibility = View.GONE // localPreviewLayoutIconParam = FrameLayout.LayoutParams(localPreviewIconSmall, localPreviewIconSmall) //// localPreviewLayoutParam = RelativeLayout.LayoutParams(localPreviewWidthSmall, localPreviewHeightSmall) // localPreviewLayoutParam.width = localPreviewWidthSmall @@ -820,7 +833,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session override fun onFinish() { mParams.x = -(szWindow.x - videoCallContainer.width) - dialog!!.window!!.attributes = mParams + dialog?.window!!.attributes = mParams } }.start() } @@ -846,7 +859,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session override fun onFinish() { mParams.x = szWindow.x - videoCallContainer.width - dialog!!.window!!.attributes = mParams + dialog?.window!!.attributes = mParams } }.start() } @@ -866,7 +879,7 @@ class VideoCallFragment : DialogFragment(), PermissionCallbacks, Session.Session private class MyGestureListener(val onTabCall: () -> Unit, val miniCircleDoubleTap: () -> Unit) : GestureDetector.SimpleOnGestureListener() { override fun onSingleTapConfirmed(event: MotionEvent): Boolean { - onTabCall() +// onTabCall() return true } diff --git a/lib/core/service/VideoCallService.dart b/lib/core/service/VideoCallService.dart index f72544a0..1bec02f5 100644 --- a/lib/core/service/VideoCallService.dart +++ b/lib/core/service/VideoCallService.dart @@ -27,9 +27,9 @@ class VideoCallService extends BaseService{ this.patient = patientModel; DoctorProfileModel doctorProfile = await getDoctorProfile(isGetProfile: true); await VideoChannel.openVideoCallScreen( - kToken: startCallRes.openTokenID,//"T1==cGFydG5lcl9pZD00NzI0Nzk1NCZzaWc9NGIyZDljOTY3YjFiNWU1YzUzNzFmMjIyNjJmNmEzY2Y5NzZjOTdlYzpzZXNzaW9uX2lkPTFfTVg0ME56STBOemsxTkg1LU1UWXlNekEyTlRRMU9EVXhObjVrVFRoMFlVdFJXaXRYTWpadFZGZHFhSGxZVGpOdE1UVi1mZyZjcmVhdGVfdGltZT0xNjIzMDY1NDk1Jm5vbmNlPTAuMjM2Mjk0NTIwMTkyOTA4OTcmcm9sZT1wdWJsaXNoZXImZXhwaXJlX3RpbWU9MTYyNTY1NzQ5NCZpbml0aWFsX2xheW91dF9jbGFzc19saXN0PQ==", - kSessionId:startCallRes.openSessionID,//1_MX40NzI0Nzk1NH5-MTYyMzA2NTQ1ODUxNn5kTTh0YUtRWitXMjZtVFdqaHlYTjNtMTV-fg - kApiKey: '46209962',//'47247954' + kToken: "T1==cGFydG5lcl9pZD00NzI0Nzk1NCZzaWc9NGIyZDljOTY3YjFiNWU1YzUzNzFmMjIyNjJmNmEzY2Y5NzZjOTdlYzpzZXNzaW9uX2lkPTFfTVg0ME56STBOemsxTkg1LU1UWXlNekEyTlRRMU9EVXhObjVrVFRoMFlVdFJXaXRYTWpadFZGZHFhSGxZVGpOdE1UVi1mZyZjcmVhdGVfdGltZT0xNjIzMDY1NDk1Jm5vbmNlPTAuMjM2Mjk0NTIwMTkyOTA4OTcmcm9sZT1wdWJsaXNoZXImZXhwaXJlX3RpbWU9MTYyNTY1NzQ5NCZpbml0aWFsX2xheW91dF9jbGFzc19saXN0PQ==", // startCallRes.openTokenID, + kSessionId:"1_MX40NzI0Nzk1NH5-MTYyMzA2NTQ1ODUxNn5kTTh0YUtRWitXMjZtVFdqaHlYTjNtMTV-fg", // startCallRes.openSessionID, + kApiKey: '47247954' ,//'46209962' vcId: patient.vcId, patientName: patient.fullName ?? (patient.firstName != null ? "${patient.firstName} ${patient.lastName}" : "-"), tokenID: await sharedPref.getString(TOKEN), diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index 9da1933a..a161c861 100644 --- a/lib/core/viewModel/authentication_view_model.dart +++ b/lib/core/viewModel/authentication_view_model.dart @@ -255,7 +255,7 @@ class AuthenticationViewModel extends BaseViewModel { /// add  token to shared preferences in case of send activation code is success setDataAfterSendActivationSuccess(SendActivationCodeForDoctorAppResponseModel sendActivationCodeForDoctorAppResponseModel) { print("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); - // DrAppToastMsg.showSuccesToast("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); + DrAppToastMsg.showSuccesToast("VerificationCode : " + sendActivationCodeForDoctorAppResponseModel.verificationCode); sharedPref.setString(VIDA_AUTH_TOKEN_ID, sendActivationCodeForDoctorAppResponseModel.vidaAuthTokenID); sharedPref.setString(VIDA_REFRESH_TOKEN_ID, 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 36388e87..2c88835d 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -337,8 +337,12 @@ class _PatientProfileScreenState extends State // builder: (BuildContext context) => // EndCallScreen(patient:patient))); + // TODO MOSA remov it and uncomment the below code + AppPermissionsUtils.requestVideoCallPermission(context: context,onTapGrant: (){ + locator().openVideo(model.startCallRes, patient, callConnected, callDisconnected); + }); - if(isCallFinished) { + /* if(isCallFinished) { Navigator.push(context, MaterialPageRoute( builder: (BuildContext context) => EndCallScreen(patient:patient))); } else { @@ -357,10 +361,8 @@ class _PatientProfileScreenState extends State AppPermissionsUtils.requestVideoCallPermission(context: context,onTapGrant: (){ locator().openVideo(model.startCallRes, patient, callConnected, callDisconnected); }); - - } - } + }*/ },