fix(desktop): adiciona permissao start-dragging e debug logging no Hub
- Adiciona core🪟allow-start-dragging para corrigir erro ACL do drag-region - Adiciona logging detalhado no ChatHubWidget para debug de clicks - Adiciona logging no comando open_chat_window para diagnostico - Ajusta ordem size/position e set_ignore_cursor_events no Hub - Remove set_hub_minimized apos build para evitar conflitos de timing 🤖 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
0cdbc082ab
commit
6430d33c7c
5 changed files with 54 additions and 13 deletions
|
|
@ -14,6 +14,7 @@
|
|||
"core:window:allow-hide",
|
||||
"core:window:allow-show",
|
||||
"core:window:allow-set-focus",
|
||||
"core:window:allow-start-dragging",
|
||||
"dialog:allow-open",
|
||||
"opener:default",
|
||||
"store:default",
|
||||
|
|
|
|||
|
|
@ -1282,8 +1282,15 @@ fn open_hub_window_with_state(app: &tauri::AppHandle, start_minimized: bool) ->
|
|||
.build()
|
||||
.map_err(|e| e.to_string())?;
|
||||
|
||||
// Reaplica layout/posicao
|
||||
let _ = set_hub_minimized(app, start_minimized);
|
||||
// IMPORTANTE: Garantir que a janela receba eventos de cursor (evita click-through)
|
||||
if let Some(hub) = app.get_webview_window(HUB_WINDOW_LABEL) {
|
||||
let _ = hub.set_ignore_cursor_events(false);
|
||||
let _ = hub.set_focus();
|
||||
}
|
||||
|
||||
// REMOVIDO TEMPORARIAMENTE: set_hub_minimized logo apos build pode causar
|
||||
// "resize em cima do resize" no timing errado do WebView2
|
||||
// let _ = set_hub_minimized(app, start_minimized);
|
||||
|
||||
crate::log_info!("Hub window aberta (minimizada={})", start_minimized);
|
||||
Ok(())
|
||||
|
|
@ -1305,10 +1312,14 @@ pub fn set_hub_minimized(app: &tauri::AppHandle, minimized: bool) -> Result<(),
|
|||
(400.0, 520.0) // Lista expandida (igual ao web)
|
||||
};
|
||||
|
||||
// Primeiro reposiciona, depois redimensiona para evitar corte
|
||||
let (x, y) = resolve_chat_window_position(app, Some(&window), width, height);
|
||||
window.set_position(tauri::LogicalPosition::new(x, y)).map_err(|e| e.to_string())?;
|
||||
|
||||
// IGUAL AO CHAT: primeiro size, depois position (ordem importa para hit-test no Windows)
|
||||
window.set_size(tauri::LogicalSize::new(width, height)).map_err(|e| e.to_string())?;
|
||||
window.set_position(tauri::LogicalPosition::new(x, y)).map_err(|e| e.to_string())?;
|
||||
|
||||
// Reforcar foco apos resize
|
||||
let _ = window.set_focus();
|
||||
|
||||
crate::log_info!("Hub -> minimized={}, size={}x{}, pos=({},{})", minimized, width, height, x, y);
|
||||
Ok(())
|
||||
|
|
|
|||
|
|
@ -411,7 +411,10 @@ async fn upload_chat_file(
|
|||
|
||||
#[tauri::command]
|
||||
fn open_chat_window(app: tauri::AppHandle, ticket_id: String, ticket_ref: u64) -> Result<(), String> {
|
||||
chat::open_chat_window(&app, &ticket_id, ticket_ref)
|
||||
log_info!("[CMD] open_chat_window called: ticket_id={}, ticket_ref={}", ticket_id, ticket_ref);
|
||||
let result = chat::open_chat_window(&app, &ticket_id, ticket_ref);
|
||||
log_info!("[CMD] open_chat_window result: {:?}", result);
|
||||
result
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
|
|
|||
|
|
@ -39,11 +39,21 @@ export function ChatHubWidget() {
|
|||
return () => window.removeEventListener("resize", handler)
|
||||
}, [])
|
||||
|
||||
// DEBUG: Detectar se a janela esta em modo click-through
|
||||
useEffect(() => {
|
||||
const onDown = (e: PointerEvent) => console.log("POINTER DOWN HUB", e.target)
|
||||
window.addEventListener("pointerdown", onDown)
|
||||
return () => window.removeEventListener("pointerdown", onDown)
|
||||
}, [])
|
||||
|
||||
const handleSelectSession = async (ticketId: string, ticketRef: number) => {
|
||||
console.log("handleSelectSession CALLED", { ticketId, ticketRef })
|
||||
try {
|
||||
await invoke("open_chat_window", { ticketId, ticketRef })
|
||||
// Tauri 2.x auto-converts snake_case (Rust) to camelCase (JS)
|
||||
const result = await invoke("open_chat_window", { ticketId, ticketRef })
|
||||
console.log("open_chat_window SUCCESS", result)
|
||||
} catch (err) {
|
||||
console.error("Erro ao abrir janela de chat:", err)
|
||||
console.error("open_chat_window FAILED:", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -57,11 +67,13 @@ export function ChatHubWidget() {
|
|||
}
|
||||
|
||||
const handleExpand = async () => {
|
||||
console.log("handleExpand CALLED")
|
||||
try {
|
||||
await invoke("set_hub_minimized", { minimized: false })
|
||||
const result = await invoke("set_hub_minimized", { minimized: false })
|
||||
console.log("set_hub_minimized SUCCESS", result)
|
||||
setTimeout(() => setIsMinimized(false), 100)
|
||||
} catch (err) {
|
||||
console.error("Erro ao expandir hub:", err)
|
||||
console.error("set_hub_minimized FAILED:", err)
|
||||
setIsMinimized(false)
|
||||
}
|
||||
}
|
||||
|
|
@ -114,7 +126,14 @@ export function ChatHubWidget() {
|
|||
return (
|
||||
<div className="pointer-events-none flex h-full w-full items-end justify-end bg-transparent pr-3">
|
||||
<button
|
||||
onClick={handleExpand}
|
||||
onClick={(e) => {
|
||||
console.log("EXPAND BUTTON CLICKED")
|
||||
e.stopPropagation()
|
||||
handleExpand()
|
||||
}}
|
||||
onPointerDown={(e) => console.log("EXPAND POINTER DOWN", e.target)}
|
||||
onMouseDown={(e) => console.log("EXPAND MOUSE DOWN", e.target)}
|
||||
onMouseUp={(e) => console.log("EXPAND MOUSE UP", e.target)}
|
||||
className="pointer-events-auto relative flex items-center gap-2 rounded-full bg-black px-4 py-2 text-white shadow-lg hover:bg-black/90"
|
||||
>
|
||||
<MessageCircle className="size-4" />
|
||||
|
|
@ -193,9 +212,16 @@ function SessionItem({
|
|||
session: MachineSession
|
||||
onClick: () => void
|
||||
}) {
|
||||
const handleClick = (e: React.MouseEvent) => {
|
||||
console.log("SESSION ITEM CLICKED", session.ticketRef)
|
||||
e.stopPropagation()
|
||||
onClick()
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={onClick}
|
||||
onClick={handleClick}
|
||||
onPointerDown={() => console.log("SESSION POINTER DOWN", session.ticketRef)}
|
||||
className="flex w-full items-center gap-3 rounded-xl p-3 text-left transition hover:bg-slate-50"
|
||||
>
|
||||
{/* Avatar */}
|
||||
|
|
|
|||
|
|
@ -1115,9 +1115,9 @@ const resolvedAppUrl = useMemo(() => {
|
|||
// Abre/minimiza chat quando aparecem novas não lidas
|
||||
if (hasSessions && totalUnread > prevUnread) {
|
||||
const session = payload.sessions[0]
|
||||
invoke("open_chat_window", { ticket_id: session.ticketId, ticket_ref: session.ticketRef }).catch(console.error)
|
||||
invoke("open_chat_window", { ticketId: session.ticketId, ticketRef: session.ticketRef }).catch(console.error)
|
||||
// Minimiza para não ser intrusivo
|
||||
invoke("set_chat_minimized", { ticket_id: session.ticketId, minimized: true }).catch(console.error)
|
||||
invoke("set_chat_minimized", { ticketId: session.ticketId, minimized: true }).catch(console.error)
|
||||
}
|
||||
|
||||
prevUnread = totalUnread
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue