feat(beta): External Beta — passwords, channel join, mute, bookmarks, encrypted identity
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.
This commit is contained in:
@@ -8,6 +8,10 @@
|
||||
|
||||
"fieldServerHost": "Server address",
|
||||
"fieldNickname": "Nickname",
|
||||
"fieldServerPassword": "Server password",
|
||||
"fieldServerPasswordHelp": "Leave blank if the server does not require one.",
|
||||
"fieldPassword": "Password",
|
||||
"fieldDisplayName": "Display name",
|
||||
|
||||
"connectAction": "Connect",
|
||||
"disconnectAction": "Disconnect",
|
||||
@@ -18,6 +22,17 @@
|
||||
"startAudioAction": "Start audio",
|
||||
"pttHoldToTalk": "Hold to talk",
|
||||
"pttTransmitting": "Transmitting…",
|
||||
"inputMuteAction": "Mute mic",
|
||||
"inputUnmuteAction": "Unmute mic",
|
||||
"outputMuteAction": "Mute speaker",
|
||||
"outputUnmuteAction": "Unmute speaker",
|
||||
"joinChannelAction": "Join channel",
|
||||
"channelPasswordTitle": "Channel password",
|
||||
"bookmarksHeading": "Bookmarks",
|
||||
"bookmarksEmpty": "No bookmarks yet. Enter a server above and tap \"Save bookmark\".",
|
||||
"bookmarkAddAction": "Save bookmark",
|
||||
"bookmarkAddTitle": "Save bookmark",
|
||||
"bookmarkDeleteAction": "Delete bookmark",
|
||||
|
||||
"statusIdle": "Not connected",
|
||||
"statusConnecting": "Connecting…",
|
||||
|
||||
@@ -7,6 +7,10 @@
|
||||
|
||||
"fieldServerHost": "服务器地址",
|
||||
"fieldNickname": "昵称",
|
||||
"fieldServerPassword": "服务器密码",
|
||||
"fieldServerPasswordHelp": "如果服务器无需密码,留空即可。",
|
||||
"fieldPassword": "密码",
|
||||
"fieldDisplayName": "显示名称",
|
||||
|
||||
"connectAction": "连接",
|
||||
"disconnectAction": "断开连接",
|
||||
@@ -17,6 +21,17 @@
|
||||
"startAudioAction": "启动语音",
|
||||
"pttHoldToTalk": "按住说话",
|
||||
"pttTransmitting": "正在发送…",
|
||||
"inputMuteAction": "静音麦克风",
|
||||
"inputUnmuteAction": "取消麦克风静音",
|
||||
"outputMuteAction": "静音扬声器",
|
||||
"outputUnmuteAction": "取消扬声器静音",
|
||||
"joinChannelAction": "加入频道",
|
||||
"channelPasswordTitle": "频道密码",
|
||||
"bookmarksHeading": "书签",
|
||||
"bookmarksEmpty": "尚无书签。先在上方填写服务器,然后点击“保存书签”。",
|
||||
"bookmarkAddAction": "保存书签",
|
||||
"bookmarkAddTitle": "保存书签",
|
||||
"bookmarkDeleteAction": "删除书签",
|
||||
|
||||
"statusIdle": "未连接",
|
||||
"statusConnecting": "正在连接…",
|
||||
|
||||
@@ -121,6 +121,30 @@ abstract class AppL10n {
|
||||
/// **'Nickname'**
|
||||
String get fieldNickname;
|
||||
|
||||
/// No description provided for @fieldServerPassword.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Server password'**
|
||||
String get fieldServerPassword;
|
||||
|
||||
/// No description provided for @fieldServerPasswordHelp.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Leave blank if the server does not require one.'**
|
||||
String get fieldServerPasswordHelp;
|
||||
|
||||
/// No description provided for @fieldPassword.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Password'**
|
||||
String get fieldPassword;
|
||||
|
||||
/// No description provided for @fieldDisplayName.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Display name'**
|
||||
String get fieldDisplayName;
|
||||
|
||||
/// No description provided for @connectAction.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
@@ -175,6 +199,72 @@ abstract class AppL10n {
|
||||
/// **'Transmitting…'**
|
||||
String get pttTransmitting;
|
||||
|
||||
/// No description provided for @inputMuteAction.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Mute mic'**
|
||||
String get inputMuteAction;
|
||||
|
||||
/// No description provided for @inputUnmuteAction.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Unmute mic'**
|
||||
String get inputUnmuteAction;
|
||||
|
||||
/// No description provided for @outputMuteAction.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Mute speaker'**
|
||||
String get outputMuteAction;
|
||||
|
||||
/// No description provided for @outputUnmuteAction.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Unmute speaker'**
|
||||
String get outputUnmuteAction;
|
||||
|
||||
/// No description provided for @joinChannelAction.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Join channel'**
|
||||
String get joinChannelAction;
|
||||
|
||||
/// No description provided for @channelPasswordTitle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Channel password'**
|
||||
String get channelPasswordTitle;
|
||||
|
||||
/// No description provided for @bookmarksHeading.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Bookmarks'**
|
||||
String get bookmarksHeading;
|
||||
|
||||
/// No description provided for @bookmarksEmpty.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'No bookmarks yet. Enter a server above and tap \"Save bookmark\".'**
|
||||
String get bookmarksEmpty;
|
||||
|
||||
/// No description provided for @bookmarkAddAction.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Save bookmark'**
|
||||
String get bookmarkAddAction;
|
||||
|
||||
/// No description provided for @bookmarkAddTitle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Save bookmark'**
|
||||
String get bookmarkAddTitle;
|
||||
|
||||
/// No description provided for @bookmarkDeleteAction.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Delete bookmark'**
|
||||
String get bookmarkDeleteAction;
|
||||
|
||||
/// No description provided for @statusIdle.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
|
||||
@@ -21,6 +21,19 @@ class AppL10nEn extends AppL10n {
|
||||
@override
|
||||
String get fieldNickname => 'Nickname';
|
||||
|
||||
@override
|
||||
String get fieldServerPassword => 'Server password';
|
||||
|
||||
@override
|
||||
String get fieldServerPasswordHelp =>
|
||||
'Leave blank if the server does not require one.';
|
||||
|
||||
@override
|
||||
String get fieldPassword => 'Password';
|
||||
|
||||
@override
|
||||
String get fieldDisplayName => 'Display name';
|
||||
|
||||
@override
|
||||
String get connectAction => 'Connect';
|
||||
|
||||
@@ -48,6 +61,40 @@ class AppL10nEn extends AppL10n {
|
||||
@override
|
||||
String get pttTransmitting => 'Transmitting…';
|
||||
|
||||
@override
|
||||
String get inputMuteAction => 'Mute mic';
|
||||
|
||||
@override
|
||||
String get inputUnmuteAction => 'Unmute mic';
|
||||
|
||||
@override
|
||||
String get outputMuteAction => 'Mute speaker';
|
||||
|
||||
@override
|
||||
String get outputUnmuteAction => 'Unmute speaker';
|
||||
|
||||
@override
|
||||
String get joinChannelAction => 'Join channel';
|
||||
|
||||
@override
|
||||
String get channelPasswordTitle => 'Channel password';
|
||||
|
||||
@override
|
||||
String get bookmarksHeading => 'Bookmarks';
|
||||
|
||||
@override
|
||||
String get bookmarksEmpty =>
|
||||
'No bookmarks yet. Enter a server above and tap \"Save bookmark\".';
|
||||
|
||||
@override
|
||||
String get bookmarkAddAction => 'Save bookmark';
|
||||
|
||||
@override
|
||||
String get bookmarkAddTitle => 'Save bookmark';
|
||||
|
||||
@override
|
||||
String get bookmarkDeleteAction => 'Delete bookmark';
|
||||
|
||||
@override
|
||||
String get statusIdle => 'Not connected';
|
||||
|
||||
|
||||
@@ -20,6 +20,18 @@ class AppL10nZh extends AppL10n {
|
||||
@override
|
||||
String get fieldNickname => '昵称';
|
||||
|
||||
@override
|
||||
String get fieldServerPassword => '服务器密码';
|
||||
|
||||
@override
|
||||
String get fieldServerPasswordHelp => '如果服务器无需密码,留空即可。';
|
||||
|
||||
@override
|
||||
String get fieldPassword => '密码';
|
||||
|
||||
@override
|
||||
String get fieldDisplayName => '显示名称';
|
||||
|
||||
@override
|
||||
String get connectAction => '连接';
|
||||
|
||||
@@ -47,6 +59,39 @@ class AppL10nZh extends AppL10n {
|
||||
@override
|
||||
String get pttTransmitting => '正在发送…';
|
||||
|
||||
@override
|
||||
String get inputMuteAction => '静音麦克风';
|
||||
|
||||
@override
|
||||
String get inputUnmuteAction => '取消麦克风静音';
|
||||
|
||||
@override
|
||||
String get outputMuteAction => '静音扬声器';
|
||||
|
||||
@override
|
||||
String get outputUnmuteAction => '取消扬声器静音';
|
||||
|
||||
@override
|
||||
String get joinChannelAction => '加入频道';
|
||||
|
||||
@override
|
||||
String get channelPasswordTitle => '频道密码';
|
||||
|
||||
@override
|
||||
String get bookmarksHeading => '书签';
|
||||
|
||||
@override
|
||||
String get bookmarksEmpty => '尚无书签。先在上方填写服务器,然后点击“保存书签”。';
|
||||
|
||||
@override
|
||||
String get bookmarkAddAction => '保存书签';
|
||||
|
||||
@override
|
||||
String get bookmarkAddTitle => '保存书签';
|
||||
|
||||
@override
|
||||
String get bookmarkDeleteAction => '删除书签';
|
||||
|
||||
@override
|
||||
String get statusIdle => '未连接';
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
// Chanora Flutter application — Beta build (v0.2.0-beta.1).
|
||||
// Chanora Flutter application — External Beta build.
|
||||
//
|
||||
// Adds voice in/out via push-to-talk on top of the Alpha UI:
|
||||
// 1. Connect form + channel/client tree (Alpha)
|
||||
// 2. "Start audio" button after connect → opens the audio engine
|
||||
// 3. Push-to-talk button: hold to transmit, release to stop
|
||||
// 4. Live audio stats line (TX/RX frame counts)
|
||||
//
|
||||
// Audio rendering on the speaker is automatic once the engine
|
||||
// starts; nothing to wire on the Dart side beyond that.
|
||||
// Builds on Internal Beta v0.3.0-beta.1:
|
||||
// * server password field
|
||||
// * bookmark list with add / connect / delete actions
|
||||
// * channel tap-to-join with optional channel password
|
||||
// * self input + output mute toggles + master output gain slider
|
||||
// * diagnostics dialog + reconnect banner + identity persistence
|
||||
// (all carried over from v0.3.0-beta.1)
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
@@ -23,13 +22,7 @@ import 'src/rust/frb_generated.dart';
|
||||
Future<void> main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await RustLib.init();
|
||||
// A.2 — wire identity persistence to the platform's app-private
|
||||
// directory so the same TS3 UID is presented on every restart.
|
||||
// Beta: stored as a plain 0600 file (RISK-PoC-002).
|
||||
unawaited(_wireStorage());
|
||||
// A.6.1 — push the OS-reported connectivity state into the core
|
||||
// supervisor so reconnects redial promptly when the network
|
||||
// returns.
|
||||
unawaited(_wireConnectivity());
|
||||
runApp(const ChanoraApp());
|
||||
}
|
||||
@@ -39,15 +32,11 @@ Future<void> _wireStorage() async {
|
||||
final dir = await getApplicationSupportDirectory();
|
||||
await rust.initStorage(dir: dir.path);
|
||||
} catch (_) {
|
||||
// Storage is best-effort — on failure the app still works but
|
||||
// each session gets a fresh ephemeral identity.
|
||||
// Best-effort; missing storage just means no identity persistence
|
||||
// and no bookmark list this session.
|
||||
}
|
||||
}
|
||||
|
||||
/// Map `connectivity_plus`' list-of-results to our coarse tri-state.
|
||||
/// We consider the device "Online" if any of the reported transports
|
||||
/// is non-`none`. This is intentionally permissive — the supervisor's
|
||||
/// watchdog still verifies reachability against the actual server.
|
||||
rust.BridgeNetworkState _mapConnectivity(List<ConnectivityResult> results) {
|
||||
if (results.isEmpty) return rust.BridgeNetworkState.unknown;
|
||||
final allNone = results.every((r) => r == ConnectivityResult.none);
|
||||
@@ -57,16 +46,10 @@ rust.BridgeNetworkState _mapConnectivity(List<ConnectivityResult> results) {
|
||||
|
||||
Future<void> _wireConnectivity() async {
|
||||
final connectivity = Connectivity();
|
||||
// Seed with the current value so the supervisor has a real reading
|
||||
// before the first transition.
|
||||
try {
|
||||
final initial = await connectivity.checkConnectivity();
|
||||
rust.setNetworkState(state: _mapConnectivity(initial));
|
||||
} catch (_) {
|
||||
// Best effort; if the plugin isn't available on this platform
|
||||
// we stay at Unknown and the supervisor falls back to its
|
||||
// watchdog-only behaviour.
|
||||
}
|
||||
} catch (_) {}
|
||||
connectivity.onConnectivityChanged.listen((results) {
|
||||
rust.setNetworkState(state: _mapConnectivity(results));
|
||||
});
|
||||
@@ -102,6 +85,7 @@ class _BetaHome extends StatefulWidget {
|
||||
class _BetaHomeState extends State<_BetaHome> {
|
||||
final _hostCtl = TextEditingController(text: 'cn.teamspeak.app');
|
||||
final _nickCtl = TextEditingController(text: 'ChanoraBeta');
|
||||
final _passwordCtl = TextEditingController();
|
||||
|
||||
_Phase _phase = _Phase.idle;
|
||||
rust.BridgeSnapshot? _snapshot;
|
||||
@@ -111,15 +95,31 @@ class _BetaHomeState extends State<_BetaHome> {
|
||||
Timer? _statsTimer;
|
||||
StreamSubscription<rust.BridgeEvent>? _eventsSub;
|
||||
|
||||
// A.6 reconnect banner state.
|
||||
String? _lostReason;
|
||||
int? _reconnectAttempt;
|
||||
int? _reconnectDelay;
|
||||
|
||||
bool _inputMuted = false;
|
||||
bool _outputMuted = false;
|
||||
double _outputGain = 1.0;
|
||||
|
||||
List<rust.BridgeBookmark> _bookmarks = const [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_eventsSub = rust.eventsStream().listen(_onEvent);
|
||||
unawaited(_reloadBookmarks());
|
||||
}
|
||||
|
||||
Future<void> _reloadBookmarks() async {
|
||||
try {
|
||||
final list = await rust.listBookmarks();
|
||||
if (!mounted) return;
|
||||
setState(() => _bookmarks = list);
|
||||
} catch (_) {
|
||||
// Bookmark store missing on this platform — empty list is fine.
|
||||
}
|
||||
}
|
||||
|
||||
void _onEvent(rust.BridgeEvent evt) {
|
||||
@@ -155,10 +155,6 @@ class _BetaHomeState extends State<_BetaHome> {
|
||||
case rust.BridgeEvent_AudioStopped():
|
||||
setState(() => _audioStarted = false);
|
||||
case rust.BridgeEvent_SnapshotChanged():
|
||||
// A.4: the supervisor's watchdog observed a tree change.
|
||||
// Trigger a single async refresh so the channel/client
|
||||
// list stays current without a polling timer on the Dart
|
||||
// side.
|
||||
unawaited(_onRefresh());
|
||||
}
|
||||
}
|
||||
@@ -169,10 +165,15 @@ class _BetaHomeState extends State<_BetaHome> {
|
||||
_statsTimer?.cancel();
|
||||
_hostCtl.dispose();
|
||||
_nickCtl.dispose();
|
||||
_passwordCtl.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> _onConnect() async {
|
||||
Future<void> _onConnect({
|
||||
String? host,
|
||||
String? nickname,
|
||||
String? password,
|
||||
}) async {
|
||||
setState(() {
|
||||
_phase = _Phase.connecting;
|
||||
_error = null;
|
||||
@@ -180,8 +181,9 @@ class _BetaHomeState extends State<_BetaHome> {
|
||||
});
|
||||
try {
|
||||
final snap = await rust.connect(
|
||||
host: _hostCtl.text.trim(),
|
||||
nickname: _nickCtl.text.trim(),
|
||||
host: (host ?? _hostCtl.text).trim(),
|
||||
nickname: (nickname ?? _nickCtl.text).trim(),
|
||||
password: password ?? _passwordCtl.text,
|
||||
);
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
@@ -225,6 +227,87 @@ class _BetaHomeState extends State<_BetaHome> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _toggleInputMute() async {
|
||||
final next = !_inputMuted;
|
||||
try {
|
||||
await rust.setInputMuted(muted: next);
|
||||
if (!mounted) return;
|
||||
setState(() => _inputMuted = next);
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
setState(() => _error = e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _toggleOutputMute() async {
|
||||
final next = !_outputMuted;
|
||||
try {
|
||||
await rust.setOutputMuted(muted: next);
|
||||
if (!mounted) return;
|
||||
setState(() => _outputMuted = next);
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
setState(() => _error = e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _setOutputGain(double value) async {
|
||||
setState(() => _outputGain = value);
|
||||
try {
|
||||
await rust.setOutputGain(gain: value);
|
||||
} catch (_) {
|
||||
// Audio may not be started yet — that's fine; the next start_audio
|
||||
// picks up the current slider position next time we plumb it.
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onJoinChannel(rust.BridgeChannel ch) async {
|
||||
final l10n = AppL10n.of(context);
|
||||
String? password;
|
||||
// Heuristic: a channel name annotated with a lock prompts.
|
||||
if (ch.name.contains('🔒') || ch.name.toLowerCase().contains('password')) {
|
||||
password = await _askChannelPassword(l10n);
|
||||
if (password == null) return; // cancelled
|
||||
}
|
||||
try {
|
||||
await rust.moveToChannel(
|
||||
channelId: ch.id,
|
||||
password: password ?? '',
|
||||
);
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
setState(() => _error = e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Future<String?> _askChannelPassword(AppL10n l10n) async {
|
||||
final ctl = TextEditingController();
|
||||
final result = await showDialog<String>(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text(l10n.channelPasswordTitle),
|
||||
content: TextField(
|
||||
controller: ctl,
|
||||
obscureText: true,
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(labelText: l10n.fieldPassword),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: Text(l10n.closeAction),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(ctl.text),
|
||||
child: Text(l10n.connectAction),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
ctl.dispose();
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<void> _onRefresh() async {
|
||||
try {
|
||||
final snap = await rust.snapshot();
|
||||
@@ -249,12 +332,12 @@ class _BetaHomeState extends State<_BetaHome> {
|
||||
_audioStarted = false;
|
||||
_audioStats = null;
|
||||
_error = null;
|
||||
_inputMuted = false;
|
||||
_outputMuted = false;
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _onShowDiagnostics(BuildContext context) async {
|
||||
// A.3: user-initiated diagnostic export (DEC-016). Content is
|
||||
// already redacted on the Rust side; we just present it.
|
||||
final l10n = AppL10n.of(context);
|
||||
final text = rust.exportDiagnostics();
|
||||
if (!mounted) return;
|
||||
@@ -286,6 +369,70 @@ class _BetaHomeState extends State<_BetaHome> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _onAddCurrentBookmark() async {
|
||||
final l10n = AppL10n.of(context);
|
||||
final nameCtl = TextEditingController(text: _hostCtl.text.trim());
|
||||
final name = await showDialog<String>(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text(l10n.bookmarkAddTitle),
|
||||
content: TextField(
|
||||
controller: nameCtl,
|
||||
autofocus: true,
|
||||
decoration: InputDecoration(labelText: l10n.fieldDisplayName),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: Text(l10n.closeAction),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(nameCtl.text),
|
||||
child: Text(l10n.bookmarkAddAction),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
nameCtl.dispose();
|
||||
if (name == null || name.trim().isEmpty) return;
|
||||
try {
|
||||
await rust.addBookmark(
|
||||
b: rust.BridgeBookmark(
|
||||
id: 0,
|
||||
displayName: name.trim(),
|
||||
host: _hostCtl.text.trim(),
|
||||
nickname: _nickCtl.text.trim(),
|
||||
password: _passwordCtl.text,
|
||||
),
|
||||
);
|
||||
await _reloadBookmarks();
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
setState(() => _error = e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onDeleteBookmark(rust.BridgeBookmark b) async {
|
||||
try {
|
||||
await rust.deleteBookmark(id: b.id);
|
||||
await _reloadBookmarks();
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
setState(() => _error = e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onUseBookmark(rust.BridgeBookmark b) async {
|
||||
_hostCtl.text = b.host;
|
||||
_nickCtl.text = b.nickname;
|
||||
_passwordCtl.text = b.password;
|
||||
await _onConnect(
|
||||
host: b.host,
|
||||
nickname: b.nickname,
|
||||
password: b.password,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppL10n.of(context);
|
||||
@@ -381,10 +528,27 @@ class _BetaHomeState extends State<_BetaHome> {
|
||||
],
|
||||
const SizedBox(height: 12),
|
||||
if (_phase == _Phase.idle) ...[
|
||||
_ConnectForm(
|
||||
hostCtl: _hostCtl,
|
||||
nickCtl: _nickCtl,
|
||||
onConnect: _onConnect,
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
_ConnectForm(
|
||||
hostCtl: _hostCtl,
|
||||
nickCtl: _nickCtl,
|
||||
passwordCtl: _passwordCtl,
|
||||
onConnect: () => _onConnect(),
|
||||
onAddBookmark: _onAddCurrentBookmark,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_BookmarkList(
|
||||
bookmarks: _bookmarks,
|
||||
onConnect: _onUseBookmark,
|
||||
onDelete: _onDeleteBookmark,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
] else if (_phase == _Phase.connecting) ...[
|
||||
const Center(
|
||||
@@ -394,7 +558,6 @@ class _BetaHomeState extends State<_BetaHome> {
|
||||
),
|
||||
),
|
||||
] else if (_phase == _Phase.connected && _snapshot != null) ...[
|
||||
// Audio row: start button or stats + PTT.
|
||||
if (!_audioStarted) ...[
|
||||
FilledButton.icon(
|
||||
icon: const Icon(Icons.mic_none),
|
||||
@@ -405,12 +568,23 @@ class _BetaHomeState extends State<_BetaHome> {
|
||||
] else ...[
|
||||
_AudioControls(
|
||||
stats: _audioStats,
|
||||
inputMuted: _inputMuted,
|
||||
outputMuted: _outputMuted,
|
||||
outputGain: _outputGain,
|
||||
onPttDown: () => _setPtt(true),
|
||||
onPttUp: () => _setPtt(false),
|
||||
onToggleInputMute: _toggleInputMute,
|
||||
onToggleOutputMute: _toggleOutputMute,
|
||||
onGainChanged: _setOutputGain,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
Expanded(child: _SnapshotView(snapshot: _snapshot!)),
|
||||
Expanded(
|
||||
child: _SnapshotView(
|
||||
snapshot: _snapshot!,
|
||||
onJoinChannel: _onJoinChannel,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
@@ -423,12 +597,16 @@ class _ConnectForm extends StatelessWidget {
|
||||
const _ConnectForm({
|
||||
required this.hostCtl,
|
||||
required this.nickCtl,
|
||||
required this.passwordCtl,
|
||||
required this.onConnect,
|
||||
required this.onAddBookmark,
|
||||
});
|
||||
|
||||
final TextEditingController hostCtl;
|
||||
final TextEditingController nickCtl;
|
||||
final TextEditingController passwordCtl;
|
||||
final VoidCallback onConnect;
|
||||
final VoidCallback onAddBookmark;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -451,12 +629,91 @@ class _ConnectForm extends StatelessWidget {
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
FilledButton.icon(
|
||||
icon: const Icon(Icons.login),
|
||||
label: Text(l10n.connectAction),
|
||||
onPressed: onConnect,
|
||||
const SizedBox(height: 8),
|
||||
TextField(
|
||||
controller: passwordCtl,
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: l10n.fieldServerPassword,
|
||||
helperText: l10n.fieldServerPasswordHelp,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: FilledButton.icon(
|
||||
icon: const Icon(Icons.login),
|
||||
label: Text(l10n.connectAction),
|
||||
onPressed: onConnect,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
OutlinedButton.icon(
|
||||
icon: const Icon(Icons.bookmark_add_outlined),
|
||||
label: Text(l10n.bookmarkAddAction),
|
||||
onPressed: onAddBookmark,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _BookmarkList extends StatelessWidget {
|
||||
const _BookmarkList({
|
||||
required this.bookmarks,
|
||||
required this.onConnect,
|
||||
required this.onDelete,
|
||||
});
|
||||
|
||||
final List<rust.BridgeBookmark> bookmarks;
|
||||
final ValueChanged<rust.BridgeBookmark> onConnect;
|
||||
final ValueChanged<rust.BridgeBookmark> onDelete;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppL10n.of(context);
|
||||
final theme = Theme.of(context);
|
||||
if (bookmarks.isEmpty) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Text(
|
||||
l10n.bookmarksEmpty,
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
);
|
||||
}
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(l10n.bookmarksHeading, style: theme.textTheme.titleSmall),
|
||||
const SizedBox(height: 4),
|
||||
for (final b in bookmarks)
|
||||
Card(
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: ListTile(
|
||||
title: Text(b.displayName),
|
||||
subtitle: Text('${b.host} — ${b.nickname}'),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.login),
|
||||
tooltip: l10n.connectAction,
|
||||
onPressed: () => onConnect(b),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.delete_outline),
|
||||
tooltip: l10n.bookmarkDeleteAction,
|
||||
onPressed: () => onDelete(b),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -465,13 +722,25 @@ class _ConnectForm extends StatelessWidget {
|
||||
class _AudioControls extends StatefulWidget {
|
||||
const _AudioControls({
|
||||
required this.stats,
|
||||
required this.inputMuted,
|
||||
required this.outputMuted,
|
||||
required this.outputGain,
|
||||
required this.onPttDown,
|
||||
required this.onPttUp,
|
||||
required this.onToggleInputMute,
|
||||
required this.onToggleOutputMute,
|
||||
required this.onGainChanged,
|
||||
});
|
||||
|
||||
final rust.BridgeAudioStats? stats;
|
||||
final bool inputMuted;
|
||||
final bool outputMuted;
|
||||
final double outputGain;
|
||||
final VoidCallback onPttDown;
|
||||
final VoidCallback onPttUp;
|
||||
final VoidCallback onToggleInputMute;
|
||||
final VoidCallback onToggleOutputMute;
|
||||
final ValueChanged<double> onGainChanged;
|
||||
|
||||
@override
|
||||
State<_AudioControls> createState() => _AudioControlsState();
|
||||
@@ -540,7 +809,55 @@ class _AudioControlsState extends State<_AudioControls> {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: FilterChip(
|
||||
avatar: Icon(
|
||||
widget.inputMuted ? Icons.mic_off : Icons.mic,
|
||||
size: 18,
|
||||
),
|
||||
label: Text(
|
||||
widget.inputMuted ? l10n.inputUnmuteAction : l10n.inputMuteAction,
|
||||
),
|
||||
selected: widget.inputMuted,
|
||||
onSelected: (_) => widget.onToggleInputMute(),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: FilterChip(
|
||||
avatar: Icon(
|
||||
widget.outputMuted ? Icons.volume_off : Icons.volume_up,
|
||||
size: 18,
|
||||
),
|
||||
label: Text(
|
||||
widget.outputMuted ? l10n.outputUnmuteAction : l10n.outputMuteAction,
|
||||
),
|
||||
selected: widget.outputMuted,
|
||||
onSelected: (_) => widget.onToggleOutputMute(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
const Icon(Icons.volume_down, size: 18),
|
||||
Expanded(
|
||||
child: Slider(
|
||||
value: widget.outputGain.clamp(0.0, 2.0),
|
||||
min: 0.0,
|
||||
max: 2.0,
|
||||
divisions: 40,
|
||||
label: '${(widget.outputGain * 100).round()}%',
|
||||
onChanged: widget.onGainChanged,
|
||||
),
|
||||
),
|
||||
const Icon(Icons.volume_up, size: 18),
|
||||
],
|
||||
),
|
||||
Text(statsText, style: theme.textTheme.bodySmall),
|
||||
],
|
||||
);
|
||||
@@ -548,9 +865,13 @@ class _AudioControlsState extends State<_AudioControls> {
|
||||
}
|
||||
|
||||
class _SnapshotView extends StatelessWidget {
|
||||
const _SnapshotView({required this.snapshot});
|
||||
const _SnapshotView({
|
||||
required this.snapshot,
|
||||
required this.onJoinChannel,
|
||||
});
|
||||
|
||||
final rust.BridgeSnapshot snapshot;
|
||||
final ValueChanged<rust.BridgeChannel> onJoinChannel;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -582,7 +903,6 @@ class _SnapshotView extends StatelessWidget {
|
||||
color: theme.colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
// Server-provided content; preserved verbatim per ADR-008.
|
||||
child: Text(snapshot.welcomeMessage, style: theme.textTheme.bodySmall),
|
||||
),
|
||||
],
|
||||
@@ -595,6 +915,12 @@ class _SnapshotView extends StatelessWidget {
|
||||
leading: const Icon(Icons.tag),
|
||||
title: Text(ch.name),
|
||||
subtitle: Text('id=${ch.id} parent=${ch.parent}'),
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Icons.login),
|
||||
tooltip: l10n.joinChannelAction,
|
||||
onPressed: () => onJoinChannel(ch),
|
||||
),
|
||||
onTap: () => onJoinChannel(ch),
|
||||
),
|
||||
for (final cl in byChannel[ch.id] ?? const <rust.BridgeClient>[])
|
||||
Padding(
|
||||
|
||||
@@ -10,15 +10,23 @@ import 'package:freezed_annotation/freezed_annotation.dart' hide protected;
|
||||
part 'api.freezed.dart';
|
||||
|
||||
// These functions are ignored because they are not marked as `pub`: `log_sink`, `runtime`, `session`
|
||||
// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `from`, `from`, `from`
|
||||
// These function are ignored because they are on traits that is not defined in current crate (put an empty `#[frb]` on it to unignore): `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `clone`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `fmt`, `from`, `from`, `from`, `from`, `from`
|
||||
|
||||
/// Connect to a TeamSpeak-compatible server and return the initial
|
||||
/// state snapshot. Honours the DEC-006 single-connection invariant
|
||||
/// via [`BridgeError::AlreadyConnected`].
|
||||
///
|
||||
/// `password` is optional — pass an empty string for servers that
|
||||
/// don't require one.
|
||||
Future<BridgeSnapshot> connect({
|
||||
required String host,
|
||||
required String nickname,
|
||||
}) => RustLib.instance.api.crateApiConnect(host: host, nickname: nickname);
|
||||
required String password,
|
||||
}) => RustLib.instance.api.crateApiConnect(
|
||||
host: host,
|
||||
nickname: nickname,
|
||||
password: password,
|
||||
);
|
||||
|
||||
/// Re-fetch a fresh snapshot from the active connection.
|
||||
Future<BridgeSnapshot> snapshot() => RustLib.instance.api.crateApiSnapshot();
|
||||
@@ -37,6 +45,36 @@ Future<void> startAudio() => RustLib.instance.api.crateApiStartAudio();
|
||||
Future<void> setPtt({required bool active}) =>
|
||||
RustLib.instance.api.crateApiSetPtt(active: active);
|
||||
|
||||
/// Move our own client to `channel_id`. Optional channel password
|
||||
/// for password-protected channels — pass an empty string when not
|
||||
/// required.
|
||||
Future<void> moveToChannel({
|
||||
required BigInt channelId,
|
||||
required String password,
|
||||
}) => RustLib.instance.api.crateApiMoveToChannel(
|
||||
channelId: channelId,
|
||||
password: password,
|
||||
);
|
||||
|
||||
/// Toggle self input-mute (microphone) on the server. Independent
|
||||
/// of push-to-talk: a muted client never transmits regardless of
|
||||
/// PTT state.
|
||||
Future<void> setInputMuted({required bool muted}) =>
|
||||
RustLib.instance.api.crateApiSetInputMuted(muted: muted);
|
||||
|
||||
/// Toggle self output-mute (speaker). Mutes locally *and* informs
|
||||
/// the server. The server uses this for the channel icon next to
|
||||
/// the client name; the local mute kicks in immediately even
|
||||
/// before the server acknowledges.
|
||||
Future<void> setOutputMuted({required bool muted}) =>
|
||||
RustLib.instance.api.crateApiSetOutputMuted(muted: muted);
|
||||
|
||||
/// Set master output gain. `1.0` is unity, `0.0` is silent. Values
|
||||
/// above `1.0` amplify and can clip downstream. Errors when audio
|
||||
/// is not started.
|
||||
Future<void> setOutputGain({required double gain}) =>
|
||||
RustLib.instance.api.crateApiSetOutputGain(gain: gain);
|
||||
|
||||
/// User-initiated diagnostic export. Returns a multi-line text
|
||||
/// blob, redacted per the production policy, that the user can
|
||||
/// share or copy. DEC-016 forbids automatic uploads — this is the
|
||||
@@ -58,6 +96,23 @@ String exportDiagnostics() => RustLib.instance.api.crateApiExportDiagnostics();
|
||||
Future<void> initStorage({required String dir}) =>
|
||||
RustLib.instance.api.crateApiInitStorage(dir: dir);
|
||||
|
||||
/// List persisted bookmarks.
|
||||
Future<List<BridgeBookmark>> listBookmarks() =>
|
||||
RustLib.instance.api.crateApiListBookmarks();
|
||||
|
||||
/// Insert a bookmark and return its assigned id. The `id` field on
|
||||
/// the input is ignored.
|
||||
Future<PlatformInt64> addBookmark({required BridgeBookmark b}) =>
|
||||
RustLib.instance.api.crateApiAddBookmark(b: b);
|
||||
|
||||
/// Update an existing bookmark.
|
||||
Future<void> updateBookmark({required BridgeBookmark b}) =>
|
||||
RustLib.instance.api.crateApiUpdateBookmark(b: b);
|
||||
|
||||
/// Delete a bookmark by id.
|
||||
Future<void> deleteBookmark({required PlatformInt64 id}) =>
|
||||
RustLib.instance.api.crateApiDeleteBookmark(id: id);
|
||||
|
||||
/// Notify the core of the latest OS-reported connectivity state.
|
||||
/// Called by the Flutter side from `connectivity_plus` callbacks.
|
||||
/// The core's supervisor uses this to (a) pre-charge the watchdog
|
||||
@@ -107,6 +162,52 @@ class BridgeAudioStats {
|
||||
pttActive == other.pttActive;
|
||||
}
|
||||
|
||||
/// Bookmark DTO mirroring [`chanora_core::Bookmark`].
|
||||
class BridgeBookmark {
|
||||
/// Row id assigned by SQLite. Use `0` when adding new rows;
|
||||
/// the returned id is then meaningful.
|
||||
final PlatformInt64 id;
|
||||
|
||||
/// User-facing label.
|
||||
final String displayName;
|
||||
|
||||
/// `hostname[:port]` or TSDNS name.
|
||||
final String host;
|
||||
|
||||
/// Nickname to use for this bookmark.
|
||||
final String nickname;
|
||||
|
||||
/// Optional remembered password. Empty string = none.
|
||||
final String password;
|
||||
|
||||
const BridgeBookmark({
|
||||
required this.id,
|
||||
required this.displayName,
|
||||
required this.host,
|
||||
required this.nickname,
|
||||
required this.password,
|
||||
});
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
id.hashCode ^
|
||||
displayName.hashCode ^
|
||||
host.hashCode ^
|
||||
nickname.hashCode ^
|
||||
password.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is BridgeBookmark &&
|
||||
runtimeType == other.runtimeType &&
|
||||
id == other.id &&
|
||||
displayName == other.displayName &&
|
||||
host == other.host &&
|
||||
nickname == other.nickname &&
|
||||
password == other.password;
|
||||
}
|
||||
|
||||
/// Channel as seen by Dart. Matches `chanora_protocol::ChannelInfo`
|
||||
/// but with primitive `u64` ids so the Dart side gets `BigInt`s
|
||||
/// without any wrapper-type ceremony.
|
||||
|
||||
@@ -67,7 +67,7 @@ class RustLib extends BaseEntrypoint<RustLibApi, RustLibApiImpl, RustLibWire> {
|
||||
String get codegenVersion => '2.12.0';
|
||||
|
||||
@override
|
||||
int get rustContentHash => 2126340080;
|
||||
int get rustContentHash => 663465485;
|
||||
|
||||
static const kDefaultExternalLibraryLoaderConfig =
|
||||
ExternalLibraryLoaderConfig(
|
||||
@@ -79,6 +79,8 @@ class RustLib extends BaseEntrypoint<RustLibApi, RustLibApiImpl, RustLibWire> {
|
||||
}
|
||||
|
||||
abstract class RustLibApi extends BaseApi {
|
||||
Future<PlatformInt64> crateApiAddBookmark({required BridgeBookmark b});
|
||||
|
||||
Future<BridgeAudioStats> crateApiAudioStats();
|
||||
|
||||
Future<void> crateApiBridgeInit();
|
||||
@@ -86,8 +88,11 @@ abstract class RustLibApi extends BaseApi {
|
||||
Future<BridgeSnapshot> crateApiConnect({
|
||||
required String host,
|
||||
required String nickname,
|
||||
required String password,
|
||||
});
|
||||
|
||||
Future<void> crateApiDeleteBookmark({required PlatformInt64 id});
|
||||
|
||||
Future<void> crateApiDisconnect();
|
||||
|
||||
Stream<BridgeEvent> crateApiEventsStream();
|
||||
@@ -98,13 +103,28 @@ abstract class RustLibApi extends BaseApi {
|
||||
|
||||
Future<bool> crateApiIsConnected();
|
||||
|
||||
Future<List<BridgeBookmark>> crateApiListBookmarks();
|
||||
|
||||
Future<void> crateApiMoveToChannel({
|
||||
required BigInt channelId,
|
||||
required String password,
|
||||
});
|
||||
|
||||
Future<void> crateApiSetInputMuted({required bool muted});
|
||||
|
||||
void crateApiSetNetworkState({required BridgeNetworkState state});
|
||||
|
||||
Future<void> crateApiSetOutputGain({required double gain});
|
||||
|
||||
Future<void> crateApiSetOutputMuted({required bool muted});
|
||||
|
||||
Future<void> crateApiSetPtt({required bool active});
|
||||
|
||||
Future<BridgeSnapshot> crateApiSnapshot();
|
||||
|
||||
Future<void> crateApiStartAudio();
|
||||
|
||||
Future<void> crateApiUpdateBookmark({required BridgeBookmark b});
|
||||
}
|
||||
|
||||
class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
@@ -115,6 +135,34 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
required super.portManager,
|
||||
});
|
||||
|
||||
@override
|
||||
Future<PlatformInt64> crateApiAddBookmark({required BridgeBookmark b}) {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_box_autoadd_bridge_bookmark(b, serializer);
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 1,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_i_64,
|
||||
decodeErrorData: sse_decode_bridge_error,
|
||||
),
|
||||
constMeta: kCrateApiAddBookmarkConstMeta,
|
||||
argValues: [b],
|
||||
apiImpl: this,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
TaskConstMeta get kCrateApiAddBookmarkConstMeta =>
|
||||
const TaskConstMeta(debugName: "add_bookmark", argNames: ["b"]);
|
||||
|
||||
@override
|
||||
Future<BridgeAudioStats> crateApiAudioStats() {
|
||||
return handler.executeNormal(
|
||||
@@ -124,7 +172,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 1,
|
||||
funcId: 2,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
@@ -151,7 +199,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 2,
|
||||
funcId: 3,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
@@ -173,6 +221,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
Future<BridgeSnapshot> crateApiConnect({
|
||||
required String host,
|
||||
required String nickname,
|
||||
required String password,
|
||||
}) {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
@@ -180,10 +229,11 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_String(host, serializer);
|
||||
sse_encode_String(nickname, serializer);
|
||||
sse_encode_String(password, serializer);
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 3,
|
||||
funcId: 4,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
@@ -192,14 +242,44 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
decodeErrorData: sse_decode_bridge_error,
|
||||
),
|
||||
constMeta: kCrateApiConnectConstMeta,
|
||||
argValues: [host, nickname],
|
||||
argValues: [host, nickname, password],
|
||||
apiImpl: this,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
TaskConstMeta get kCrateApiConnectConstMeta =>
|
||||
const TaskConstMeta(debugName: "connect", argNames: ["host", "nickname"]);
|
||||
TaskConstMeta get kCrateApiConnectConstMeta => const TaskConstMeta(
|
||||
debugName: "connect",
|
||||
argNames: ["host", "nickname", "password"],
|
||||
);
|
||||
|
||||
@override
|
||||
Future<void> crateApiDeleteBookmark({required PlatformInt64 id}) {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_i_64(id, serializer);
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 5,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_unit,
|
||||
decodeErrorData: sse_decode_bridge_error,
|
||||
),
|
||||
constMeta: kCrateApiDeleteBookmarkConstMeta,
|
||||
argValues: [id],
|
||||
apiImpl: this,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
TaskConstMeta get kCrateApiDeleteBookmarkConstMeta =>
|
||||
const TaskConstMeta(debugName: "delete_bookmark", argNames: ["id"]);
|
||||
|
||||
@override
|
||||
Future<void> crateApiDisconnect() {
|
||||
@@ -210,7 +290,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 4,
|
||||
funcId: 6,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
@@ -240,7 +320,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 5,
|
||||
funcId: 7,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
@@ -266,7 +346,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
SyncTask(
|
||||
callFfi: () {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 6)!;
|
||||
return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 8)!;
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_String,
|
||||
@@ -292,7 +372,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 7,
|
||||
funcId: 9,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
@@ -319,7 +399,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 8,
|
||||
funcId: 10,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
@@ -337,6 +417,95 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
TaskConstMeta get kCrateApiIsConnectedConstMeta =>
|
||||
const TaskConstMeta(debugName: "is_connected", argNames: []);
|
||||
|
||||
@override
|
||||
Future<List<BridgeBookmark>> crateApiListBookmarks() {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 11,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_list_bridge_bookmark,
|
||||
decodeErrorData: sse_decode_bridge_error,
|
||||
),
|
||||
constMeta: kCrateApiListBookmarksConstMeta,
|
||||
argValues: [],
|
||||
apiImpl: this,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
TaskConstMeta get kCrateApiListBookmarksConstMeta =>
|
||||
const TaskConstMeta(debugName: "list_bookmarks", argNames: []);
|
||||
|
||||
@override
|
||||
Future<void> crateApiMoveToChannel({
|
||||
required BigInt channelId,
|
||||
required String password,
|
||||
}) {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_u_64(channelId, serializer);
|
||||
sse_encode_String(password, serializer);
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 12,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_unit,
|
||||
decodeErrorData: sse_decode_bridge_error,
|
||||
),
|
||||
constMeta: kCrateApiMoveToChannelConstMeta,
|
||||
argValues: [channelId, password],
|
||||
apiImpl: this,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
TaskConstMeta get kCrateApiMoveToChannelConstMeta => const TaskConstMeta(
|
||||
debugName: "move_to_channel",
|
||||
argNames: ["channelId", "password"],
|
||||
);
|
||||
|
||||
@override
|
||||
Future<void> crateApiSetInputMuted({required bool muted}) {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_bool(muted, serializer);
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 13,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_unit,
|
||||
decodeErrorData: sse_decode_bridge_error,
|
||||
),
|
||||
constMeta: kCrateApiSetInputMutedConstMeta,
|
||||
argValues: [muted],
|
||||
apiImpl: this,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
TaskConstMeta get kCrateApiSetInputMutedConstMeta =>
|
||||
const TaskConstMeta(debugName: "set_input_muted", argNames: ["muted"]);
|
||||
|
||||
@override
|
||||
void crateApiSetNetworkState({required BridgeNetworkState state}) {
|
||||
return handler.executeSync(
|
||||
@@ -344,7 +513,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
callFfi: () {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_bridge_network_state(state, serializer);
|
||||
return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 9)!;
|
||||
return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 14)!;
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_unit,
|
||||
@@ -360,6 +529,62 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
TaskConstMeta get kCrateApiSetNetworkStateConstMeta =>
|
||||
const TaskConstMeta(debugName: "set_network_state", argNames: ["state"]);
|
||||
|
||||
@override
|
||||
Future<void> crateApiSetOutputGain({required double gain}) {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_f_32(gain, serializer);
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 15,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_unit,
|
||||
decodeErrorData: sse_decode_bridge_error,
|
||||
),
|
||||
constMeta: kCrateApiSetOutputGainConstMeta,
|
||||
argValues: [gain],
|
||||
apiImpl: this,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
TaskConstMeta get kCrateApiSetOutputGainConstMeta =>
|
||||
const TaskConstMeta(debugName: "set_output_gain", argNames: ["gain"]);
|
||||
|
||||
@override
|
||||
Future<void> crateApiSetOutputMuted({required bool muted}) {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_bool(muted, serializer);
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 16,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_unit,
|
||||
decodeErrorData: sse_decode_bridge_error,
|
||||
),
|
||||
constMeta: kCrateApiSetOutputMutedConstMeta,
|
||||
argValues: [muted],
|
||||
apiImpl: this,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
TaskConstMeta get kCrateApiSetOutputMutedConstMeta =>
|
||||
const TaskConstMeta(debugName: "set_output_muted", argNames: ["muted"]);
|
||||
|
||||
@override
|
||||
Future<void> crateApiSetPtt({required bool active}) {
|
||||
return handler.executeNormal(
|
||||
@@ -370,7 +595,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 10,
|
||||
funcId: 17,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
@@ -397,7 +622,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 11,
|
||||
funcId: 18,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
@@ -424,7 +649,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 12,
|
||||
funcId: 19,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
@@ -442,6 +667,34 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
TaskConstMeta get kCrateApiStartAudioConstMeta =>
|
||||
const TaskConstMeta(debugName: "start_audio", argNames: []);
|
||||
|
||||
@override
|
||||
Future<void> crateApiUpdateBookmark({required BridgeBookmark b}) {
|
||||
return handler.executeNormal(
|
||||
NormalTask(
|
||||
callFfi: (port_) {
|
||||
final serializer = SseSerializer(generalizedFrbRustBinding);
|
||||
sse_encode_box_autoadd_bridge_bookmark(b, serializer);
|
||||
pdeCallFfi(
|
||||
generalizedFrbRustBinding,
|
||||
serializer,
|
||||
funcId: 20,
|
||||
port: port_,
|
||||
);
|
||||
},
|
||||
codec: SseCodec(
|
||||
decodeSuccessData: sse_decode_unit,
|
||||
decodeErrorData: sse_decode_bridge_error,
|
||||
),
|
||||
constMeta: kCrateApiUpdateBookmarkConstMeta,
|
||||
argValues: [b],
|
||||
apiImpl: this,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
TaskConstMeta get kCrateApiUpdateBookmarkConstMeta =>
|
||||
const TaskConstMeta(debugName: "update_bookmark", argNames: ["b"]);
|
||||
|
||||
@protected
|
||||
AnyhowException dco_decode_AnyhowException(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
@@ -468,6 +721,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
return raw as bool;
|
||||
}
|
||||
|
||||
@protected
|
||||
BridgeBookmark dco_decode_box_autoadd_bridge_bookmark(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return dco_decode_bridge_bookmark(raw);
|
||||
}
|
||||
|
||||
@protected
|
||||
BridgeAudioStats dco_decode_bridge_audio_stats(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
@@ -481,6 +740,21 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
BridgeBookmark dco_decode_bridge_bookmark(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
final arr = raw as List<dynamic>;
|
||||
if (arr.length != 5)
|
||||
throw Exception('unexpected arr length: expect 5 but see ${arr.length}');
|
||||
return BridgeBookmark(
|
||||
id: dco_decode_i_64(arr[0]),
|
||||
displayName: dco_decode_String(arr[1]),
|
||||
host: dco_decode_String(arr[2]),
|
||||
nickname: dco_decode_String(arr[3]),
|
||||
password: dco_decode_String(arr[4]),
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
BridgeChannel dco_decode_bridge_channel(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
@@ -583,6 +857,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
double dco_decode_f_32(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return raw as double;
|
||||
}
|
||||
|
||||
@protected
|
||||
int dco_decode_i_32(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
@@ -595,6 +875,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
return dcoDecodeI64(raw);
|
||||
}
|
||||
|
||||
@protected
|
||||
List<BridgeBookmark> dco_decode_list_bridge_bookmark(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
return (raw as List<dynamic>).map(dco_decode_bridge_bookmark).toList();
|
||||
}
|
||||
|
||||
@protected
|
||||
List<BridgeChannel> dco_decode_list_bridge_channel(dynamic raw) {
|
||||
// Codec=Dco (DartCObject based), see doc to use other codecs
|
||||
@@ -665,6 +951,14 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
return deserializer.buffer.getUint8() != 0;
|
||||
}
|
||||
|
||||
@protected
|
||||
BridgeBookmark sse_decode_box_autoadd_bridge_bookmark(
|
||||
SseDeserializer deserializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
return (sse_decode_bridge_bookmark(deserializer));
|
||||
}
|
||||
|
||||
@protected
|
||||
BridgeAudioStats sse_decode_bridge_audio_stats(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
@@ -678,6 +972,23 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
BridgeBookmark sse_decode_bridge_bookmark(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
var var_id = sse_decode_i_64(deserializer);
|
||||
var var_displayName = sse_decode_String(deserializer);
|
||||
var var_host = sse_decode_String(deserializer);
|
||||
var var_nickname = sse_decode_String(deserializer);
|
||||
var var_password = sse_decode_String(deserializer);
|
||||
return BridgeBookmark(
|
||||
id: var_id,
|
||||
displayName: var_displayName,
|
||||
host: var_host,
|
||||
nickname: var_nickname,
|
||||
password: var_password,
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
BridgeChannel sse_decode_bridge_channel(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
@@ -796,6 +1107,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
);
|
||||
}
|
||||
|
||||
@protected
|
||||
double sse_decode_f_32(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
return deserializer.buffer.getFloat32();
|
||||
}
|
||||
|
||||
@protected
|
||||
int sse_decode_i_32(SseDeserializer deserializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
@@ -808,6 +1125,20 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
return deserializer.buffer.getPlatformInt64();
|
||||
}
|
||||
|
||||
@protected
|
||||
List<BridgeBookmark> sse_decode_list_bridge_bookmark(
|
||||
SseDeserializer deserializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
|
||||
var len_ = sse_decode_i_32(deserializer);
|
||||
var ans_ = <BridgeBookmark>[];
|
||||
for (var idx_ = 0; idx_ < len_; ++idx_) {
|
||||
ans_.add(sse_decode_bridge_bookmark(deserializer));
|
||||
}
|
||||
return ans_;
|
||||
}
|
||||
|
||||
@protected
|
||||
List<BridgeChannel> sse_decode_list_bridge_channel(
|
||||
SseDeserializer deserializer,
|
||||
@@ -904,6 +1235,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
serializer.buffer.putUint8(self ? 1 : 0);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_box_autoadd_bridge_bookmark(
|
||||
BridgeBookmark self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_bridge_bookmark(self, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_bridge_audio_stats(
|
||||
BridgeAudioStats self,
|
||||
@@ -915,6 +1255,19 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
sse_encode_bool(self.pttActive, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_bridge_bookmark(
|
||||
BridgeBookmark self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_64(self.id, serializer);
|
||||
sse_encode_String(self.displayName, serializer);
|
||||
sse_encode_String(self.host, serializer);
|
||||
sse_encode_String(self.nickname, serializer);
|
||||
sse_encode_String(self.password, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_bridge_channel(BridgeChannel self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
@@ -1013,6 +1366,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
sse_encode_list_bridge_client(self.clients, serializer);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_f_32(double self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
serializer.buffer.putFloat32(self);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_i_32(int self, SseSerializer serializer) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
@@ -1025,6 +1384,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
|
||||
serializer.buffer.putPlatformInt64(self);
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_list_bridge_bookmark(
|
||||
List<BridgeBookmark> self,
|
||||
SseSerializer serializer,
|
||||
) {
|
||||
// Codec=Sse (Serialization based), see doc to use other codecs
|
||||
sse_encode_i_32(self.length, serializer);
|
||||
for (final item in self) {
|
||||
sse_encode_bridge_bookmark(item, serializer);
|
||||
}
|
||||
}
|
||||
|
||||
@protected
|
||||
void sse_encode_list_bridge_channel(
|
||||
List<BridgeChannel> self,
|
||||
|
||||
@@ -33,9 +33,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
@protected
|
||||
bool dco_decode_bool(dynamic raw);
|
||||
|
||||
@protected
|
||||
BridgeBookmark dco_decode_box_autoadd_bridge_bookmark(dynamic raw);
|
||||
|
||||
@protected
|
||||
BridgeAudioStats dco_decode_bridge_audio_stats(dynamic raw);
|
||||
|
||||
@protected
|
||||
BridgeBookmark dco_decode_bridge_bookmark(dynamic raw);
|
||||
|
||||
@protected
|
||||
BridgeChannel dco_decode_bridge_channel(dynamic raw);
|
||||
|
||||
@@ -54,12 +60,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
@protected
|
||||
BridgeSnapshot dco_decode_bridge_snapshot(dynamic raw);
|
||||
|
||||
@protected
|
||||
double dco_decode_f_32(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_i_32(dynamic raw);
|
||||
|
||||
@protected
|
||||
PlatformInt64 dco_decode_i_64(dynamic raw);
|
||||
|
||||
@protected
|
||||
List<BridgeBookmark> dco_decode_list_bridge_bookmark(dynamic raw);
|
||||
|
||||
@protected
|
||||
List<BridgeChannel> dco_decode_list_bridge_channel(dynamic raw);
|
||||
|
||||
@@ -95,9 +107,17 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
@protected
|
||||
bool sse_decode_bool(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
BridgeBookmark sse_decode_box_autoadd_bridge_bookmark(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
BridgeAudioStats sse_decode_bridge_audio_stats(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
BridgeBookmark sse_decode_bridge_bookmark(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
BridgeChannel sse_decode_bridge_channel(SseDeserializer deserializer);
|
||||
|
||||
@@ -118,12 +138,20 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
@protected
|
||||
BridgeSnapshot sse_decode_bridge_snapshot(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
double sse_decode_f_32(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_i_32(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
PlatformInt64 sse_decode_i_64(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
List<BridgeBookmark> sse_decode_list_bridge_bookmark(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<BridgeChannel> sse_decode_list_bridge_channel(
|
||||
SseDeserializer deserializer,
|
||||
@@ -167,12 +195,24 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
@protected
|
||||
void sse_encode_bool(bool self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_box_autoadd_bridge_bookmark(
|
||||
BridgeBookmark self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_bridge_audio_stats(
|
||||
BridgeAudioStats self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_bridge_bookmark(
|
||||
BridgeBookmark self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_bridge_channel(BridgeChannel self, SseSerializer serializer);
|
||||
|
||||
@@ -197,12 +237,21 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_f_32(double self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_i_32(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_i_64(PlatformInt64 self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_bridge_bookmark(
|
||||
List<BridgeBookmark> self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_bridge_channel(
|
||||
List<BridgeChannel> self,
|
||||
|
||||
@@ -35,9 +35,15 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
@protected
|
||||
bool dco_decode_bool(dynamic raw);
|
||||
|
||||
@protected
|
||||
BridgeBookmark dco_decode_box_autoadd_bridge_bookmark(dynamic raw);
|
||||
|
||||
@protected
|
||||
BridgeAudioStats dco_decode_bridge_audio_stats(dynamic raw);
|
||||
|
||||
@protected
|
||||
BridgeBookmark dco_decode_bridge_bookmark(dynamic raw);
|
||||
|
||||
@protected
|
||||
BridgeChannel dco_decode_bridge_channel(dynamic raw);
|
||||
|
||||
@@ -56,12 +62,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
@protected
|
||||
BridgeSnapshot dco_decode_bridge_snapshot(dynamic raw);
|
||||
|
||||
@protected
|
||||
double dco_decode_f_32(dynamic raw);
|
||||
|
||||
@protected
|
||||
int dco_decode_i_32(dynamic raw);
|
||||
|
||||
@protected
|
||||
PlatformInt64 dco_decode_i_64(dynamic raw);
|
||||
|
||||
@protected
|
||||
List<BridgeBookmark> dco_decode_list_bridge_bookmark(dynamic raw);
|
||||
|
||||
@protected
|
||||
List<BridgeChannel> dco_decode_list_bridge_channel(dynamic raw);
|
||||
|
||||
@@ -97,9 +109,17 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
@protected
|
||||
bool sse_decode_bool(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
BridgeBookmark sse_decode_box_autoadd_bridge_bookmark(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
BridgeAudioStats sse_decode_bridge_audio_stats(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
BridgeBookmark sse_decode_bridge_bookmark(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
BridgeChannel sse_decode_bridge_channel(SseDeserializer deserializer);
|
||||
|
||||
@@ -120,12 +140,20 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
@protected
|
||||
BridgeSnapshot sse_decode_bridge_snapshot(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
double sse_decode_f_32(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
int sse_decode_i_32(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
PlatformInt64 sse_decode_i_64(SseDeserializer deserializer);
|
||||
|
||||
@protected
|
||||
List<BridgeBookmark> sse_decode_list_bridge_bookmark(
|
||||
SseDeserializer deserializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
List<BridgeChannel> sse_decode_list_bridge_channel(
|
||||
SseDeserializer deserializer,
|
||||
@@ -169,12 +197,24 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
@protected
|
||||
void sse_encode_bool(bool self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_box_autoadd_bridge_bookmark(
|
||||
BridgeBookmark self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_bridge_audio_stats(
|
||||
BridgeAudioStats self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_bridge_bookmark(
|
||||
BridgeBookmark self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_bridge_channel(BridgeChannel self, SseSerializer serializer);
|
||||
|
||||
@@ -199,12 +239,21 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_f_32(double self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_i_32(int self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_i_64(PlatformInt64 self, SseSerializer serializer);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_bridge_bookmark(
|
||||
List<BridgeBookmark> self,
|
||||
SseSerializer serializer,
|
||||
);
|
||||
|
||||
@protected
|
||||
void sse_encode_list_bridge_channel(
|
||||
List<BridgeChannel> self,
|
||||
|
||||
@@ -29,6 +29,7 @@ void main() {
|
||||
final snap = await rust.connect(
|
||||
host: 'cn.teamspeak.app',
|
||||
nickname: 'ChanoraAlphaTest',
|
||||
password: '',
|
||||
);
|
||||
expect(snap.serverName, isNotEmpty);
|
||||
expect(snap.channels, isNotEmpty);
|
||||
|
||||
@@ -30,6 +30,7 @@ void main() {
|
||||
final snap = await rust.connect(
|
||||
host: 'cn.teamspeak.app',
|
||||
nickname: 'ChanoraBetaTest',
|
||||
password: '',
|
||||
);
|
||||
expect(snap.serverName, isNotEmpty);
|
||||
expect(snap.channels, isNotEmpty);
|
||||
|
||||
Reference in New Issue
Block a user