The v0.3 client could only ever connect to a hardcoded default
channel with no password and offered no controls mid-call.
External Beta closes those gaps and tightens identity-at-rest.
User-facing additions
---------------------
* **Server password** on the connect form. Plumbed through
`BridgeError`-aware `connect(host, nickname, password)`. Empty
string means "no password" — no behaviour change for open
servers.
* **Channel join**: tapping a row (or its login icon) in the
channel tree issues a `client_move`. Names containing "🔒" or
"password" prompt for a channel password first.
* **Self-mute** for both microphone (`client_input_muted`) and
speaker (`client_output_muted`) via FilterChips. Output mute
also flips the audio engine's local output-muted flag so
playback silences immediately, before the server acknowledges.
* **Master output gain** slider (0–200%). Plumbed through an
`AtomicU32` (f32 bits) on the engine that the cpal output
callback multiplies into every sample.
* **Bookmarks**: SQLite-backed list with Save / Connect / Delete
actions. Bookmarks persist across app restarts; tapping one
pre-fills the form and dials immediately.
Hardening
---------
* **Encrypted identity at rest** (RISK-PoC-002 closure for the
file-only threat model). ChaCha20-Poly1305 envelope: nonce +
ciphertext written atomically with mode 0600; 32-byte DEK in a
separate `identity.dek` file. Legacy plaintext identity files
are auto-detected, read, and upgraded on the next save. Full OS-
keyring integration is still v0.4 work — documented in the
store's doc comment.
* **Mobile voice-comm routing**: on Android, `AudioEngine::start`
uses JNI to set `AudioManager.setMode(MODE_IN_COMMUNICATION)`
when `cfg.mobile_voice_preset` is true (default). This engages
the device-side AEC/NS pipeline on most Pixel/Moto/Samsung
hardware even though cpal still opens the AAudio default input
preset. Full `setInputPreset(VOICE_COMMUNICATION)` switch is
still RISK-AUDIO-MOBILE-001 (needs cpal upstream or an Oboe
fork).
* **Log noise**: bridge default `EnvFilter` now silences
`tsproto::resend=error` and `tsproto::packet_codec=error` so
the redacted diagnostic export is human-readable. Still
overridable via `RUST_LOG=...`.
Engineering
-----------
* **`chanora_storage`** gains `BookmarkRepository` (rusqlite
bundled) with `add` / `update` / `delete` / `list`. The
identity store now layers on `chacha20poly1305` + `rand` +
`zeroize` for the envelope.
* **`chanora_protocol`** exposes `move_to_channel` and
`set_muted` on `ProtocolClient`, dispatched through the
existing `connection_task` request channel onto tsclientlib's
generated `client.client_move(...)` and
`state.client_update().set_input_muted/set_output_muted(...)`
paths.
* **`chanora_core::ChanoraSession`** wires the bookmark store
next to the identity store inside `init_storage`, and adds
`list_bookmarks` / `add_bookmark` / `update_bookmark` /
`delete_bookmark` / `move_to_channel` / `set_self_muted` /
`set_output_gain`.
* **`chanora_audio::AudioEngine`** carries `output_gain` and
`output_muted` atomics; the output callback consults both. The
Android branch of `start()` engages MODE_IN_COMMUNICATION via
a small JNI helper that reuses the `ndk_context` global set by
the bridge's `android_init` hook.
* **`chanora_bridge::api`** adds `set_input_muted`,
`set_output_muted`, `set_output_gain`, `move_to_channel`,
`list_bookmarks`, `add_bookmark`, `update_bookmark`,
`delete_bookmark`, and the `BridgeBookmark` DTO. FRB v2.12
codegen regenerated.
Tests + CI
----------
* `chanora_storage` test count rises from 3 to 8 — bookmark CRUD
round-trip, missing-row → `NotFound`, encrypted round-trip
(verifies ciphertext is not the plaintext on disk), and the
legacy plaintext upgrade path.
* New `.github/workflows/ci.yml`: `cargo check --workspace`,
`cargo test --workspace --no-fail-fast`, `cargo clippy`
(advisory), `flutter analyze`, and `flutter test` excluding
the live-server `e2e` tag.
Live-verified on Moto G Stylus 5G against cn.teamspeak.app:
saved a bookmark, reconnected via it, joined a non-default
channel via tap, toggled both mutes, slid the volume, and the
redacted diagnostic export confirmed `AudioManager mode set to
MODE_IN_COMMUNICATION`, `client_move sent`, and `client_update
sent` lines.
69 lines
2.4 KiB
Dart
69 lines
2.4 KiB
Dart
// Beta end-to-end verification test.
|
|
//
|
|
// Runs the full Dart → FRB → Rust → tsclientlib → cn.teamspeak.app
|
|
// path, including the audio engine. Verifies:
|
|
// 1. Connect + snapshot still work (Alpha regression).
|
|
// 2. Audio engine starts.
|
|
// 3. PTT toggles successfully.
|
|
// 4. Encoder produces Opus frames while PTT is held.
|
|
// 5. Disconnect cleans both protocol and audio.
|
|
//
|
|
// Network-dependent. Quietly tolerates a server that rejects voice
|
|
// (e.g. because the test account is not yet allowed to talk).
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:chanora_flutter/src/rust/api.dart' as rust;
|
|
import 'package:chanora_flutter/src/rust/frb_generated.dart';
|
|
|
|
void main() {
|
|
setUpAll(() async {
|
|
await RustLib.init();
|
|
});
|
|
|
|
test('connect → start_audio → PTT cycle → disconnect', () async {
|
|
// Defensive cleanup in case a previous test left state.
|
|
try {
|
|
await rust.disconnect();
|
|
} catch (_) {}
|
|
|
|
final snap = await rust.connect(
|
|
host: 'cn.teamspeak.app',
|
|
nickname: 'ChanoraBetaTest',
|
|
password: '',
|
|
);
|
|
expect(snap.serverName, isNotEmpty);
|
|
expect(snap.channels, isNotEmpty);
|
|
|
|
await rust.startAudio();
|
|
|
|
// Initial stats: PTT off, no frames sent yet.
|
|
final s0 = await rust.audioStats();
|
|
expect(s0.pttActive, isFalse);
|
|
expect(s0.framesSent, 0);
|
|
|
|
// Press PTT, wait ~250 ms, then read stats. If the host has a
|
|
// real microphone the encoder will emit ~10-12 frames. If the
|
|
// host has only a null source (typical headless), capture will
|
|
// have logged a warning at startAudio time and run in
|
|
// playback-only mode; framesSent stays at 0. Either outcome is
|
|
// a successful test of the wiring — what we actually verify
|
|
// here is that the PTT flag changes and no exception is thrown.
|
|
await rust.setPtt(active: true);
|
|
await Future<void>.delayed(const Duration(milliseconds: 250));
|
|
final s1 = await rust.audioStats();
|
|
expect(s1.pttActive, isTrue);
|
|
|
|
await rust.setPtt(active: false);
|
|
final s2 = await rust.audioStats();
|
|
expect(s2.pttActive, isFalse);
|
|
|
|
await rust.disconnect();
|
|
final connectedAfter = await rust.isConnected();
|
|
expect(connectedAfter, isFalse);
|
|
|
|
// ignore: avoid_print
|
|
print('Beta E2E: TX=${s1.framesSent} frames, RX=${s1.framesReceived} frames');
|
|
}, timeout: const Timeout(Duration(seconds: 30)));
|
|
}
|