Enhance: Google Photos integration, refinement of Schedule/Todo lists and API fixes
This commit is contained in:
@@ -20,14 +20,23 @@ class TodoService {
|
||||
|
||||
Future<List<TodoItem>> fetchTodayTodos() async {
|
||||
if (ApiConfig.useMockData) {
|
||||
final today = DateTime.now();
|
||||
return MockDataStore.todos.where((todo) => todo.dueDate != null).where((
|
||||
todo,
|
||||
) {
|
||||
final date = todo.dueDate!;
|
||||
return date.year == today.year &&
|
||||
date.month == today.month &&
|
||||
date.day == today.day;
|
||||
final now = DateTime.now();
|
||||
final today = DateTime(now.year, now.month, now.day);
|
||||
final tomorrow = today.add(const Duration(days: 1));
|
||||
|
||||
return MockDataStore.todos.where((todo) {
|
||||
if (todo.completed) {
|
||||
// If completed, only show if it was due today
|
||||
if (todo.dueDate == null) return false;
|
||||
return todo.dueDate!.isAfter(today.subtract(const Duration(milliseconds: 1))) &&
|
||||
todo.dueDate!.isBefore(tomorrow);
|
||||
}
|
||||
|
||||
// If not completed:
|
||||
// 1. No due date -> show
|
||||
// 2. Due today or before -> show
|
||||
if (todo.dueDate == null) return true;
|
||||
return todo.dueDate!.isBefore(tomorrow);
|
||||
}).toList();
|
||||
}
|
||||
final data = await _client.getList("${ApiConfig.todos}/today");
|
||||
|
||||
Reference in New Issue
Block a user