Calender Fix Ios 17+

merge-update-with-lab-changes
devamirsaleemahmad 2 years ago
parent 1ddac14efb
commit fb62ce2f19

@ -94,7 +94,7 @@ class _BookSuccessState extends State<BookSuccess> {
widget.docObject.projectName!,
null,
null,
widget.docObject.nationalityFlagURL!,
widget.docObject.nationalityFlagURL ?? "",
widget.docObject.doctorRate,
null,
widget.docObject.noOfPatientsRate,

@ -107,7 +107,7 @@ class _QRCodeState extends State<QRCode> {
DoctorHeader(
headerModel: HeaderModel(
widget.appointment!.doctorTitle! + " " + widget.appointment!.doctorNameObj!,
widget.appointment!.doctorID!,
widget.appointment!.doctorID ?? 0,
widget.appointment!.doctorImageURL!,
widget.appointment!.doctorSpeciality!,
"",

@ -1,5 +1,6 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/main.dart';
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.dart';
import 'package:diplomaticquarterapp/models/header_model.dart';
@ -188,8 +189,6 @@ class _BookReminderPageState extends State<BookReminderPage> {
backgroundColor: CustomColors.green,
elevation: 0,
onPressed: () async {
print(widget.patientShareResponse);
print(widget.patientShareResponse.appointmentNo);
showReminderDialog(
context,
widget.dateTime!,
@ -201,7 +200,8 @@ class _BookReminderPageState extends State<BookReminderPage> {
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
navigateToBookSuccess(context);
},
title: ""
title: null,
description: null
);
projectViewModel.analytics.appointment.appointment_reminder(true);
},

@ -24,27 +24,25 @@ showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, S
if (Platform.isAndroid) {
if (await PermissionService.isCalendarPermissionEnabled()) {
_showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? (int) {});
onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess ?? (int) {});
} else {
Utils.showPermissionConsentDialog(context, TranslationBase.of(context).calendarPermission, () async {
if (await Permission.calendarFullAccess.request().isGranted) {
_showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? (int) {});
onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess ?? (int) {});
}
});
}
} else {
if (await Permission.calendarFullAccess.request().isGranted) {
_showReminderDialog(context, dateTime, doctorName, eventId, appoDateFormatted, appoTimeFormatted,
onSuccess: onSuccess, title: title ?? "", description: description ?? "", onMultiDateSuccess: onMultiDateSuccess ?? (int) {});
onSuccess: onSuccess, title: title, description: description, onMultiDateSuccess: onMultiDateSuccess ?? (int) {});
}
}
}
final CalendarPlugin _myPlugin = CalendarPlugin();
Future<void> _showReminderDialog(BuildContext context, DateTime dateTime, String doctorName, String eventId, String appoDateFormatted, String appoTimeFormatted,
{required Function onSuccess, required String title, required String description, required Function(int) onMultiDateSuccess}) async {
{required Function onSuccess, String? title, String? description, required Function(int) onMultiDateSuccess}) async {
return showDialog<void>(
context: context,
barrierDismissible: true, // user must tap button!
@ -77,17 +75,21 @@ Future<void> _showReminderDialog(BuildContext context, DateTime dateTime, String
text = "2 hours";
}
if (onMultiDateSuccess == null) {
if (onMultiDateSuccess.call(i) == null) {
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
calendarUtils
.createOrUpdateEvent(
title: title ?? TranslationBase.of(context).reminderTitle + " " + doctorName,
description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted,
scheduleDateTime: dateTime,
eventId: eventId)
.then((value) {});
try {
await calendarUtils.createOrUpdateEvent(
title: title ?? TranslationBase
.of(context)
.reminderTitle + " " + doctorName,
description: description ?? "At " + appoDateFormatted + " " + appoTimeFormatted,
scheduleDateTime: dateTime,
eventId: eventId);
onSuccess();
onSuccess();
}catch(e){
print(e);
}
} else {
onMultiDateSuccess(i);
}

@ -393,10 +393,8 @@ class DoctorsListService extends BaseService {
await baseAppClient.post(INSERT_SPECIFIC_APPOINTMENT, onSuccess: (response, statusCode) async {
localRes = response;
}, onFailure: (String error, int statusCode) {
logger.d(error);
throw error;
}, body: request);
logger.d(localRes);
return Future.value(localRes);
} catch (e) {
logger.d(e);

@ -59,7 +59,7 @@ class CalendarUtils {
});
}
Future createOrUpdateEvent({String? title, String? description, DateTime? scheduleDateTime, String? eventId}) async {
Future createOrUpdateEvent({required String title, required String description, DateTime? scheduleDateTime, String? eventId}) async {
RecurrenceRule recurrenceRule = RecurrenceRule(
RecurrenceFrequency.Daily,
// daysOfWeek: daysOfWeek,
@ -74,7 +74,7 @@ class CalendarUtils {
TZDateTime scheduleDateTimeUTZ = TZDateTime.from(scheduleDateTime!, _currentLocation);
// print("eventId: " + eventId);
//print("eventId: " + eventId);
// print("writableCalendars-name: " + writableCalendars.name);
// print("writableCalendars-Id: " + writableCalendars.id);
// print("writableCalendarsToString: " + writableCalendars.toString());

@ -121,7 +121,7 @@ dependencies:
flutter_datetime_picker_plus: ^2.1.0
carousel_pro_nullsafety: ^2.0.0
flutter_local_notifications: any
device_calendar: ^4.2.0
device_calendar: ^4.3.2
geolocator: ^9.0.2
geocoding: ^2.0.1
jiffy: ^6.2.1

Loading…
Cancel
Save