feat: event-driven UI updates for instant channel switching (#15)
* chore: regenerate Cargo.lock after rebase * fix(ui): add 1s cool-down to prevent double-tap channel join voiceJoin returns instantly (fire-and-forget protocol), so the pending-join guard clears before a second tap lands. The cool-down prevents the rapid channel oscillation and ClientIsFlooding (524) that results from double-tapping. * fix(ui): handle ChannelAlreadyIn as success, ClientIsFlooding with backoff - ChannelAlreadyIn (0x0302): treat as silent success, update UI state - ClientIsFlooding (0x020c): show localized snackbar, extend cooldown 5s - Add l10n strings for flooding error (en + zh) * fix(proto): use Windows TS3 client version for broadest compatibility Matches Qint's default (Windows_3_X_X__1). Avoids server-side behavioral differences with TS5 version strings. * fix(proto): patch tsproto-types to handle short P-256 coordinates BigInt::to_bytes_be() strips leading zeros, causing WrongPublicKeyLength when a server's ephemeral key coordinate starts with 0x00. Patch from EdisonJwa/tsclientlib fix/p256-short-coordinate-pad branch left-pads coordinates to the P-256 field size instead of rejecting them. * refactor(core): stop watchdog from emitting SnapshotChanged The watchdog now serves only as a liveness probe (miss counting for reconnection). UI updates are handled entirely by the event-driven delta path (ProtocolDelta → SessionEvent → BridgeEvent → Flutter). Removes signature tracking and SnapshotChanged emission from the supervisor loop. The initial snapshot is still fetched via the Connected event handler in Flutter. * refactor(ui): remove channel-join cooldown guard With event-driven deltas the UI updates instantly on channel moves, so the 1-second cooldown is no longer needed. Double-taps are handled by the server (ChannelAlreadyIn → success) and the pending-channel-id guard prevents overlapping requests. Also removes the _lastJoinCompletedAt field entirely. * fix(core): reattach event forwarders after reconnect The reconnect path swapped in a new ProtocolClient but never took chat_rx, activity_rx, or delta_rx from it. After the first reconnect, the event-driven UI pipeline was dead. Fix by extracting spawn_event_forwarders() helper called on both initial connect and reconnect. Also replaces lossy try_recv+sleep polling with proper recv().await for push-based delivery. * feat(protocol): enrich delta schema with all snapshot-visible fields ClientJoined now carries input_muted, output_muted, is_server_query, talk_power, talk_power_granted. ChannelAdded/ChannelUpdated now carry has_password and needed_talk_power. ClientUpdated also carries is_server_query, talk_power, talk_power_granted. This prevents local snapshot drift where fabricated defaults could hide password requirements, talk-power restrictions, or client type. * refactor: remove dead SnapshotChanged variant end-to-end SnapshotChanged is no longer emitted since the watchdog was refactored to liveness-only. Removes the variant from SessionEvent, BridgeEvent, and the Flutter switch statement. FRB bindings regenerated. * fix(ci): regenerate license inventory and fix iOS submodule fetch - Regenerate docs/security/license-inventory.md to match current lockfile - Remove submodules: true from checkout (causes hard fail on private submodule) - Add explicit git submodule update --init --depth=1 with || true fallback - Check silero-coreml/Package.swift instead of directory existence
This commit is contained in:
@@ -1612,15 +1612,6 @@ pub enum BridgeEvent {
|
||||
AudioStarted,
|
||||
/// Audio engine stopped.
|
||||
AudioStopped,
|
||||
/// Snapshot probe observed a change in channel/client counts.
|
||||
/// UI uses this to drive an auto-refresh without active
|
||||
/// polling.
|
||||
SnapshotChanged {
|
||||
/// Latest channel count.
|
||||
channels: u32,
|
||||
/// Latest client count.
|
||||
clients: u32,
|
||||
},
|
||||
/// Detected desktop Push-to-Talk capability (gen2 v0.9.3,
|
||||
/// DEC-023..028). The fields carry only privacy-safe values per
|
||||
/// DEC-027: the capability level, a stable backend identifier,
|
||||
@@ -1707,9 +1698,51 @@ pub enum BridgeEvent {
|
||||
},
|
||||
/// Audio route changed (speaker/earpiece/BT/wired).
|
||||
AudioRouteChanged {
|
||||
/// The new audio route.
|
||||
route: BridgeAudioRoute,
|
||||
},
|
||||
ClientMoved {
|
||||
client_id: u64,
|
||||
new_channel_id: u64,
|
||||
},
|
||||
ClientJoined {
|
||||
client_id: u64,
|
||||
channel_id: u64,
|
||||
name: String,
|
||||
input_muted: bool,
|
||||
output_muted: bool,
|
||||
is_server_query: bool,
|
||||
talk_power: i32,
|
||||
talk_power_granted: bool,
|
||||
},
|
||||
ClientLeft {
|
||||
client_id: u64,
|
||||
name: String,
|
||||
},
|
||||
ClientUpdated {
|
||||
client_id: u64,
|
||||
input_muted: bool,
|
||||
output_muted: bool,
|
||||
is_server_query: bool,
|
||||
talk_power: i32,
|
||||
talk_power_granted: bool,
|
||||
},
|
||||
ChannelAdded {
|
||||
id: u64,
|
||||
parent: u64,
|
||||
name: String,
|
||||
order: i64,
|
||||
has_password: bool,
|
||||
needed_talk_power: Option<i32>,
|
||||
},
|
||||
ChannelRemoved {
|
||||
id: u64,
|
||||
},
|
||||
ChannelUpdated {
|
||||
id: u64,
|
||||
name: String,
|
||||
has_password: bool,
|
||||
needed_talk_power: Option<i32>,
|
||||
},
|
||||
}
|
||||
|
||||
/// Bridge message target scope.
|
||||
@@ -1838,9 +1871,6 @@ impl From<chanora_core::SessionEvent> for BridgeEvent {
|
||||
}
|
||||
chanora_core::SessionEvent::AudioStarted => BridgeEvent::AudioStarted,
|
||||
chanora_core::SessionEvent::AudioStopped => BridgeEvent::AudioStopped,
|
||||
chanora_core::SessionEvent::SnapshotChanged { channels, clients } => {
|
||||
BridgeEvent::SnapshotChanged { channels, clients }
|
||||
}
|
||||
chanora_core::SessionEvent::PttCapability {
|
||||
level,
|
||||
backend_id,
|
||||
@@ -1899,6 +1929,27 @@ impl From<chanora_core::SessionEvent> for BridgeEvent {
|
||||
route: route.into(),
|
||||
}
|
||||
}
|
||||
chanora_core::SessionEvent::ClientMoved { client_id, new_channel_id } => {
|
||||
BridgeEvent::ClientMoved { client_id, new_channel_id }
|
||||
}
|
||||
chanora_core::SessionEvent::ClientJoined { client_id, channel_id, name, input_muted, output_muted, is_server_query, talk_power, talk_power_granted } => {
|
||||
BridgeEvent::ClientJoined { client_id, channel_id, name, input_muted, output_muted, is_server_query, talk_power, talk_power_granted }
|
||||
}
|
||||
chanora_core::SessionEvent::ClientLeft { client_id, name } => {
|
||||
BridgeEvent::ClientLeft { client_id, name }
|
||||
}
|
||||
chanora_core::SessionEvent::ClientUpdated { client_id, input_muted, output_muted, is_server_query, talk_power, talk_power_granted } => {
|
||||
BridgeEvent::ClientUpdated { client_id, input_muted, output_muted, is_server_query, talk_power, talk_power_granted }
|
||||
}
|
||||
chanora_core::SessionEvent::ChannelAdded { id, parent, name, order, has_password, needed_talk_power } => {
|
||||
BridgeEvent::ChannelAdded { id, parent, name, order, has_password, needed_talk_power }
|
||||
}
|
||||
chanora_core::SessionEvent::ChannelRemoved { id } => {
|
||||
BridgeEvent::ChannelRemoved { id }
|
||||
}
|
||||
chanora_core::SessionEvent::ChannelUpdated { id, name, has_password, needed_talk_power } => {
|
||||
BridgeEvent::ChannelUpdated { id, name, has_password, needed_talk_power }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user