Reabre chat minimizado quando chegam novas mensagens
This commit is contained in:
parent
b663268791
commit
6ab1789c0f
1 changed files with 5 additions and 4 deletions
|
|
@ -675,15 +675,15 @@ async fn process_chat_update(
|
||||||
);
|
);
|
||||||
|
|
||||||
// Mostrar janela de chat minimizada (menos intrusivo que abrir completo)
|
// Mostrar janela de chat minimizada (menos intrusivo que abrir completo)
|
||||||
// Só abre se a janela não existir - se usuário fechou, não reabre automaticamente
|
|
||||||
if let Some(session) = current_sessions.first() {
|
if let Some(session) = current_sessions.first() {
|
||||||
let label = format!("chat-{}", session.ticket_id);
|
let label = format!("chat-{}", session.ticket_id);
|
||||||
if app.get_webview_window(&label).is_none() {
|
if let Some(window) = app.get_webview_window(&label) {
|
||||||
|
let _ = window.show();
|
||||||
|
let _ = set_chat_minimized(app, &session.ticket_id, true);
|
||||||
|
} else {
|
||||||
let _ = open_chat_window(app, &session.ticket_id, session.ticket_ref);
|
let _ = open_chat_window(app, &session.ticket_id, session.ticket_ref);
|
||||||
// Minimizar imediatamente após abrir
|
|
||||||
let _ = set_chat_minimized(app, &session.ticket_id, true);
|
let _ = set_chat_minimized(app, &session.ticket_id, true);
|
||||||
}
|
}
|
||||||
// Se janela já existe, não força reabrir - respeita decisão do usuário
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notificacao nativa
|
// Notificacao nativa
|
||||||
|
|
@ -814,3 +814,4 @@ pub fn set_chat_minimized(app: &tauri::AppHandle, ticket_id: &str, minimized: bo
|
||||||
crate::log_info!("Chat {} -> minimized={}", ticket_id, minimized);
|
crate::log_info!("Chat {} -> minimized={}", ticket_id, minimized);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue