fix(client): derive voice status from a single state machine
The status bar and voice page kept saying the room was being joined while the sidebar already reported a connected voice. Clicking the room you were already in set a free-text 'joining' message that nothing cleared, because the server does not answer a repeated join, and the voice page showed its joining label whenever the member list was empty. Joining is now an explicit voice state. The sidebar, the voice page and the status text all read one derived status; a repeated click only shows the room, and a server error cancels a pending join.
This commit is contained in:
parent
69d108b090
commit
7d488faf59
9 changed files with 153 additions and 14 deletions
|
|
@ -612,6 +612,7 @@ fn chat_handle(ui: &mut UiState, net: &NetHandle, event: NetEvent) {
|
|||
ui.scroll_bottom = true;
|
||||
}
|
||||
NetEvent::Error { message, .. } => {
|
||||
ui.cancel_pending_voice_join();
|
||||
if message.starts_with("media:") {
|
||||
crate::ui::media::on_error(&message);
|
||||
}
|
||||
|
|
@ -931,6 +932,8 @@ pub fn sync_voice_audio(state: &mut AppState) {
|
|||
let active_voice = state.ui.voice_target.clone();
|
||||
match active_voice {
|
||||
Some(id) => start_voice(state, &id),
|
||||
// A pending join has no target until the server acknowledges it.
|
||||
None if matches!(state.ui.voice, VoiceUiState::Joining { .. }) => {}
|
||||
None => stop_voice(state),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue