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 f14dd823..f8b3f3ae 100644 --- a/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt +++ b/android/app/src/main/kotlin/com/hmg/hmgDr/MainActivity.kt @@ -16,6 +16,7 @@ import com.hmg.hmgDr.Model.GetSessionStatusModel import com.hmg.hmgDr.Model.SessionStatusModel import com.hmg.hmgDr.Service.VideoStreamContainerService import com.hmg.hmgDr.ui.VideoCallResponseListener +import com.hmg.hmgDr.ui.fragment.VideoCallFragment import io.flutter.embedding.android.FlutterFragmentActivity import io.flutter.embedding.engine.FlutterEngine import io.flutter.plugin.common.MethodCall @@ -32,6 +33,7 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler, private var call: MethodCall? = null private val LAUNCH_VIDEO: Int = 1 + private var dialogFragment: VideoCallFragment? = null private var serviceIntent: Intent? = null private var videoStreamService: VideoStreamContainerService? = null private var bound = false @@ -105,7 +107,7 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler, putExtras(arguments) startService(this) } - bindService() +// bindService() } /* override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { @@ -135,9 +137,8 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler, }*/ override fun onCallFinished(resultCode: Int, intent: Intent?) { - // TODO uncomment it - /*if (resultCode == Activity.RESULT_OK) { + if (resultCode == Activity.RESULT_OK) { val result: SessionStatusModel? = intent?.getParcelableExtra("sessionStatusNotRespond") val callResponse: HashMap = HashMap() @@ -162,10 +163,10 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler, Log.e("onVideoCallFinished", "${e.message}.") } } - */ - stopService(serviceIntent) - unbindService() - videoStreamService!!.serviceRunning = false + +// stopService(serviceIntent) +// unbindService() +// videoStreamService!!.serviceRunning = false } override fun minimizeVideoEvent(isMinimize: Boolean) { @@ -189,40 +190,40 @@ class MainActivity : FlutterFragmentActivity(), MethodChannel.MethodCallHandler, // unbindService() // } - private fun bindService() { - serviceIntent?.run { - if (videoStreamService != null && !videoStreamService!!.serviceRunning){ - startService(this) - } - bindService(this, serviceConnection, Context.BIND_AUTO_CREATE) - videoStreamService?.serviceRunning = true - } - } - - private fun unbindService() { - if (bound) { - videoStreamService!!.videoCallResponseListener = null // unregister - videoStreamService!!.mActivity = null - unbindService(serviceConnection) - bound = false - } - } - - private val serviceConnection: ServiceConnection = object : ServiceConnection { - override fun onServiceConnected(name: ComponentName?, service: IBinder?) { - val binder: VideoStreamContainerService.VideoStreamBinder = - service as VideoStreamContainerService.VideoStreamBinder - videoStreamService = binder.service - bound = true - videoStreamService!!.videoCallResponseListener = this@MainActivity // register - videoStreamService!!.mActivity = this@MainActivity // register - } - - override fun onServiceDisconnected(name: ComponentName?) { - bound = false - } - - } +// private fun bindService() { +// serviceIntent?.run { +// if (videoStreamService != null && !videoStreamService!!.serviceRunning){ +// startService(this) +// } +// bindService(this, serviceConnection, Context.BIND_AUTO_CREATE) +// videoStreamService?.serviceRunning = true +// } +// } +// +// private fun unbindService() { +// if (bound) { +// videoStreamService!!.videoCallResponseListener = null // unregister +// videoStreamService!!.mActivity = null +// unbindService(serviceConnection) +// bound = false +// } +// } +// +// private val serviceConnection: ServiceConnection = object : ServiceConnection { +// override fun onServiceConnected(name: ComponentName?, service: IBinder?) { +// val binder: VideoStreamContainerService.VideoStreamBinder = +// service as VideoStreamContainerService.VideoStreamBinder +// videoStreamService = binder.service +// bound = true +// videoStreamService!!.videoCallResponseListener = this@MainActivity // register +// videoStreamService!!.mActivity = this@MainActivity // register +// } +// +// override fun onServiceDisconnected(name: ComponentName?) { +// bound = false +// } +// +// } // code to hide soft keyboard fun hideSoftKeyBoard(editBox: EditText?) { diff --git a/lib/core/service/VideoCallService.dart b/lib/core/service/VideoCallService.dart index 82ace4b4..58caf079 100644 --- a/lib/core/service/VideoCallService.dart +++ b/lib/core/service/VideoCallService.dart @@ -29,13 +29,12 @@ class VideoCallService extends BaseService { DoctorProfileModel doctorProfile = await getDoctorProfile(isGetProfile: true); await VideoChannel.openVideoCallScreen( - kToken: - "T1==cGFydG5lcl9pZD00NzI0Nzk1NCZzaWc9NGIyZDljOTY3YjFiNWU1YzUzNzFmMjIyNjJmNmEzY2Y5NzZjOTdlYzpzZXNzaW9uX2lkPTFfTVg0ME56STBOemsxTkg1LU1UWXlNekEyTlRRMU9EVXhObjVrVFRoMFlVdFJXaXRYTWpadFZGZHFhSGxZVGpOdE1UVi1mZyZjcmVhdGVfdGltZT0xNjIzMDY1NDk1Jm5vbmNlPTAuMjM2Mjk0NTIwMTkyOTA4OTcmcm9sZT1wdWJsaXNoZXImZXhwaXJlX3RpbWU9MTYyNTY1NzQ5NCZpbml0aWFsX2xheW91dF9jbGFzc19saXN0PQ==", - // startCallRes.openTokenID, - kSessionId: - "1_MX40NzI0Nzk1NH5-MTYyMzA2NTQ1ODUxNn5kTTh0YUtRWitXMjZtVFdqaHlYTjNtMTV-fg", - //startCallRes.openSessionID, - kApiKey: '47247954',//'46209962' + kToken: startCallRes.openTokenID, + // "T1==cGFydG5lcl9pZD00NzI0Nzk1NCZzaWc9NGIyZDljOTY3YjFiNWU1YzUzNzFmMjIyNjJmNmEzY2Y5NzZjOTdlYzpzZXNzaW9uX2lkPTFfTVg0ME56STBOemsxTkg1LU1UWXlNekEyTlRRMU9EVXhObjVrVFRoMFlVdFJXaXRYTWpadFZGZHFhSGxZVGpOdE1UVi1mZyZjcmVhdGVfdGltZT0xNjIzMDY1NDk1Jm5vbmNlPTAuMjM2Mjk0NTIwMTkyOTA4OTcmcm9sZT1wdWJsaXNoZXImZXhwaXJlX3RpbWU9MTYyNTY1NzQ5NCZpbml0aWFsX2xheW91dF9jbGFzc19saXN0PQ==", + kSessionId: startCallRes.openSessionID, + // "1_MX40NzI0Nzk1NH5-MTYyMzA2NTQ1ODUxNn5kTTh0YUtRWitXMjZtVFdqaHlYTjNtMTV-fg", + + kApiKey:'46209962', //'47247954', vcId: patient.vcId, patientName: patient.fullName ?? (patient.firstName != null diff --git a/lib/core/viewModel/authentication_view_model.dart b/lib/core/viewModel/authentication_view_model.dart index a161c861..cae415da 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/live_care/live_care_patient_screen.dart b/lib/screens/live_care/live_care_patient_screen.dart index 100679cc..911687c9 100644 --- a/lib/screens/live_care/live_care_patient_screen.dart +++ b/lib/screens/live_care/live_care_patient_screen.dart @@ -173,21 +173,21 @@ class _LiveCarePatientScreenState extends State { child: AppLoaderWidget( containerColor: Colors.transparent, )), - AppButton( - fontWeight: FontWeight.w700, - color:Colors.green[600], - title: TranslationBase.of(context).initiateCall, - disabled: model.state == ViewState.BusyLocal, - onPressed: () async { - AppPermissionsUtils.requestVideoCallPermission(context: context,onTapGrant: (){ - locator().openVideo(model.startCallRes, PatiantInformtion( - vcId: 454353, - fullName: "test mosa" - ), callConnected, callDisconnected); - }); - - }, - ), + // AppButton( + // fontWeight: FontWeight.w700, + // color:Colors.green[600], + // title: TranslationBase.of(context).initiateCall, + // disabled: model.state == ViewState.BusyLocal, + // onPressed: () async { + // AppPermissionsUtils.requestVideoCallPermission(context: context,onTapGrant: (){ + // locator().openVideo(model.startCallRes, PatiantInformtion( + // vcId: 454353, + // fullName: "test mosa" + // ), callConnected, callDisconnected); + // }); + // + // }, + // ), ], ), ), 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 19dd6b98..4dc49b15 100644 --- a/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart +++ b/lib/screens/patients/profile/profile_screen/patient_profile_screen.dart @@ -306,12 +306,11 @@ class _PatientProfileScreenState extends State with Single // builder: (BuildContext context) => // EndCallScreen(patient:patient))); - // TODO MOSA REMOVE THIS - 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) { + if(isCallFinished) { Navigator.push(context, MaterialPageRoute( builder: (BuildContext context) => EndCallScreen(patient:patient))); } else { @@ -333,7 +332,7 @@ class _PatientProfileScreenState extends State with Single locator().openVideo(model.startCallRes, patient, callConnected, callDisconnected); }); } - }*/ + } }, ),