Skip to content

feat: alerts outside the app, switched on in Settings - #361

Merged
8 commits merged into
mainfrom
feat/alerts-settings-and-permission
Nov 13, 2026
Merged

8 commits merged into
mainfrom
feat/alerts-settings-and-permission

Conversation

@nofuturekid

Copy link
Copy Markdown
Collaborator

What changed

Settings gets a Notifications section that switches on the background check that is already on main (ADR-0048). It is off by default; with it off NOVA still does nothing in the background.

  • Permission flow. The switch opens an explanation ("Get alerts outside the app?"). "Turn on" asks for POST_NOTIFICATIONS on Android 13 and later; only a granted answer schedules anything. A denial (or a block in Android's settings on older versions) leaves the switch off and shows "Android blocks notifications for NOVA" with a button to Android's notification settings. The line is re-read when the screen comes back to the front.
  • Choices (shown while on): check every 15 min / 30 min / 1 hour / 3 hours, alerts and warnings or alerts only, Wi-Fi only. They go through AlertScheduler.update, which updates the existing unique work.
  • Last-check line per server: could not be reached, certificate problem, API key missing / cannot be read / refused, OK, not run yet, and the new one: "Not checked in the background because the connection is not encrypted. An https address is needed." The line follows the server's current addresses, so an http-only server never looks checked because of an old record. The demo server is named as never checked (the section is usable in demo mode).
  • Where the outcome is kept: ServerAlertState.lastCheck (time and outcome), set by AlertCheckRunner after each run and read only by the screen. evaluateAlerts leaves it alone; what is notified is unchanged.
  • Send test notification: runs the same https-only probe once for the active server and posts its newest unread alert or warning. It never writes the remembered state.
  • Battery hint, "Tips for your phone" (dontkillmyapp.com, opened only on tap) and a link to the README recipe for instant alerts with Unraid's own agents.
  • With the switch off the screen reads only the settings store and makes no WorkManager call (test below).

Documents: CHANGELOG (Unreleased, Added), README (feature bullet, an "Alerts outside the app" section, a privacy bullet), docs/privacy/POLICY.md (effective date, what is sent in the background, the https rule, alert state, POST_NOTIFICATIONS / WAKE_LOCK / RECEIVE_BOOT_COMPLETED), site/index.html (feature and privacy cards), store description (one line), HANDOFF.md (one bullet), ADR-0048 (status and an addendum for the https-only and demo rules).

Tests (Robolectric, real settings store, real notifier, real WorkManager test driver)

  • switching on without the permission requests it and schedules nothing until granted
  • denial leaves the switch off and explains
  • "Not now" changes nothing
  • switching off cancels the work and the screen makes no WorkManager call afterwards
  • changing interval or network reschedules the one existing work
  • a not-encrypted server renders the encryption line, even with a stale "OK" record
  • every outcome reads differently; the demo server is named and cannot be tested
  • opening the section with alerts off leaves WorkManager uninitialised (on the production scheduler)
  • test action: posts the newest alert, leaves the remembered state untouched, reports unreachable and "no unread"
  • runner: every outcome is recorded with its time; recording changes nothing that is posted

Deliberately left out

  • No widget, no version bump, nothing under .github/.
  • No change to the rules, the worker or the probe. The runner now also writes the last-check record; the evaluateAlerts result is untouched.
  • No "blocked in Android settings" record: the screen asks Android directly.
  • No standby-bucket display (only the battery-optimisation state).
  • The read-only key (VIEWER) is described as "from the Unraid API's source, not yet tried with the background check on a real server".

Shared files (regions touched)

SettingsScreen.kt (one AlertsSection() call between Layout and Updates; SettingRow, Toggle, Segmented made internal), SettingsStore.kt (one alertStates flow), SettingsRepository.kt (three read flows), CHANGELOG.md (end of Added), README.md (feature bullet, new section, privacy bullet), POLICY.md, site/index.html. Not touched: MainViewModel.kt, the tabs, AddEditServerSheet, OverviewTab, ApolloClientFactory, UnraidRepository. Rebased onto main at 3fc9d16 (one conflict in the README privacy list, resolved by keeping both).

Device acceptance (for the maintainer; design section 8)

A0 switch off = no job, no alarm. A1 switch on, "Send test notification" with the read-only key shows a "Test: ..." notification or "No unread alerts or warnings". A2 one NOVA job with the chosen period. A3 forced run updates the last-check line and posts nothing (baseline). A4 tapping the test notification opens that server's notifications. A5 unreachable stays silent, line says so. A6 reboot: no check before unlock, job back after. A7 standby bucket. A8 switch off cancels job and removes notifications. Also: a server with only an http address shows the encryption line and is never contacted. The Android 13+ permission flow (grant, deny, deny twice) needs an Android 14/15 emulator or phone; the Huawei runs Android 9.

Checks

./scripts/local-ci.sh passed on the rebased tree (lint, assemble debug and release, 599 unit tests, 0 failed, 0 skipped).

Closes #321

🤖 Generated with Claude Code

nofuturekid and others added 6 commits November 13, 2026 22:31
The Resume button on a paused container sent the start mutation, which
Docker refuses ("cannot start a paused container, try unpause instead"),
so the container stayed paused. A paused container now gets the existing
UnpauseContainer mutation (docker.unpause, available since API 4.29.0, so
on every supported server and without a capability floor); a stopped
container still gets start.

The choice is made once, in UnraidRepository.startContainer(client, id,
paused), the same seam as restartContainer. The Docker tab row and the
container sheet both go through MainViewModel.startContainer(Container).

The demo follows the repository surface: UnraidGateway.startContainer
takes the same flag, and the demo model refuses start on a paused
container like Docker does, so the demo no longer hides the bug.

Closes #345
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ain http

The foreground clients followed redirects, and OkHttp keeps the x-api-key
header when it does, so a 3xx answer moved the key to whatever Location
named: another host, or http after the user entered https. For the
WebSocket the handshake was followed and the key then went out in
connection_init to the new host.

No client that carries the key follows a redirect any more (ADR-0051).
A redirect is reported as the new reason Redirected, naming the target
origin ("The server redirects to https://... Edit the server and enter
that address."), in the tabs, in the Add server sheet's Test and in the
action message. It is no connection problem, so the pill does not say
Offline. Unraid answers http requests with 302 when SSL is Yes or Strict.

Closes #354

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A key without the permission for an action no longer gets the button for it.
The Docker, VMs and Array tabs and the container, VM and notification sheets
hide Start, Stop, Restart, Update, parity, Archive and Delete controls when the
capability probe says the key lacks DOCKER, VMS, ARRAY or NOTIFICATIONS
UPDATE_ANY / DELETE_ANY, and show one "View only" note that names the missing
permission, with a link to the README table. Unknown access keeps every button
as before, and a refused action now says which permission it needed instead of
"Forbidden resource".

The Add server Test button now uses the capability probe instead of Ping, which
the server answers for any key: a rejected key fails the test, and an accepted
one reports the Unraid and API version and what the key can do. The API Key field
gets a hint and a "Which permissions?" link.

The Overview shows the failure reason of a total failure like the tabs do, and
only a connection problem (unreachable server, rejected key) marks it offline and
hides the needs-attention card.

Closes #315
Closes #316

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ion card with services off

The Containers and Virtual machines cards turned an unknown list (not loaded,
turned off, not allowed, offline) into "0 running", "all healthy" and
"0 configured". They now show the same dash as the other Overview cards; a real
empty list still reads 0. The figures moved into OverviewFigures.kt so they can
be unit-tested.

Regression tests for #356: the Needs attention card stays with VMs or Docker
switched off or forbidden for the key, and the cards render dashes while their
data is unknown. ErrorReasonTest now also classifies the Docker-off answer
through the real Docker query.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Settings, Notifications gets the switch for the background check that
already exists on main (ADR-0048), off by default.

- Switching on opens an explanation, then asks for POST_NOTIFICATIONS on
  Android 13 and later; only a granted answer schedules anything. A
  denial leaves the switch off and shows that Android blocks
  notifications for NOVA, with a button to Android's notification
  settings. The line is re-read when the screen returns to the front.
- Interval (15 minutes to 3 hours), level (alerts and warnings, or
  alerts only) and Wi-Fi only go through AlertScheduler.update, which
  reschedules the existing work. The screen reads only the settings store
  and never asks for WorkManager while alerts are off.
- "Send test notification" runs the same https-only probe once for the
  active server and posts its newest unread alert or warning. It never
  writes the remembered state.
- Each server has a last-check line: the outcome and time are now kept
  in ServerAlertState.lastCheck, set by the check runner after every run
  and read by the screen only; what is notified does not change. A
  server with only http addresses reads "not checked in the background
  because the connection is not encrypted. An https address is needed.";
  the demo server is named as never checked.
- A battery hint and a link to dontkillmyapp.com (opened by the user), and
  a link to the README recipe for instant alerts with Unraid's own agents.

Documents: CHANGELOG, README (feature list and an Alerts section), privacy
policy (what is sent in the background, the https rule, the new
permissions, the alert state), the project site, the store description,
HANDOFF, and an addendum to ADR-0048 for the https and demo rules.

Closes #321

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Settings, Notifications: say so when the user switched off the "Server
  alerts" or "Server warnings" channel (AlertNotifier.blockedChannel, read
  only), with the same button to Android's notification settings.
- Switching alerts off cancels a running test and a test that finishes after
  the switch is off posts nothing.
- Robolectric tests for both.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nofuturekid
nofuturekid force-pushed the feat/alerts-settings-and-permission branch from c577fd9 to 110bddd Compare November 13, 2026 21:43
nofuturekid and others added 2 commits November 13, 2026 22:54
#358 moved the Add server sheet's Test onto the capability probe, whose
failure path never called redirectMessage(): a 3xx answer showed the generic
"Http request failed with status code 302" instead of the sentence ADR-0051
documents. testOutcomeOf now prefers the redirect message when the probe's
failure carries the HTTP exception. Tests: a 302 with a target and one
without go through the real probe; the classifier test no longer claims to
cover Test. ADR-0048's last sentence pointed at in-app clients that follow
redirects; since ADR-0051 they do not.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ADR-0051, decision 4, said that classifyResponse returns the redirect
sentence so the Add server sheet's Test shows it without a change of its
own. Test no longer goes through classifyResponse: testConnection runs
testOutcomeOf(probeCapabilities(...)), and testOutcomeOf prefers the
redirect message of the probe's failure cause. Tabs still get the reason
through classifyErrorReason and toQueryError, and the snackbar of a failed
action gets the lower-cased sentence from checkActionResponse.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@nofuturekid nofuturekid closed this pull request by merging all changes into main in deded38 Nov 13, 2026
@nofuturekid
nofuturekid deleted the feat/alerts-settings-and-permission branch November 13, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decide whether NOVA should alert outside the app, and by which route

1 participant