forked from eva/focus-flow
2 KiB
2 KiB
V1 Block 21 — Notification Abstraction Layer
Purpose: Define NotificationAdapter contract.
Note for Codex: Follow tasks exactly; avoid exploratory calls when tasks specify names/files/tests.
Chunk 21.1 — NotificationAdapter contract
Recommended level: XHIGH
Status: Complete on 2026-06-26.
Tasks
- Add package
packages/scheduler_notifications. - Declare sealed class
NotificationRequestwith fields:id,title,body,scheduledDateTimeUtc,payloadJson. - Declare enum
NotificationFeedbackType(clicked,dismissed,action). - Define abstract
NotificationAdapterwith methodsFuture<void> schedule(NotificationRequest),Future<void> cancel(String id),Stream<NotificationFeedback>. - Add stub
FakeNotificationAdapterfor tests emitting events via StreamController.
Acceptance criteria
- Package compiles and
dart testpasses stub testfake_adapter_test.dart.
Completed implementation
- Added package
packages/scheduler_notificationswith public entry pointsnotifications.dartandscheduler_notifications.dart. - Added sealed
NotificationRequestwith factory construction and fieldsid,title,body,scheduledDateTimeUtc, andpayloadJson. - Added
NotificationFeedbackTypewithclicked,dismissed, andaction. - Added
NotificationFeedbackevent model. - Added abstract
NotificationAdapterwithschedule,cancel, andfeedback. - Added
FakeNotificationAdapterbacked by a broadcastStreamController. - Wired fake adapter tests into the root test wrapper.
Verification
dart pub get: passed.dart format test/scheduler_core_test.dart packages/scheduler_notifications: passed.cd packages/scheduler_notifications && dart analyze: passed, no issues found.cd packages/scheduler_notifications && dart test: passed, 2 tests.dart analyze: passed, no issues found.dart test: passed, 318 tests.scripts/test.sh: not present or not executable.