fix #14740: attribute teams helper processes, queue end-of-call prompts
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+13
-12
@@ -16,7 +16,7 @@ use serde::Serialize;
|
||||
use tauri::{AppHandle, Emitter, Manager, State};
|
||||
use tauri_plugin_autostart::ManagerExt;
|
||||
|
||||
use crate::state::{AppState, CallBrief, DeviceLevels, Ended, RecordingState};
|
||||
use crate::state::{AppState, CallBrief, DeviceLevels, Ended, PendingPrompt, RecordingState};
|
||||
|
||||
const LEVELS_INTERVAL: Duration = Duration::from_millis(100);
|
||||
|
||||
@@ -106,7 +106,7 @@ pub async fn discard_current_recording(app: AppHandle) -> CmdResult<()> {
|
||||
/// The call the end-of-call prompt asks about, so the prompt can render even
|
||||
/// if it missed the `call-ended` event.
|
||||
#[tauri::command]
|
||||
pub fn get_pending_prompt(state: State<'_, AppState>) -> Option<CallBrief> {
|
||||
pub fn get_pending_prompt(state: State<'_, AppState>) -> Option<PendingPrompt> {
|
||||
state.pending_prompt()
|
||||
}
|
||||
|
||||
@@ -115,12 +115,13 @@ pub fn get_call_brief(state: State<'_, AppState>, id: CallId) -> CmdResult<CallB
|
||||
state.call_brief(id)
|
||||
}
|
||||
|
||||
/// Deletes a finished call's audio and row; closes the prompt if it asked
|
||||
/// about this call.
|
||||
/// Deletes a finished call's audio and row. If that was the last call the
|
||||
/// prompt was waiting on, closes the prompt; otherwise the prompt reloads
|
||||
/// and shows the next one.
|
||||
#[tauri::command]
|
||||
pub async fn discard_call(app: AppHandle, id: CallId) -> CmdResult<()> {
|
||||
blocking(app, move |app| {
|
||||
if app.state::<AppState>().discard_call(id)? {
|
||||
if app.state::<AppState>().discard_call(id)? == Some(0) {
|
||||
set_window_visible(app, "prompt", false);
|
||||
}
|
||||
Ok(())
|
||||
@@ -152,13 +153,13 @@ pub fn start_detected(app: &AppHandle, name: &str, root_pid: u32) -> CmdResult<C
|
||||
Ok(call_id)
|
||||
}
|
||||
|
||||
/// Stops the current recording at the user's request (■ Stopp). Stopping
|
||||
/// a detected call also keeps detection from restarting it until the call
|
||||
/// Stops the current recording at the user's request (■ Stopp), manual or
|
||||
/// detected. Detection then leaves the ongoing call alone until the call
|
||||
/// app releases the mic.
|
||||
pub fn stop(app: &AppHandle) -> CmdResult<()> {
|
||||
let state = app.state::<AppState>();
|
||||
let ended = state.stop_recording();
|
||||
if ended.as_ref().is_some_and(|ended| ended.detected) {
|
||||
if ended.is_some() {
|
||||
state.suppress_detected_call();
|
||||
}
|
||||
after_stop(app, ended)
|
||||
@@ -173,12 +174,12 @@ pub fn end_detected_call(app: &AppHandle) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Throws the current recording away. Never shows the prompt; a discarded
|
||||
/// detected call is not detected again until the call app releases the mic.
|
||||
/// Throws the current recording away. Never shows the prompt; detection
|
||||
/// then leaves the ongoing call alone until the call app releases the mic.
|
||||
pub fn discard(app: &AppHandle) -> CmdResult<()> {
|
||||
let state = app.state::<AppState>();
|
||||
let ended = state.discard_current_recording();
|
||||
if ended.as_ref().is_some_and(|ended| ended.detected) {
|
||||
if ended.is_some() {
|
||||
state.suppress_detected_call();
|
||||
}
|
||||
sync_recorder_window(app);
|
||||
@@ -202,7 +203,7 @@ fn after_stop(app: &AppHandle, ended: Option<Ended>) -> CmdResult<()> {
|
||||
};
|
||||
ended.result?;
|
||||
let id = ended.call_id;
|
||||
app.state::<AppState>().set_pending_prompt(id);
|
||||
app.state::<AppState>().queue_prompt(id);
|
||||
show_and_focus(app, "prompt");
|
||||
if let Err(e) = app.emit("call-ended", CallEnded { id }) {
|
||||
log::error!("could not emit call-ended: {e}");
|
||||
|
||||
Reference in New Issue
Block a user