feat(04-01): Android config, NotificationService, DAO queries, timezone init, ARB strings

- Add flutter_local_notifications ^21.0.0, timezone ^0.11.0, flutter_timezone ^1.0.8 to pubspec.yaml
- Set compileSdk=35, enable core library desugaring in build.gradle.kts
- Add POST_NOTIFICATIONS, RECEIVE_BOOT_COMPLETED permissions and boot receivers to AndroidManifest.xml
- Create NotificationService singleton with initialize, requestPermission, scheduleDailyNotification, cancelAll
- Add getOverdueAndTodayTaskCount and getOverdueTaskCount one-shot queries to DailyPlanDao
- Initialize timezone and NotificationService in main.dart before runApp
- Add 7 notification-related ARB strings to app_de.arb
- All 72 existing tests pass
This commit is contained in:
2026-03-16 14:52:29 +01:00
parent abc56f032f
commit 878767138c
7 changed files with 155 additions and 3 deletions

View File

@@ -32,6 +32,28 @@ class DailyPlanDao extends DatabaseAccessor<AppDatabase>
});
}
/// One-shot count of overdue + today tasks (for notification body).
Future<int> getOverdueAndTodayTaskCount({DateTime? today}) async {
final now = today ?? DateTime.now();
final endOfToday = DateTime(now.year, now.month, now.day + 1);
final result = await (selectOnly(tasks)
..addColumns([tasks.id.count()])
..where(tasks.nextDueDate.isSmallerThanValue(endOfToday)))
.getSingle();
return result.read(tasks.id.count()) ?? 0;
}
/// One-shot count of overdue tasks only (for notification body split).
Future<int> getOverdueTaskCount({DateTime? today}) async {
final now = today ?? DateTime.now();
final startOfToday = DateTime(now.year, now.month, now.day);
final result = await (selectOnly(tasks)
..addColumns([tasks.id.count()])
..where(tasks.nextDueDate.isSmallerThanValue(startOfToday)))
.getSingle();
return result.read(tasks.id.count()) ?? 0;
}
/// Count task completions recorded today.
/// Uses customSelect with readsFrom for proper stream invalidation.
Stream<int> watchCompletionsToday({DateTime? today}) {