fix(ui): drawer buttons, stats fields, nicknames

- Buttons: use text labels (Mic/Spk/End) instead of emoji HTML
  entities that rendered as raw text on Android WebView
- Stats: match Rust CallStatus fields (tx_codec, rx_codec,
  encode_fps, recv_fps, audio_level, spk_muted)
- Nicknames: register_signal sends derive_alias() as the alias
  so other users see "Brave Falcon" instead of "a525:e9b2:..."
- Lobby header shows alias from get_app_info instead of raw fp
- pollStatus uses correct field names from Rust struct

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-04-14 19:00:09 +04:00
parent 25471c694f
commit 01a3133544
3 changed files with 25 additions and 23 deletions

View File

@@ -79,13 +79,13 @@
</div>
<div class="vd-controls">
<button id="vd-mic-btn" class="vd-btn" title="Mic (m)">
<span id="vd-mic-icon">&#x1F3A4;</span>
<span id="vd-mic-icon">Mic</span>
</button>
<button id="vd-spk-btn" class="vd-btn" title="Speaker (s)">
<span id="vd-spk-icon">&#x1F50A;</span>
<span id="vd-spk-icon">Spk</span>
</button>
<button id="vd-end-btn" class="vd-btn vd-end" title="Leave voice (q)">
<span>&#x26D4;</span>
<span>End</span>
</button>
</div>
</div>

View File

@@ -1215,8 +1215,11 @@ fn do_register_signal(
let transport = Arc::new(wzp_transport::QuinnTransport::new(conn));
emit_call_debug(&app, "register_signal:quic_connected", serde_json::json!({ "relay": relay }));
// Send alias from seed-derived adjective+noun so other
// users see a friendly name in the lobby.
let alias = derive_alias(&seed);
transport.send_signal(&SignalMessage::RegisterPresence {
identity_pub, signature: vec![], alias: None,
identity_pub, signature: vec![], alias: Some(alias),
}).await.map_err(|e| format!("{e}"))?;
emit_call_debug(&app, "register_signal:register_presence_sent", serde_json::json!({}));

View File

@@ -359,16 +359,15 @@ vdSpkBtn.addEventListener("click", async () => {
interface CallStatusI {
active: boolean;
mic_muted: boolean;
speaker_muted: boolean;
send_rms: number;
recv_rms: number;
codec_tx: string;
codec_rx: string;
fec_ratio: number;
send_packets: number;
recv_packets: number;
spk_muted: boolean;
participants: any[];
encode_fps: number;
recv_fps: number;
audio_level: number;
call_duration_secs: number;
fingerprint: string;
tx_codec: string;
rx_codec: string;
}
async function pollStatus() {
@@ -382,12 +381,12 @@ async function pollStatus() {
// Update drawer controls
vdMicBtn.classList.toggle("muted", st.mic_muted);
vdMicIcon.textContent = st.mic_muted ? "&#x1F507;" : "&#x1F3A4;";
vdSpkBtn.classList.toggle("muted", st.speaker_muted);
vdSpkIcon.textContent = st.speaker_muted ? "&#x1F507;" : "&#x1F50A;";
vdMicIcon.textContent = st.mic_muted ? "Muted" : "Mic";
vdSpkBtn.classList.toggle("muted", st.spk_muted);
vdSpkIcon.textContent = st.spk_muted ? "Off" : "Spk";
// Level meter
const pct = Math.min(100, (st.send_rms / 10000) * 100);
const pct = Math.min(100, (st.audio_level / 10000) * 100);
vdLevelBar.style.width = `${pct}%`;
// Duration
@@ -417,7 +416,7 @@ async function pollStatus() {
}
// Stats
vdStats.textContent = `TX: ${st.codec_tx} ${st.send_packets}pkt | RX: ${st.codec_rx} ${st.recv_packets}pkt | FEC: ${(st.fec_ratio * 100).toFixed(0)}%`;
vdStats.textContent = `TX: ${st.tx_codec} ${st.encode_fps}fps | RX: ${st.rx_codec} ${st.recv_fps}fps`;
} catch {}
}
@@ -718,13 +717,13 @@ async function autoConnect() {
lobbyDot.style.background = "var(--green)";
lobbyRelayLabel.textContent = `${relay.name} — connected`;
// Get identity
const fp: string = await invoke("get_identity");
if (fp) {
myFingerprint = fp;
lobbyFp.textContent = fp;
// Get identity + alias
const appInfo: any = await invoke("get_app_info");
if (appInfo?.fingerprint) {
myFingerprint = appInfo.fingerprint;
lobbyFp.textContent = appInfo.alias || appInfo.fingerprint;
lobbyIdenticon.innerHTML = "";
lobbyIdenticon.appendChild(createIdenticonEl(fp, 20, true));
lobbyIdenticon.appendChild(createIdenticonEl(appInfo.fingerprint, 20, true));
}
} catch (e: any) {
lobbyDot.style.background = "var(--red)";