46 lines
2.4 KiB
Markdown
46 lines
2.4 KiB
Markdown
# 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
|
|
1. Create package **`packages/scheduler_notifications_desktop`**.
|
|
2. Implement adapters per platform with conditional import using `dart:io` Platform.
|
|
3. For Linux use `notify-send` via `Process.run`; for macOS use `osascript`; for Windows use `win32` Toast via `windows_notification` package.
|
|
4. Implement fallback to write to stdout if unsupported.
|
|
5. Add adapter factory `DesktopNotificationAdapter.defaultInstance()`.
|
|
6. Write integration test using `FakeNotificationAdapter` mocks to assert scheduling logic; skip on CI if platform not supported.
|
|
|
|
### Acceptance criteria
|
|
1. Desktop adapter compiles on all OS; tests skip rather than fail on unsupported.
|
|
2. Adapter passes NotificationAdapter contract tests.
|
|
|
|
### Completed implementation
|
|
1. Added package `packages/scheduler_notifications_desktop` with public entry points `desktop_notifications.dart` and `scheduler_notifications_desktop.dart`.
|
|
2. Added `DesktopNotificationAdapter.defaultInstance()` and injectable backend support.
|
|
3. Added conditional export for IO vs non-IO environments.
|
|
4. Added Linux `notify-send` backend via `Process.run`.
|
|
5. Added macOS `osascript` backend via `Process.run`.
|
|
6. Added stdout/log fallback backend for unsupported platforms and Windows.
|
|
7. Added desktop adapter tests covering delegation, Linux/macOS command selection, fallback behavior, fake-adapter scheduling workflow, and default adapter construction.
|
|
8. Wired desktop adapter tests into the root test wrapper.
|
|
|
|
### Notes
|
|
1. Windows currently uses the stdout fallback. Adding `windows_notification` would 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
|
|
1. `dart pub get`: passed.
|
|
2. `dart format test/scheduler_core_test.dart packages/scheduler_notifications_desktop`: passed.
|
|
3. `cd packages/scheduler_notifications_desktop && dart analyze`: passed, no issues found.
|
|
4. `cd packages/scheduler_notifications_desktop && dart test`: passed, 6 tests.
|
|
5. `dart analyze`: passed, no issues found.
|
|
6. `dart test`: passed, 324 tests.
|
|
7. `scripts/test.sh`: not present or not executable.
|
|
|
|
---
|