feat #14740: automatic call detection on windows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+13
-2
@@ -7,7 +7,7 @@ use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent}
|
||||
use tauri::{AppHandle, Manager};
|
||||
|
||||
use crate::commands;
|
||||
use crate::state::AppState;
|
||||
use crate::state::{AppState, RecordingState};
|
||||
|
||||
const OPEN: &str = "open";
|
||||
const RECORD: &str = "record";
|
||||
@@ -34,6 +34,13 @@ pub fn create(app: &AppHandle) -> tauri::Result<()> {
|
||||
commands::show_recorder_if_recording(app);
|
||||
}
|
||||
RECORD => {
|
||||
if matches!(
|
||||
app.state::<AppState>().recording_state(),
|
||||
RecordingState::Recording { .. }
|
||||
) {
|
||||
commands::show_recorder(app);
|
||||
return;
|
||||
}
|
||||
// Opening the audio devices can take a moment; keep the
|
||||
// event loop free.
|
||||
let app = app.clone();
|
||||
@@ -67,7 +74,11 @@ pub fn create(app: &AppHandle) -> tauri::Result<()> {
|
||||
fn quit(app: &AppHandle) {
|
||||
let app = app.clone();
|
||||
thread::spawn(move || {
|
||||
if let Err(e) = app.state::<AppState>().stop_recording() {
|
||||
if let Some(Err(e)) = app
|
||||
.state::<AppState>()
|
||||
.stop_recording()
|
||||
.map(|ended| ended.result)
|
||||
{
|
||||
log::error!("stopping the recording on quit failed: {e}");
|
||||
}
|
||||
app.exit(0);
|
||||
|
||||
Reference in New Issue
Block a user