feat #14740: automatic call detection on windows
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+23
-5
@@ -1,4 +1,5 @@
|
||||
mod commands;
|
||||
mod detection;
|
||||
mod state;
|
||||
mod tray;
|
||||
|
||||
@@ -6,12 +7,15 @@ use recorder_core::secrets::KeyringSecrets;
|
||||
use recorder_core::store::Store;
|
||||
use tauri::{Manager, WindowEvent};
|
||||
use tauri_plugin_autostart::MacosLauncher;
|
||||
use tauri_plugin_log::{RotationStrategy, Target, TargetKind, TimezoneStrategy};
|
||||
|
||||
use crate::state::AppState;
|
||||
|
||||
/// Command-line flag the login item starts the app with; the main window
|
||||
/// then stays hidden in the tray.
|
||||
const AUTOSTART_ARG: &str = "--autostart";
|
||||
/// Size at which the log file is rotated; two old files are kept.
|
||||
const LOG_FILE_SIZE: u128 = 1_000_000;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
@@ -25,13 +29,22 @@ pub fn run() {
|
||||
Some(vec![AUTOSTART_ARG]),
|
||||
))
|
||||
.setup(|app| {
|
||||
// Release builds log to a file in the app log directory (on
|
||||
// Windows %LOCALAPPDATA%\eu.euvino.callrecorder\logs), debug
|
||||
// builds to stdout as well. Never log API keys or transcripts.
|
||||
let mut targets = vec![Target::new(TargetKind::LogDir { file_name: None })];
|
||||
if cfg!(debug_assertions) {
|
||||
app.handle().plugin(
|
||||
tauri_plugin_log::Builder::default()
|
||||
.level(log::LevelFilter::Info)
|
||||
.build(),
|
||||
)?;
|
||||
targets.push(Target::new(TargetKind::Stdout));
|
||||
}
|
||||
app.handle().plugin(
|
||||
tauri_plugin_log::Builder::new()
|
||||
.targets(targets)
|
||||
.level(log::LevelFilter::Info)
|
||||
.max_file_size(LOG_FILE_SIZE)
|
||||
.rotation_strategy(RotationStrategy::KeepSome(2))
|
||||
.timezone_strategy(TimezoneStrategy::UseLocal)
|
||||
.build(),
|
||||
)?;
|
||||
|
||||
let data_dir = app.path().app_data_dir()?;
|
||||
let config_dir = app.path().app_config_dir()?;
|
||||
@@ -51,6 +64,7 @@ pub fn run() {
|
||||
commands::apply_autostart(app.handle(), autostart);
|
||||
|
||||
tray::create(app.handle())?;
|
||||
detection::spawn(app.handle().clone());
|
||||
if !std::env::args().any(|arg| arg == AUTOSTART_ARG) {
|
||||
commands::show_main(app.handle());
|
||||
}
|
||||
@@ -75,6 +89,10 @@ pub fn run() {
|
||||
commands::start_manual_recording,
|
||||
commands::stop_recording,
|
||||
commands::discard_current_recording,
|
||||
commands::get_pending_prompt,
|
||||
commands::get_call_brief,
|
||||
commands::discard_call,
|
||||
commands::transcribe_call,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while building tauri application");
|
||||
|
||||
Reference in New Issue
Block a user