fix(desktop): corrige travamento com múltiplos chats
Problemas corrigidos: - Removido always_on_top de todas as janelas (causava competição de Z-order) - Removido inner_size() síncrono que bloqueava a UI thread - Simplificado process_chat_update para não fazer múltiplas operações de janela - Removidos logs de debug 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
4ad0dc5c1e
commit
c7b6d78ec2
4 changed files with 10 additions and 42 deletions
|
|
@ -1001,21 +1001,16 @@ async fn process_chat_update(
|
|||
}
|
||||
|
||||
// Se ha multiplas sessoes ativas, usar o hub; senao, abrir janela do chat individual
|
||||
// SIMPLIFICADO: Removido inner_size() que bloqueava a UI thread
|
||||
if current_sessions.len() > 1 {
|
||||
// Multiplas sessoes - usar hub window
|
||||
if app.get_webview_window(HUB_WINDOW_LABEL).is_none() {
|
||||
// Hub nao existe - criar minimizado
|
||||
let _ = open_hub_window(app);
|
||||
} else {
|
||||
// Hub ja existe - verificar se esta minimizado
|
||||
// Hub ja existe - apenas mostrar (sem verificar tamanho para evitar bloqueio)
|
||||
if let Some(hub) = app.get_webview_window(HUB_WINDOW_LABEL) {
|
||||
let _ = hub.show();
|
||||
if let Ok(size) = hub.inner_size() {
|
||||
if size.height < 100 {
|
||||
// Esta minimizado, manter assim
|
||||
let _ = set_hub_minimized(app, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1035,19 +1030,8 @@ async fn process_chat_update(
|
|||
if let Some(session) = session_to_show {
|
||||
let label = format!("chat-{}", session.ticket_id);
|
||||
if let Some(window) = app.get_webview_window(&label) {
|
||||
// Janela ja existe - apenas mostrar (NAO minimizar se estiver expandida)
|
||||
// Isso permite que o usuario mantenha o chat aberto enquanto recebe mensagens
|
||||
// Janela ja existe - apenas mostrar (sem verificar tamanho para evitar bloqueio)
|
||||
let _ = window.show();
|
||||
// Verificar se esta expandida (altura > 100px significa expandido)
|
||||
// Se estiver expandida, NAO minimizar - usuario esta usando o chat
|
||||
if let Ok(size) = window.inner_size() {
|
||||
let is_expanded = size.height > 100;
|
||||
if !is_expanded {
|
||||
// Janela esta minimizada, manter minimizada
|
||||
let _ = set_chat_minimized(app, &session.ticket_id, true);
|
||||
}
|
||||
// Se esta expandida, nao faz nada - deixa o usuario continuar usando
|
||||
}
|
||||
} else {
|
||||
// Criar nova janela ja minimizada (menos intrusivo)
|
||||
let _ = open_chat_window_internal(app, &session.ticket_id, session.ticket_ref, true);
|
||||
|
|
@ -1170,7 +1154,7 @@ fn open_chat_window_with_state(app: &tauri::AppHandle, ticket_id: &str, ticket_r
|
|||
.transparent(true) // Permite fundo transparente
|
||||
.shadow(false) // Desabilitar sombra para transparencia funcionar corretamente
|
||||
.resizable(false) // Desabilitar redimensionamento manual
|
||||
.always_on_top(true)
|
||||
// REMOVIDO: always_on_top(true) causa competicao de Z-order com multiplas janelas
|
||||
.skip_taskbar(true)
|
||||
.focused(true)
|
||||
.visible(true)
|
||||
|
|
@ -1273,7 +1257,7 @@ fn open_hub_window_with_state(app: &tauri::AppHandle, start_minimized: bool) ->
|
|||
.transparent(true)
|
||||
.shadow(false)
|
||||
.resizable(false) // Desabilitar redimensionamento manual
|
||||
.always_on_top(true)
|
||||
// REMOVIDO: always_on_top(true) causa competicao de Z-order com multiplas janelas
|
||||
.skip_taskbar(true)
|
||||
.focused(true)
|
||||
.visible(true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue