54fecbb454
The app already had an in-app attention surface but nothing in the system tray. This adds the app's own Android notifications for the two events that need a person: a run waiting for a decision (highest importance) and a run that failed. A successful, running or cancelled run raises nothing. - RunAlerts.kt: the pure model. Maps the attention list's kinds to run alerts, coalesces several into one grouped summary, dedupes one notification per run+kind via AlertLedger (never repeated while the run stays failed or waiting), clears on resolution/dismissal/arrival, and decides the one-time permission prompt and tap destination. Unit-tested. - RunNotifier.kt: the Android edge. Creates the single "Runs that need you" channel, posts/clears through NotificationManagerCompat, and reports notificationsAllowed() from POST_NOTIFICATIONS (API 33+) / the system notification switch. Posted from the app's own process. - Manifest: POST_NOTIFICATIONS runtime permission; PipelinesApplication creates the channel before anything can post. - SettingsRepository/AppViewModel: remembers that the permission was asked once (never nags), keeps notificationsAllowed fresh on resume, feeds the tray from the same attention flow, and clears a run's notification when the operator arrives at it. - PipelinesApp/DecisionPrompt/RunDetailScreen: the one-time rationale before the system dialog, asked at a sensible moment (first run that needs the operator, or first open of the attention surface), degrading to the existing in-app surface on refusal; a waiting run's tap opens its decision sheet (pipelines://run/<id>?action=decide), a failed run's tap opens the run; reaching a run clears its notification. - Attention.kt: drops the Finished kind so a successful run is never announced on any surface (the operator's rule), keeps the deep-link parser (now carrying an optional action) and still decodes an older state's looked-at-finished set. - AttentionTest.kt / RunAlertsTest.kt: the mapping (waiting and failed only), the permission paths (granted, refused, not-yet-asked), coalescing and clearing, dedupe, and the tap destination. Checks: `:app:assembleDebug` and `:app:testDebugUnitTest --rerun-tasks` pass (578 tests, 0 failures). Reflected-where-it-belongs check: this is an android/-only change and the packaged authoring skill references and the packaged templates describe the server's ntfy notification authoring, not the Android app's tray, so none of them needs updating. No README or other shared documentation file was touched.
82 lines
3.9 KiB
XML
82 lines
3.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
|
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
<!--
|
|
POST_NOTIFICATIONS is requested at runtime on Android 13+ (API 33), the
|
|
first time a run actually needs the operator or the attention surface is
|
|
opened, and asked at most once: a refusal degrades to the in-app Needs you
|
|
surface rather than nagging. Runs that need the operator post into the one
|
|
"Runs that need you" channel from the app's own process.
|
|
-->
|
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
|
|
<application
|
|
android:allowBackup="true"
|
|
android:enableOnBackInvokedCallback="true"
|
|
android:name=".PipelinesApplication"
|
|
android:icon="@drawable/ic_launcher"
|
|
android:label="@string/app_name"
|
|
android:supportsRtl="true"
|
|
android:theme="@style/Theme.Pipelines"
|
|
android:usesCleartextTraffic="true">
|
|
<!--
|
|
usesCleartextTraffic is required because the Pipelines server speaks
|
|
unencrypted ws:// on a trusted LAN/VPN. It is deliberately broad because
|
|
the user types an arbitrary host. Do not expose the server to the internet.
|
|
-->
|
|
<!--
|
|
adjustResize: the app is drawn edge-to-edge (enableEdgeToEdge), so it
|
|
reads the IME from the Compose window insets (paneSafeArea /
|
|
WindowInsets.safeDrawing) and applies it once in the surface that owns
|
|
it. Both the omni-search field and the chat composer (imePadding) sit
|
|
directly above the keyboard. This is the mode the chat UI was reviewed
|
|
with; re-check that composer before changing it to adjustNothing.
|
|
-->
|
|
<activity
|
|
android:name=".MainActivity"
|
|
android:exported="true"
|
|
android:label="@string/app_name"
|
|
android:launchMode="singleTop"
|
|
android:theme="@style/Theme.Pipelines"
|
|
android:windowSoftInputMode="adjustResize">
|
|
<intent-filter>
|
|
<action android:name="android.intent.action.MAIN" />
|
|
<category android:name="android.intent.category.LAUNCHER" />
|
|
</intent-filter>
|
|
<!--
|
|
The notification click action opens the run it names. The server
|
|
publishes `pipelines://run/<id>` as the ntfy Click URL, so a tap on
|
|
the phone's own notification resolves here rather than to a browser.
|
|
This is the app's one deep link and it only opens a run; it starts
|
|
nothing.
|
|
-->
|
|
<intent-filter>
|
|
<action android:name="android.intent.action.VIEW" />
|
|
<category android:name="android.intent.category.DEFAULT" />
|
|
<category android:name="android.intent.category.BROWSABLE" />
|
|
<data android:scheme="pipelines" android:host="run" />
|
|
</intent-filter>
|
|
</activity>
|
|
|
|
<!--
|
|
The only exported-URI surface: fetched artifacts are shared out of
|
|
the app cache through ACTION_SEND. The provider is not exported
|
|
and grants read access per-uri (FLAG_GRANT_READ_URI_PERMISSION), and
|
|
file_paths.xml scopes it to the single `shared-artifacts` cache
|
|
subdirectory. No other app-visible file path is exposed.
|
|
-->
|
|
<provider
|
|
android:name="androidx.core.content.FileProvider"
|
|
android:authorities="${applicationId}.fileprovider"
|
|
android:exported="false"
|
|
android:grantUriPermissions="true">
|
|
<meta-data
|
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
|
android:resource="@xml/file_paths" />
|
|
</provider>
|
|
</application>
|
|
|
|
</manifest>
|