|
|
|
@ -16,62 +16,81 @@ import '../../locator.dart';
|
|
|
|
|
import '../../routes.dart';
|
|
|
|
|
import 'NavigationService.dart';
|
|
|
|
|
|
|
|
|
|
class VideoCallService extends BaseService{
|
|
|
|
|
|
|
|
|
|
class VideoCallService extends BaseService {
|
|
|
|
|
StartCallRes startCallRes;
|
|
|
|
|
PatiantInformtion patient;
|
|
|
|
|
LiveCarePatientServices _liveCarePatientServices = locator<LiveCarePatientServices>();
|
|
|
|
|
LiveCarePatientServices _liveCarePatientServices =
|
|
|
|
|
locator<LiveCarePatientServices>();
|
|
|
|
|
|
|
|
|
|
openVideo(StartCallRes startModel,PatiantInformtion patientModel,VoidCallback onCallConnected, VoidCallback onCallDisconnected)async{
|
|
|
|
|
openVideo(StartCallRes startModel, PatiantInformtion patientModel,
|
|
|
|
|
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,//"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}" : "-"),
|
|
|
|
|
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<NavigationService>().navigatorKey.currentContext);
|
|
|
|
|
endCall(patient.vcId, false,).then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(locator<NavigationService>().navigatorKey.currentContext);
|
|
|
|
|
if (hasError) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(error);
|
|
|
|
|
}else
|
|
|
|
|
locator<NavigationService>().navigateTo(PATIENTS_END_Call,arguments: {
|
|
|
|
|
"patient": patient,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
locator<NavigationService>().navigatorKey.currentContext);
|
|
|
|
|
endCall(
|
|
|
|
|
patient.vcId,
|
|
|
|
|
false,
|
|
|
|
|
).then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(
|
|
|
|
|
locator<NavigationService>().navigatorKey.currentContext);
|
|
|
|
|
if (hasError) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(error);
|
|
|
|
|
} else
|
|
|
|
|
locator<NavigationService>()
|
|
|
|
|
.navigateTo(PATIENTS_END_Call, arguments: {
|
|
|
|
|
"patient": patient,
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
onCallNotRespond: (SessionStatusModel sessionStatusModel) {
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(locator<NavigationService>().navigatorKey.currentContext);
|
|
|
|
|
endCall(patient.vcId, sessionStatusModel.sessionStatus == 3,).then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(locator<NavigationService>().navigatorKey.currentContext);
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(
|
|
|
|
|
locator<NavigationService>().navigatorKey.currentContext);
|
|
|
|
|
endCall(
|
|
|
|
|
patient.vcId,
|
|
|
|
|
sessionStatusModel.sessionStatus == 3,
|
|
|
|
|
).then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(
|
|
|
|
|
locator<NavigationService>().navigatorKey.currentContext);
|
|
|
|
|
if (hasError) {
|
|
|
|
|
DrAppToastMsg.showErrorToast(error);
|
|
|
|
|
} else {
|
|
|
|
|
locator<NavigationService>().navigateTo(PATIENTS_END_Call,arguments: {
|
|
|
|
|
locator<NavigationService>()
|
|
|
|
|
.navigateTo(PATIENTS_END_Call, arguments: {
|
|
|
|
|
"patient": patient,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future endCall(int vCID, bool isPatient) async {
|
|
|
|
|
hasError = false;
|
|
|
|
|
await getDoctorProfile(isGetProfile: true);
|
|
|
|
@ -85,5 +104,4 @@ class VideoCallService extends BaseService{
|
|
|
|
|
error = _liveCarePatientServices.error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|