LiveCare permissions

merge-requests/547/head
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) {
ConfirmDialog.closeAlertDialog(context);
GifLoaderDialogUtils.showMyDialog(context);

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

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

Loading…
Cancel
Save