Merge branch 'live_care_patient' into 'development'

first step from show Video call

See merge request Cloud_Solution/doctor_app_flutter!690
merge-requests/691/merge
Mohammad Aljammal 5 years ago
commit ccdd6696be

@ -2,18 +2,26 @@ import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart'; import 'package:doctor_app_flutter/core/model/live_care/PendingPatientERForDoctorAppRequestModel.dart';
import 'package:doctor_app_flutter/core/service/base/base_service.dart'; import 'package:doctor_app_flutter/core/service/base/base_service.dart';
import 'package:doctor_app_flutter/models/livecare/end_call_req.dart'; import 'package:doctor_app_flutter/models/livecare/end_call_req.dart';
import 'package:doctor_app_flutter/models/livecare/start_call_req.dart';
import 'package:doctor_app_flutter/models/livecare/start_call_res.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
class LiveCarePatientServices extends BaseService{ class LiveCarePatientServices extends BaseService {
List<PatiantInformtion> _patientList = []; List<PatiantInformtion> _patientList = [];
List<PatiantInformtion> get patientList => _patientList; List<PatiantInformtion> get patientList => _patientList;
bool _isFinished = false; bool _isFinished = false;
bool get isFinished => _isFinished;
bool get isFinished => _isFinished;
var endCallResponse = {}; var endCallResponse = {};
var transferToAdminResponse = {}; var transferToAdminResponse = {};
StartCallRes _startCallRes;
StartCallRes get startCallRes => _startCallRes;
Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async{ Future getPendingPatientERForDoctorApp(PendingPatientERForDoctorAppRequestModel pendingPatientERForDoctorAppRequestModel) async{
hasError = false; hasError = false;
await baseAppClient.post( await baseAppClient.post(
@ -33,16 +41,27 @@ class LiveCarePatientServices extends BaseService{
} }
Future endCall(EndCallReq endCallReq) async { Future endCall(EndCallReq endCallReq) async {
hasError = false;
await baseAppClient.post(END_CALL, onSuccess: (response, statusCode) async { await baseAppClient.post(END_CALL, onSuccess: (response, statusCode) async {
_isFinished = true; _isFinished = true;
endCallResponse = response; endCallResponse = response;
}, onFailure: (String error, int statusCode) { }, onFailure: (String error, int statusCode) {
_isFinished = true; _isFinished = true;
throw error; hasError = true;
super.error = error;
}, body: endCallReq.toJson()); }, body: endCallReq.toJson());
} }
Future startCall(StartCallReq startCallReq) async {
hasError = false;
await baseAppClient.post(START_LIVECARE_CALL,
onSuccess: (response, statusCode) async {
_startCallRes = StartCallRes.fromJson(response);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: startCallReq.toJson());
}
Future endCallWithCharge(int vcID) async{ Future endCallWithCharge(int vcID) async{
hasError = false; hasError = false;
await baseAppClient.post( await baseAppClient.post(

@ -4,6 +4,8 @@ import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart';
import 'package:doctor_app_flutter/core/service/patient/LiveCarePatientServices.dart'; import 'package:doctor_app_flutter/core/service/patient/LiveCarePatientServices.dart';
import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/base_view_model.dart';
import 'package:doctor_app_flutter/models/livecare/end_call_req.dart'; import 'package:doctor_app_flutter/models/livecare/end_call_req.dart';
import 'package:doctor_app_flutter/models/livecare/start_call_req.dart';
import 'package:doctor_app_flutter/models/livecare/start_call_res.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import '../../locator.dart'; import '../../locator.dart';
@ -15,6 +17,7 @@ class LiveCarePatientViewModel extends BaseViewModel {
locator<LiveCarePatientServices>(); locator<LiveCarePatientServices>();
bool get isFinished => _liveCarePatientServices.isFinished; bool get isFinished => _liveCarePatientServices.isFinished;
StartCallRes get startCallRes => _liveCarePatientServices.startCallRes;
DashboardService _dashboardService = DashboardService _dashboardService =
locator<DashboardService>(); locator<DashboardService>();
@ -49,14 +52,38 @@ class LiveCarePatientViewModel extends BaseViewModel {
.endCall(endCallReq); .endCall(endCallReq);
if (_liveCarePatientServices.hasError) { if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error; error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal); setState(ViewState.ErrorLocal);
} else { } else {
filterData = _liveCarePatientServices.patientList;
setState(ViewState.Idle); setState(ViewState.Idle);
} }
} }
Future startCall({int vCID, bool isReCall}) async {
StartCallReq startCallReq = new StartCallReq();
await getDoctorProfile();
startCallReq.clinicId = super.doctorProfile.clinicID;
startCallReq.vCID = vCID; //["VC_ID"];
startCallReq.isrecall = isReCall;
startCallReq.doctorId = doctorProfile.doctorID;
startCallReq.isOutKsa = false; //["IsOutKSA"];
startCallReq.projectName = doctorProfile.projectName;
startCallReq.docotrName = doctorProfile.doctorName;
startCallReq.clincName = doctorProfile.clinicDescription;
startCallReq.docSpec = doctorProfile.doctorTitleForProfile;
startCallReq.generalid = 'Cs2020@2016\$2958';
setState(ViewState.BusyLocal);
await _liveCarePatientServices
.startCall(startCallReq);
if (_liveCarePatientServices.hasError) {
error = _liveCarePatientServices.error;
setState(ViewState.ErrorLocal);
} else {
setState(ViewState.Idle);
}
}
Future endCallWithCharge(int vcID) async { Future endCallWithCharge(int vcID) async {
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);
await _liveCarePatientServices await _liveCarePatientServices

@ -204,13 +204,13 @@ class _LiveCarePandingListState extends State<LiveCarePandingListScreen> {
// .pushNamed( // .pushNamed(
// VIDEO_CALL, // VIDEO_CALL,
// item) // item)
Navigator.push( // Navigator.push(
context, // context,
MaterialPageRoute( // MaterialPageRoute(
builder: (context) => // builder: (context) =>
VideoCallPage( // VideoCallPage(
item, // item,
context))) // context)))
}, },
), ),
) )

@ -1,10 +1,12 @@
import 'dart:async'; import 'dart:async';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart'; import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
import 'package:doctor_app_flutter/core/viewModel/livecare_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/livecare_view_model.dart';
import 'package:doctor_app_flutter/models/livecare/get_pending_res_list.dart'; import 'package:doctor_app_flutter/models/livecare/get_pending_res_list.dart';
import 'package:doctor_app_flutter/models/livecare/session_status_model.dart'; import 'package:doctor_app_flutter/models/livecare/session_status_model.dart';
import 'package:doctor_app_flutter/models/livecare/start_call_res.dart'; import 'package:doctor_app_flutter/models/livecare/start_call_res.dart';
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/util/VideoChannel.dart'; import 'package:doctor_app_flutter/util/VideoChannel.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
@ -13,9 +15,10 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class VideoCallPage extends StatefulWidget { class VideoCallPage extends StatefulWidget {
final LiveCarePendingListResponse patientData; final PatiantInformtion patientData;
final listContext; final listContext;
VideoCallPage(this.patientData, this.listContext); final LiveCarePatientViewModel model;
VideoCallPage({this.patientData, this.listContext, this.model});
@override @override
_VideoCallPageState createState() => _VideoCallPageState(); _VideoCallPageState createState() => _VideoCallPageState();
@ -41,7 +44,8 @@ class _VideoCallPageState extends State<VideoCallPage> {
super.didChangeDependencies(); super.didChangeDependencies();
if (_isInit) { if (_isInit) {
_liveCareProvider = Provider.of<LiveCareViewModel>(context); _liveCareProvider = Provider.of<LiveCareViewModel>(context);
startCall(false); connectOpenTok(widget.model.startCallRes);
// widget.model.startCall(vCID: widget.patientData.vcId, isReCall: false);
} }
_isInit = false; _isInit = false;
} }
@ -61,7 +65,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
kSessionId: tokenData.openSessionID, kSessionId: tokenData.openSessionID,
//'1_MX40NjgwMzIyNH5-MTU5MzY4MzYzODYwM35ucExWYVRVSm5Hcy9uWGZmM1lOa3czZHV-fg', //'1_MX40NjgwMzIyNH5-MTU5MzY4MzYzODYwM35ucExWYVRVSm5Hcy9uWGZmM1lOa3czZHV-fg',
kApiKey: '46209962', kApiKey: '46209962',
vcId: widget.patientData.vCID, vcId: widget.patientData.vcId,
tokenID: token, //"hfkjshdf347r8743", tokenID: token, //"hfkjshdf347r8743",
generalId: "Cs2020@2016\$2958", generalId: "Cs2020@2016\$2958",
doctorId: doctorprofile['DoctorID'], doctorId: doctorprofile['DoctorID'],
@ -130,7 +134,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
height: MediaQuery.of(context).size.height * 0.02, height: MediaQuery.of(context).size.height * 0.02,
), ),
Text( Text(
widget.patientData.patientName, widget.patientData.fullName,
style: TextStyle( style: TextStyle(
color: Colors.deepPurpleAccent, color: Colors.deepPurpleAccent,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
@ -319,7 +323,7 @@ class _VideoCallPageState extends State<VideoCallPage> {
endCallWithCharge() { endCallWithCharge() {
_liveCareProvider _liveCareProvider
.endCallWithCharge(widget.patientData.vCID, doctorprofile['DoctorID']) .endCallWithCharge(widget.patientData.vcId, doctorprofile['DoctorID'])
.then((result) { .then((result) {
closeRoute(); closeRoute();
print('end callwith charge'); print('end callwith charge');

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.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/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
@ -5,9 +6,11 @@ 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/models/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.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/live_care/end_call_screen.dart';
import 'package:doctor_app_flutter/screens/live_care/video_call.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_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_other.dart';
import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_search.dart'; import 'package:doctor_app_flutter/screens/patients/profile/profile_screen/profile_gird_for_search.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.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'; 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/app_scaffold_widget.dart';
@ -278,14 +281,26 @@ class _PatientProfileScreenState extends State<PatientProfileScreen>
.endCall:TranslationBase .endCall:TranslationBase
.of(context) .of(context)
.initiateCall, .initiateCall,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async { onPressed: () async {
// if(model.isFinished) { if(model.isFinished) {
Navigator.push(context, MaterialPageRoute( Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) => builder: (BuildContext context) =>
EndCallScreen(patient:patient))); EndCallScreen(patient:patient)));
// } else { } else {
// // TODO Call initiateCall service GifLoaderDialogUtils.showMyDialog(context);
// } await model.startCall( isReCall : false, vCID: patient.vcId);
if(model.state == ViewState.ErrorLocal) {
//
GifLoaderDialogUtils.hideDialog(context);
Helpers.showErrorToast(model.error);
} else {
GifLoaderDialogUtils.hideDialog(context);
Navigator.push(context, MaterialPageRoute(
builder: (BuildContext context) =>
VideoCallPage(patientData: patient,listContext: "dfd",model: model,)));
}
}
}, },
), ),

Loading…
Cancel
Save