Persist three global ntfy switches in server_settings: run_finished (default on: auto-mode runs notify on success, read inside the transition transaction; on/off modes unchanged), chat_needs_you (default on: gates chat question/approval alerts) and chat_reply_finished (default off: one alert per finished assistant turn). Expose notification_settings / set_notification_settings over the websocket protocol, add a Phone notifications section with Material and Cupertino checkboxes in Settings, document the settings, and keep the cli, tui, stage and pipeline test packages from inheriting a real ntfy configuration.
2.0 KiB
Notification settings (ntfy checkboxes)
Settings has a Phone notifications section beside the in-app
Notifications permission tile. It holds three checkboxes for the server's global
ntfy choices: Run finished (run_finished, default on), Chat needs your
answer or approval (chat_needs_you, default on) and Chat reply finished
(chat_reply_finished, default off), under one line saying they go through
ntfy to the subscribed devices. Material uses CheckboxListTile. Cupertino uses
CupertinoListTile with a CupertinoCheckbox in an inset grouped section.
Colours come from the theme only.
Files: lib/features/settings/ntfy_settings_controller.dart (gateway
load/toggle, revert on failure), lib/features/settings/settings_ntfy_section.dart
(widget), wired into settings_screen.dart with the shared client as the
ApiGateway.
Behaviour: the section loads notification_settings when the shared connection
is connected and reloads after reconnecting. While offline it shows "Connect to a
server to change these." Checkboxes are disabled while loading or saving. A
toggle sends set_notification_settings with only that key and shows the new
value at once. The stored reply then replaces every value. A refusal reverts the
checkbox and shows "Could not save: " inline. A load failure shows the
reason with a Retry button.
Verification: test/features/settings/settings_ntfy_section_test.dart covers
both styles. It checks loading, the exact set request, and revert plus error on
failure. It also covers the disabled state while loading, the offline state and
retry after a failed load. The existing Settings screen and Templates wiring
tests now answer the extra queued notification_settings read. Full
flutter test passed, flutter analyze reported only the pre-existing info in
artifact_viewer_page_test.dart, and flutter build web succeeded.
Not done: no browser capture or device run. Rendered behaviour is verified by widget tests only, and phone delivery of the new notifications was not tested.