updated calendar color cards and detection update to V1.0.1
This commit is contained in:
@@ -36,7 +36,26 @@ class GoogleCalendarService {
|
||||
final response = await _httpClient.get(url);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
return _parseICalendar(response.body);
|
||||
final allEvents = _parseICalendar(response.body);
|
||||
|
||||
// Filter events by date range if provided
|
||||
if (startDate != null || endDate != null) {
|
||||
return allEvents.where((event) {
|
||||
if (event.startTime == null) return false;
|
||||
|
||||
if (startDate != null && event.startTime!.isBefore(startDate)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (endDate != null && event.startTime!.isAfter(endDate)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
return allEvents;
|
||||
} else {
|
||||
throw Exception('Failed to load calendar: ${response.statusCode}');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user