LiveCare permissions

merge-update-with-lab-changes
haroon amjad 4 years ago
parent 39190681c6
commit fe7baeab3c

@ -242,44 +242,6 @@ class _BookConfirmState extends State<BookConfirm> {
); );
} }
Future<bool> askVideoCallPermission() async {
if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted)) {
return false;
}
if (!(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) {
await drawOverAppsMessageDialog(context);
return false;
}
return true;
}
Future drawOverAppsMessageDialog(BuildContext context) async {
await showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
content: Text("Please select 'Diplomatic Quarter' from the list and allow draw over app permission to use live care."),
contentPadding: EdgeInsets.fromLTRB(24.0, 20.0, 24.0, 0.0),
actions: [
FlatButton(
child: Text("Cancel"),
onPressed: () {
Navigator.pop(context);
},
),
FlatButton(
child: Text("Go to Settings"),
onPressed: () async {
await PlatformBridge.shared().askDrawOverAppsPermission();
Navigator.pop(context);
},
)
],
);
},
);
}
cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) { cancelAppointment(DoctorList docObject, AppoitmentAllHistoryResultList appo, BuildContext context) {
ConfirmDialog.closeAlertDialog(context); ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);

@ -120,7 +120,7 @@ class _LiveCarePendingRequestState extends State<LiveCarePendingRequest> {
style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)), style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)),
), ),
Container( Container(
transform: Matrix4.translationValues(0.0, 130.0, 0.0), transform: Matrix4.translationValues(0.0, 110.0, 0.0),
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
child: ButtonTheme( child: ButtonTheme(

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart'; import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
@ -11,12 +13,12 @@ import 'package:diplomaticquarterapp/pages/livecare/livecare_home.dart';
import 'package:diplomaticquarterapp/pages/livecare/livecare_scheduling/schedule_clinic_card.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_scheduling/schedule_clinic_card.dart';
import 'package:diplomaticquarterapp/pages/livecare/livecare_type_select.dart'; import 'package:diplomaticquarterapp/pages/livecare/livecare_type_select.dart';
import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareInfoDialog.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCareInfoDialog.dart';
import 'package:diplomaticquarterapp/pages/livecare/widgets/LiveCarePaymentDialog.dart';
import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart'; import 'package:diplomaticquarterapp/pages/livecare/widgets/clinic_card.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart';
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart'; import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart';
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/PlatformBridge.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
@ -29,6 +31,7 @@ import 'package:diplomaticquarterapp/widgets/in_app_browser/InAppBrowser.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
import '../live_care_payment_page.dart'; import '../live_care_payment_page.dart';
@ -180,40 +183,43 @@ class _clinic_listState extends State<ClinicList> {
navigateTo(context, LiveCarePatmentPage(getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName)).then( navigateTo(context, LiveCarePatmentPage(getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName)).then(
(value) { (value) {
if (value) { if (value) {
if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { askVideoCallPermission().then((value) {
showLiveCareInfoDialog(getERAppointmentFeesList); if (value) {
} else { if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") {
navigateToPaymentMethod(getERAppointmentFeesList, context); showLiveCareInfoDialog(getERAppointmentFeesList);
} } else {
navigateToPaymentMethod(getERAppointmentFeesList, context);
}
}
});
} }
}, },
); );
// showGeneralDialog( }
// barrierColor: Colors.black.withOpacity(0.5),
// transitionBuilder: (context, a1, a2, widget) { Future<bool> askVideoCallPermission() async {
// final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0; if (!(await Permission.camera.request().isGranted) || !(await Permission.microphone.request().isGranted)) {
// return Transform( return false;
// transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0), }
// child: Opacity( if (Platform.isAndroid && !(await PlatformBridge.shared().isDrawOverAppsPermissionAllowed())) {
// opacity: a1.value, await drawOverAppsMessageDialog(context);
// child: LiveCarePaymentDialog(getERAppointmentFeesList: getERAppointmentFeesList, waitingTime: waitingTime, clinicName: selectedClinicName), return false;
// ), }
// ); return true;
// }, }
// transitionDuration: Duration(milliseconds: 500),
// barrierDismissible: true, Future drawOverAppsMessageDialog(BuildContext context) async {
// barrierLabel: '', ConfirmDialog dialog = new ConfirmDialog(
// context: context, context: context,
// pageBuilder: (context, animation1, animation2) {}) confirmMessage: "Please select 'Dr. Alhabib' from the list and allow draw over app permission to use live care.",
// .then((value) { okText: TranslationBase.of(context).confirm,
// if (value) { cancelText: TranslationBase.of(context).cancel_nocaps,
// if (getERAppointmentFeesList.total == "0" || getERAppointmentFeesList.total == "0.0") { okFunction: () async {
// showLiveCareInfoDialog(getERAppointmentFeesList); await PlatformBridge.shared().askDrawOverAppsPermission();
// } else { Navigator.pop(context);
// navigateToPaymentMethod(getERAppointmentFeesList, context); },
// } cancelFunction: () => {});
// } dialog.showAlertDialog(context);
// });
} }
showLiveCareInfoDialog(GetERAppointmentFeesList getERAppointmentFeesList) async { showLiveCareInfoDialog(GetERAppointmentFeesList getERAppointmentFeesList) async {
@ -452,7 +458,7 @@ class _clinic_listState extends State<ClinicList> {
children: <Widget>[ children: <Widget>[
isDataLoaded isDataLoaded
? Expanded( ? Expanded(
child: Container( child: Container(
child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length > 0 child: liveCareScheduleClinicsListResponse.clinicsHaveScheduleList.length > 0
? Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -484,30 +490,30 @@ class _clinic_listState extends State<ClinicList> {
) )
: getNoDataWidget(context), : getNoDataWidget(context),
), ),
) )
: Container(), : Container(),
isDataLoaded isDataLoaded
? Container( ? Container(
width: double.infinity, width: double.infinity,
color: Colors.white, color: Colors.white,
padding: EdgeInsets.all(12), padding: EdgeInsets.all(12),
child: ButtonTheme( child: ButtonTheme(
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0), borderRadius: BorderRadius.circular(10.0),
), ),
minWidth: MediaQuery.of(context).size.width * 0.7, minWidth: MediaQuery.of(context).size.width * 0.7,
height: 45.0, height: 45.0,
child: RaisedButton( child: RaisedButton(
color: CustomColors.accentColor, color: CustomColors.accentColor,
textColor: Colors.white, textColor: Colors.white,
elevation: 0, elevation: 0,
disabledTextColor: Colors.white, disabledTextColor: Colors.white,
disabledColor: new Color(0xFFbcc2c4), disabledColor: new Color(0xFFbcc2c4),
onPressed: startScheduleLiveCare, onPressed: startScheduleLiveCare,
child: Text(TranslationBase.of(context).start, style: TextStyle(fontSize: 18.0)), child: Text(TranslationBase.of(context).start, style: TextStyle(fontSize: 18.0)),
),
), ),
), )
)
: Container(), : Container(),
], ],
); );
@ -542,10 +548,6 @@ class _clinic_listState extends State<ClinicList> {
); );
}, },
), ),
// Container(
// margin: EdgeInsets.all(15.0),
// child: Text(TranslationBase.of(context).offlineClinics, style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)),
// ),
ListView.builder( ListView.builder(
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,

Loading…
Cancel
Save