Commit graph onionwire/android/app
Author SHA1 Message Date
agent
7cf98bb9fe
feat(android): wallet screen and SDK payment surface
Some checks failed
ci / test (pull_request) Failing after 4m1s
ci / sdk (pull_request) Successful in 1m27s
Expose wallet balance/address/transfers plus one-shot invoice and tip on
the UniFFI SDK. Wire a Compose wallet route (QR, composers) without dropping
wipe-chat. Ignore machine-local android/.cargo NDK paths.
2026-09-13 15:27:57 -04:00
t
fc2b2197c7
feat(android): chat row renders queued (try 3/8, retry 45s) from the SDK's outbox rows
All checks were successful
ci / test (pull_request) Successful in 3m55s
ci / sdk (pull_request) Successful in 1m2s
Consumes the SDK surface from PR #58 (`Wire.outbox(pubkeyHex)` →
`OutboxRow { messageId, status, attempts, nextAttemptAt, lastError }` and
`outboxMaxAttempts()`): a queued chat row now says *why* it is still queued
instead of a flat `queued`.

* `OutboxDetail.kt` — `retryInText` mirrors `src/tui.rs::retry_in_text`
  (`<= 0` → `retry now`; `< 60` → `retry {n}s`; else `retry {ceil-minutes}m`),
  and `outboxDetails` joins the SDK's rows onto the chat rows. The denominator
  is the core's `outboxMaxAttempts()`/`Rust` budget, fetched once — never 8.
* A terminal `"failed"` row keeps the marker's own `failed: <reason>` and gets
  **no** countdown: `nextAttemptAt` on a failed row is the last time it was
  scheduled for, so a countdown there would promise an attempt that never comes.
  `"sending"` stays bare, matching the TUI.
* `ChatScreen` polls the outbox rows on the same 2s cadence as the bodies and
  renders the countdown against an injectable `nowSeconds` (the store holds an
  absolute instant, the app computes the age).
* The join is positional — `ChatMessage` carries no `messages.id` — and
  fail-closed: mismatched row counts, an unknown status, or a status that
  contradicts the one the SDK resolved for that message drops every detail and
  leaves the flat markers. `ChatMessage.id` would remove the positional part;
  filed as follow-up.
* `OutboxDetailTest` (17 tests) asserts the three `retry_in_text` buckets, the
  `queued (try 3/8, retry 45s)` wording, that a failed row shows no countdown,
  that the denominator comes from the caller, and the three fail-closed cases.
  32 unit tests, 0 failures.

Android base: PR #56 (`feat/android-outbox-state`, t_f46a9863) — the Android
half of the #52/#56 duplicate pair, which is not merged here. SDK base: PR #58
on PR #51.
2026-09-12 19:16:45 -04:00
apk-dev
c4b824a83d
feat(android): surface outbox delivery state in chat
Renders the core's own Queued/Sending/Sent/Failed per outgoing row instead of
implying a message either sent or did not: a clock for queued, a progress
spinner for sending, a double-check for delivered and an error marker with the
short reason for a terminal failure, plus a chat-level `N queued` footer that
keeps a fail-closed `send failed: <reason>` statement on screen.

States are read verbatim from ChatMessage.delivery (Node::outbox_status_of_message
over UniFFI) — no parallel enum, nothing guessed from a timeout. A missing or
unrecognised status renders as queued, never delivered.

WireViewModel.send() now returns the SDK SendState instead of dropping it, so the
composer can say a send is queued rather than pretend it landed, and the empty-chat
copy no longer claims 'there is no outbox in v1'.

Accessibility: every marker carries an explicit contentDescription sentence and a
test tag; the glyph is never what a screen reader announces.
2026-09-12 19:16:44 -04:00
apk-dev
e923e06891
feat(android): keep the onion published through Doze with a foreground service
WireViewModel owned the single Wire node and called shutdown() from
onCleared(), so a backgrounded node died with the UI. Node lifetime is now
arbitrated by a pure policy (NodeLifetime) with two anchors — UI and
keep-alive — and one process-wide owner (NodeHost) that is the only caller
of flush()/shutdown() in the app.

KeepAliveService holds the process in the foreground behind an ongoing
notification from the "keep-alive" channel, started on unlock and stopped
by Lock or the notification action, so peers can still reach the device
while the screen is off.

- foregroundServiceType="specialUse": dataSync is documented as a finite
  transfer (upload/download/backup) and this is an always-on node
- POST_NOTIFICATIONS requested when the node becomes reachable; denial
  keeps the service running with no visible notice instead of failing
- re-unlock with a node the service kept alive adopts it rather than
  reopening the store the live node still holds
- 9 device-free unit tests for the start/stop/re-unlock state machine
2026-09-12 16:34:40 -04:00
apk-dev
c068e292a0
feat(android): stop the node when the UI goes away
`WireViewModel.lock()` set `wire = null` and `onCleared()` did not exist at all,
so neither the user pressing Lock nor the Activity finishing stopped anything:
Arti kept its client and the hosted onion service, the outbox worker kept
dialing, and the sqlite connection stayed open behind the JNI handle.

Both paths now go through `stopNode(Wire)`:

1. `flush()` — one last bounded drain, so a queued message gets its chance
   before the process may lose its socket.
2. `shutdown()` — drain again with a shorter budget, stop the onion service,
   abort the retry worker, checkpoint the WAL, and take the node handle out of
   the `Wire` (which is what releases the last Arc to the Tor client and the
   store).

Both run on a process-scoped `TEARDOWN` scope (`SupervisorJob` + `Dispatchers.IO`)
because `onCleared()` runs *after* `viewModelScope` is already cancelled. Errors
are deliberately swallowed there: the UI is gone, and the SDK reports a second
teardown as the typed `WireException.Stopped` rather than a panic.

`unlock()` joins any in-flight teardown before opening again. The old node holds
the sqlite file and Arti's state lock until its teardown returns, and racing it
makes the next `openWire` fail.

A process killed outright (Doze, background-process killer, force-stop) still
never runs any of this — that is what the sqlite outbox and the new `flush()`
are for. The foreground-service card (`t_5bf32cd3`) moves this ownership from
the ViewModel to the service.
2026-09-12 15:10:29 -04:00
Sirius DevOps
2fd640e230
feat(android): wrap the store passphrase in the Android Keystore
Typing the passphrase on every launch was the v1 posture. It stays the
fallback, but it is no longer required: on first unlock the passphrase can be
remembered (checkbox, on by default) and is stored as an AES-256-GCM blob
wrapped by a key that never leaves the Android Keystore.

- crypto/StoreSecret.kt: the OWSEAL1 envelope (magic + IV + ciphertext + GCM
  tag) and the wipe helpers. No android.* imports, so the code that runs on a
  device is the code the unit tests exercise, with a JVM AES key standing in
  for the Keystore key.
- crypto/KeystorePassphraseCipher.kt: AES-256-GCM key under alias
  `onionwire.store`, StrongBox requested first (API 28+) with a graceful
  fallback on ProviderException (StrongBoxUnavailableException is one), and an
  honest KeyInfo-backed report of where the key actually lives.
  setUserAuthenticationRequired(false) stays the default on purpose.
- crypto/StoredPassphraseStore.kt: ciphertext only, at
  filesDir/secrets/store-passphrase.bin, written tmp+rename. A failed decrypt
  reports Unavailable and does NOT delete the blob.
- WireViewModel: unlock(passphrase, remember), unlockStored(),
  forgetStoredPassphrase(); the secret CharArray is zeroed in `finally`; the
  Keystore probe runs off the main thread at ViewModel construction.
- UnlockScreen: one-tap when a stored blob exists, the typed passphrase is
  dropped from Compose state as soon as it is handed over and is never put in
  saved instance state; "Forget stored passphrase" deletes blob and key.
- androidTest: the device-only half (AndroidKeyStore, StrongBox, KeyInfo),
  which cannot run in the unit-test JVM.

Verified: ./gradlew :app:assembleDebug and :app:testDebugUnitTest green,
25 tests / 0 failures (11 new StoreSecretTest, 9 new StoredPassphraseStoreTest).
2026-09-12 13:55:07 -04:00
Sirius DevOps
1c4aaefb01
feat(android): auto-publish signed APK and AAR from CI
Some checks failed
ci / test (pull_request) Failing after 3m13s
Push to main that touches android/** builds a release APK + SDK AAR on
docker-amd64, verifies size/ABI/signature, and create-or-joins the Forgejo
release. Version is latest v*.*.* patch+1, or v0.1.0 when there are no tags.
Release signing uses repo secrets (ANDROID_KEYSTORE_*), not the debug key.
2026-09-12 00:54:17 -04:00
Sirius DevOps
f6ac5ea738
fix(android): Approve & add no-op from shared Compose busy flag
All checks were successful
ci / test (pull_request) Successful in 2m32s
PasteInviteScreen drove Verify and Approve from one busy boolean plus
LaunchedEffect(busy). Tapping Approve relaunched decode, which cleared
busy and cancelled add — so the roster never updated.

Extract InviteAddFlow with separate verifying/adding flags and launch
each action from its click handler. Unit tests were red against the
shared-busy state machine (4/5 failed) and green after the split (5/5).
2026-09-11 21:57:21 -04:00
apk-dev
672f2c9990
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
All checks were successful
ci / test (pull_request) Successful in 3m22s
Adds the Android product alongside the existing Linux TUI, in one repo.

SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).

android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.

Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.

Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00