2.4 KiB
2.4 KiB
V1 Block 22 — OS-Notification Package
Purpose: Desktop notification implementation.
Note for Codex: Follow tasks exactly; avoid exploratory calls when tasks specify names/files/tests.
Chunk 22.1 — Desktop notification adapter
Recommended level: HIGH
Status: Complete on 2026-06-26.
Tasks
- Create package
packages/scheduler_notifications_desktop. - Implement adapters per platform with conditional import using
dart:ioPlatform. - For Linux use
notify-sendviaProcess.run; for macOS useosascript; for Windows usewin32Toast viawindows_notificationpackage. - Implement fallback to write to stdout if unsupported.
- Add adapter factory
DesktopNotificationAdapter.defaultInstance(). - Write integration test using
FakeNotificationAdaptermocks to assert scheduling logic; skip on CI if platform not supported.
Acceptance criteria
- Desktop adapter compiles on all OS; tests skip rather than fail on unsupported.
- Adapter passes NotificationAdapter contract tests.
Completed implementation
- Added package
packages/scheduler_notifications_desktopwith public entry pointsdesktop_notifications.dartandscheduler_notifications_desktop.dart. - Added
DesktopNotificationAdapter.defaultInstance()and injectable backend support. - Added conditional export for IO vs non-IO environments.
- Added Linux
notify-sendbackend viaProcess.run. - Added macOS
osascriptbackend viaProcess.run. - Added stdout/log fallback backend for unsupported platforms and Windows.
- Added desktop adapter tests covering delegation, Linux/macOS command selection, fallback behavior, fake-adapter scheduling workflow, and default adapter construction.
- Wired desktop adapter tests into the root test wrapper.
Notes
- Windows currently uses the stdout fallback. Adding
windows_notificationwould pull Flutter SDK dependencies into this pure Dart package; a true Windows toast adapter should be revisited if the desktop packaging layer already depends on Flutter.
Verification
dart pub get: passed.dart format test/scheduler_core_test.dart packages/scheduler_notifications_desktop: passed.cd packages/scheduler_notifications_desktop && dart analyze: passed, no issues found.cd packages/scheduler_notifications_desktop && dart test: passed, 6 tests.dart analyze: passed, no issues found.dart test: passed, 324 tests.scripts/test.sh: not present or not executable.