refactor: 重构提醒通知系统
This commit is contained in:
@@ -50,14 +50,21 @@ class CalendarService {
|
||||
return events;
|
||||
}
|
||||
|
||||
Future<ScheduleItemModel> getEventById(String id) async {
|
||||
Future<ScheduleItemModel> getEventById(
|
||||
String id, {
|
||||
bool reconcileReminder = true,
|
||||
}) async {
|
||||
final response = await _apiClient.get<Map<String, dynamic>>('$_prefix/$id');
|
||||
final data = response.data;
|
||||
if (data == null) {
|
||||
throw StateError('Invalid getEventById response: empty payload');
|
||||
}
|
||||
final event = ScheduleItemModel.fromJson(data);
|
||||
await _reminderReconcileService?.reconcileEvent(_toReminderSnapshot(event));
|
||||
if (reconcileReminder) {
|
||||
await _reminderReconcileService?.reconcileEvent(
|
||||
_toReminderSnapshot(event),
|
||||
);
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user